培训类型
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Newtonsoft.Json;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using SgManager.AI;
|
||||
using System;
|
||||
@@ -518,33 +519,43 @@ namespace BLL
|
||||
item.DepartName = depart.DepartName;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
//var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
|
||||
//if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
|
||||
//{
|
||||
// foreach (var item in getPersons)
|
||||
// {
|
||||
// var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
|
||||
// join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
|
||||
// where y.ProjectId ==null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
|
||||
// select x).FirstOrDefault();
|
||||
// if (getTrainPersonIdList1 == null)
|
||||
// {
|
||||
// var getTrainPersonIdList2 = (from x in db.Training_Task
|
||||
// join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||
// where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
|
||||
// select x).FirstOrDefault();
|
||||
// if (getTrainPersonIdList2 == null)
|
||||
// {
|
||||
// getTrainPersonList.Add(item);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// return getTrainPersonList;
|
||||
//}
|
||||
//else
|
||||
if (!string.IsNullOrEmpty(trainTypeId) && trainTypeId == Const.SpecialSafeTrainId)//专项安全培训
|
||||
{
|
||||
var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList();
|
||||
getPersons = getPersons.Where(x => ids.Contains(x.DepartId));
|
||||
}
|
||||
|
||||
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
var getTrainType = db.Base_TrainType.FirstOrDefault(e => e.TrainTypeId == trainTypeId);
|
||||
|
||||
|
||||
|
||||
|
||||
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
|
||||
{
|
||||
foreach (var item in getPersons)
|
||||
{
|
||||
var getTrainPersonIdList1 = (from x in db.EduTrain_TrainRecordDetail
|
||||
join y in db.EduTrain_TrainRecord on x.TrainingId equals y.TrainingId
|
||||
where y.ProjectId == null && y.TrainTypeId == trainTypeId && x.CheckResult == true && x.PersonId == item.PersonId
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList1 == null)
|
||||
{
|
||||
var getTrainPersonIdList2 = (from x in db.Training_Task
|
||||
join y in db.Training_Plan on x.PlanId equals y.PlanId
|
||||
where y.ProjectId == null && y.TrainTypeId == trainTypeId && y.States != "3" && x.UserId == item.PersonId
|
||||
select x).FirstOrDefault();
|
||||
if (getTrainPersonIdList2 == null)
|
||||
{
|
||||
getTrainPersonList.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
return getTrainPersonList;
|
||||
}
|
||||
else
|
||||
{
|
||||
return getPersons.ToList();
|
||||
}
|
||||
@@ -611,7 +622,11 @@ namespace BLL
|
||||
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
|
||||
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(trainTypeId) &&trainTypeId == Const.SpecialSafeTrainId)//专项安全培训
|
||||
{
|
||||
var ids = db.Base_WorkPost.Where(x => x.PostType == "2").Select(x => x.WorkPostId).ToList();
|
||||
getPersons = getPersons.Where(x => ids.Contains(x.DepartId));
|
||||
}
|
||||
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId);
|
||||
if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false))
|
||||
|
||||
@@ -113,6 +113,8 @@ namespace BLL
|
||||
States = x.States,
|
||||
QRCodeUrl = x.QRCodeUrl.Replace('\\', '/'),
|
||||
TrainingPlanId = x.PlanId,
|
||||
TrainTypeId= x.TrainTypeId,
|
||||
TrainTypeName = db.Base_TrainType.Where(xx=>xx.TrainTypeId==x.TrainTypeId).Select(xx=>xx.TrainTypeName).FirstOrDefault()
|
||||
}).FirstOrDefault();
|
||||
|
||||
if (getDataLists != null)
|
||||
@@ -174,6 +176,7 @@ namespace BLL
|
||||
DepartIds = getTestPlan.DepartIds,
|
||||
States = getTestPlan.States,
|
||||
PlanDate = DateTime.Now,
|
||||
TrainTypeId=getTestPlan.TrainTypeId
|
||||
};
|
||||
if (!string.IsNullOrEmpty(getTestPlan.ProjectId))
|
||||
{
|
||||
@@ -200,7 +203,6 @@ namespace BLL
|
||||
|
||||
db.Training_TestPlan.InsertOnSubmit(newTestPlan);
|
||||
db.SubmitChanges();
|
||||
|
||||
CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(Const.ProjectTestPlanMenuId, newTestPlan.ProjectId, null, newTestPlan.TestPlanId, newTestPlan.PlanDate);
|
||||
}
|
||||
else
|
||||
@@ -220,6 +222,7 @@ namespace BLL
|
||||
isUpdate.UnitIds = newTestPlan.UnitIds;
|
||||
isUpdate.WorkPostIds = newTestPlan.WorkPostIds;
|
||||
isUpdate.DepartIds = newTestPlan.DepartIds;
|
||||
isUpdate.TrainTypeId = newTestPlan.TrainTypeId;
|
||||
////删除 考生记录
|
||||
var deleteRecords = from x in db.Training_TestRecord
|
||||
where x.TestPlanId == isUpdate.TestPlanId
|
||||
@@ -239,7 +242,7 @@ namespace BLL
|
||||
}
|
||||
|
||||
db.Training_TestRecord.DeleteAllOnSubmit(deleteRecords);
|
||||
db.SubmitChanges();
|
||||
db.SubmitChanges();
|
||||
}
|
||||
|
||||
////删除 考试题目类型
|
||||
|
||||
Reference in New Issue
Block a user