|
|
|
@ -1,4 +1,5 @@ |
|
|
|
|
using MongoDB.Driver.Linq; |
|
|
|
|
using Tiobon.Core.Model.Models.RootTkey.Interface; |
|
|
|
|
using static Tiobon.Core.Model.Consts; |
|
|
|
|
|
|
|
|
|
namespace Tiobon.Core.Services; |
|
|
|
@ -322,7 +323,7 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
await Db.Ado.BeginTranAsync(); |
|
|
|
|
//await Db.Ado.BeginTranAsync(); |
|
|
|
|
|
|
|
|
|
var rule = await Db.Queryable<Ghre_StudyRule>().FirstAsync(x => x.Id == ruleId); |
|
|
|
|
|
|
|
|
@ -437,12 +438,12 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul |
|
|
|
|
var staff = staffs[i]; |
|
|
|
|
|
|
|
|
|
var record = await Db.Queryable<Ghre_StudyRecord>() |
|
|
|
|
.Where(x => x.StudyRuleId != ruleId && x.StaffId == staff.StaffID) |
|
|
|
|
.Where(x => x.StudyRuleId != null && x.StaffId == staff.StaffID) |
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(rule.Year), x => x.Year == rule.Year) |
|
|
|
|
.WhereIF(rule.CourseId != null, x => x.CourseId == rule.CourseId) |
|
|
|
|
.WhereIF(rule.CourseSceneId != null, x => x.CourseSceneId == rule.CourseSceneId) |
|
|
|
|
//.AS("Ghre_StudyRecord_V") |
|
|
|
|
.FirstAsync(); |
|
|
|
|
//.AS("Ghre_StudyRecord_V") |
|
|
|
|
.ClearFilter<IBaseDeleteFilter>().FirstAsync(); |
|
|
|
|
if (record is null) |
|
|
|
|
{ |
|
|
|
|
inserts.Add(new Ghre_StudyRecord() |
|
|
|
@ -460,7 +461,8 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul |
|
|
|
|
CourseStatus = Consts.DIC_STUDY_RECORD_COURSE_STATUS_IN, |
|
|
|
|
StudyStatus = Consts.DIC_STUDY_RECORD_STUDY_STATUS.NO_JOIN, |
|
|
|
|
Year = rule.Year, |
|
|
|
|
PlanId = rule.PlanId |
|
|
|
|
PlanId = rule.PlanId, |
|
|
|
|
StudyProgress = 0 |
|
|
|
|
}); |
|
|
|
|
insertResults.Add(new Ghre_StudyRuleResult() |
|
|
|
|
{ |
|
|
|
@ -538,7 +540,7 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul |
|
|
|
|
.ExecuteCommandAsync(); |
|
|
|
|
#endregion |
|
|
|
|
|
|
|
|
|
await Db.Ado.CommitTranAsync(); |
|
|
|
|
//await Db.Ado.CommitTranAsync(); |
|
|
|
|
|
|
|
|
|
string sql = @"UPDATE A
|
|
|
|
|
SET A.StaffName = B.StaffName, a.StaffNo = B.StaffNo |
|
|
|
@ -548,7 +550,7 @@ public class Ghre_StudyRuleServices : BaseServices<Ghre_StudyRule, Ghre_StudyRul |
|
|
|
|
} |
|
|
|
|
catch (Exception E) |
|
|
|
|
{ |
|
|
|
|
await Db.Ado.RollbackTranAsync(); |
|
|
|
|
//await Db.Ado.RollbackTranAsync(); |
|
|
|
|
|
|
|
|
|
await Db.Updateable<Ghre_StudyRule>().Where(x => x.Id == ruleId) |
|
|
|
|
.SetColumns(it => new Ghre_StudyRule() { Result = E.Message }) |
|
|
|
|