1
This commit is contained in:
@@ -648,6 +648,88 @@ namespace BLL
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static List<Model.PersonItem> getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId, string name)
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
|
||||
var getPersons = from x in db.View_SitePerson_Person
|
||||
where x.ProjectId == projectId && x.States == Const.ProjectPersonStates_1
|
||||
select new Model.PersonItem
|
||||
{
|
||||
SitePersonId = x.SitePersonId,
|
||||
PersonId = x.PersonId,
|
||||
CardNo = x.CardNo,
|
||||
PersonName = x.PersonName,
|
||||
SexName = x.SexName,
|
||||
IdentityCard = x.IdentityCard,
|
||||
Address = x.Address,
|
||||
ProjectId = x.ProjectId,
|
||||
ProjectCode = x.ProjectCode,
|
||||
ProjectName = x.ProjectName,
|
||||
UnitId = x.UnitId,
|
||||
UnitCode = x.UnitCode,
|
||||
UnitName = x.UnitName,
|
||||
TeamGroupId = x.TeamGroupId,
|
||||
TeamGroupName = x.TeamGroupName,
|
||||
WorkPostId = x.WorkPostId,
|
||||
WorkPostName = x.WorkPostName,
|
||||
InTime = string.Format("{0:yyyy-MM-dd}", x.InTime),
|
||||
OutTime = string.Format("{0:yyyy-MM-dd}", x.OutTime),
|
||||
OutResult = x.OutResult,
|
||||
Telephone = x.Telephone,
|
||||
PhotoUrl = x.PhotoUrl,
|
||||
DepartName = x.DepartName,
|
||||
};
|
||||
if (!string.IsNullOrEmpty(unitIds))
|
||||
{
|
||||
List<string> unitIdList = Funs.GetStrListByStr(unitIds, ',');
|
||||
getPersons = getPersons.Where(x => unitIdList.Contains(x.UnitId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(workPostIds))
|
||||
{
|
||||
List<string> workPostIdList = Funs.GetStrListByStr(workPostIds, ',');
|
||||
getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(name))
|
||||
{
|
||||
getPersons = getPersons.Where(x => x.PersonName.Contains(name));
|
||||
}
|
||||
|
||||
List<Model.PersonItem> getTrainPersonList = new List<Model.PersonItem>();
|
||||
var getTrainType = TrainTypeService.GetTrainTypeById(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 == projectId && 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 == projectId && 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 人员信息保存方法
|
||||
|
||||
Reference in New Issue
Block a user