This commit is contained in:
2026-06-10 12:41:06 +08:00
parent 403833e4b6
commit 04ff51015a
+57 -59
View File
@@ -38,67 +38,65 @@ namespace BLL
/// <returns></returns>
public static IEnumerable getListData(string workPostId, string postTitleId, string name, string certificateId, Grid Grid1)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
Model.SGGLDB db = Funs.DB;
IQueryable<Model.Person_Persons> getDataList = from x in db.Person_Persons
where x.PersonId != Const.sysglyId && x.PersonId != Const.hfnbdId && x.UnitId == Const.UnitId_SEDIN
&& x.DepartId == Const.Depart_constructionId
&& x.CurrentProjectId == null && (!x.IsOffice.HasValue || x.IsOffice == false)
select x;
if (!string.IsNullOrEmpty(workPostId) && workPostId != Const._Null)
{
IQueryable<Model.Person_Persons> getDataList = from x in db.Person_Persons
where x.PersonId != Const.sysglyId && x.PersonId != Const.hfnbdId && x.UnitId == Const.UnitId_SEDIN
&& x.DepartId == Const.Depart_constructionId
&& x.CurrentProjectId == null && (!x.IsOffice.HasValue || x.IsOffice == false)
select x;
if (!string.IsNullOrEmpty(workPostId) && workPostId != Const._Null)
{
getDataList = getDataList.Where(e => e.WorkPostId == workPostId);
}
if (!string.IsNullOrEmpty(postTitleId) && postTitleId != Const._Null)
{
getDataList = getDataList.Where(e => e.PostTitleId == postTitleId);
}
if (!string.IsNullOrEmpty(name))
{
getDataList = getDataList.Where(e => e.PersonName.Contains(name));
}
if (!string.IsNullOrEmpty(certificateId) && postTitleId != Const._Null)
{
getDataList = getDataList.Where(e => e.CertificateId.Contains(certificateId));
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.PersonId,
x.PersonName,
x.JobNum,
x.Account,
x.IdentityCard,
Sex = x.Sex ?? "1",
x.Birthday,
x.UnitId,
x.DepartId,
x.WorkPostId,
WorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(db, x.WorkPostId),
x.Major,
x.PostTitleId,
PostTitleName = PostTitleService.getPostTitleNameById(db, x.PostTitleId),
x.IsOffice,
x.RoleIds,
RoleName = RoleService.getRoleNamesRoleIds(db, x.RoleIds),
x.CurrentProjectId,
LastProjectName = getCurrentProjectName(db, x.PersonId),
x.CurrentProjectWorkPostId,
LastWorkPostName = getCurrentProjectWorkPostName(db, x.PersonId),
IsPost = x.IsPost ?? true,
IsPostName = x.IsPost == false ? "否" : "是",
x.SignatureUrl,
x.CertificateId,
};
getDataList = getDataList.Where(e => e.WorkPostId == workPostId);
}
if (!string.IsNullOrEmpty(postTitleId) && postTitleId != Const._Null)
{
getDataList = getDataList.Where(e => e.PostTitleId == postTitleId);
}
if (!string.IsNullOrEmpty(name))
{
getDataList = getDataList.Where(e => e.PersonName.Contains(name));
}
if (!string.IsNullOrEmpty(certificateId) && postTitleId != Const._Null)
{
getDataList = getDataList.Where(e => e.CertificateId.Contains(certificateId));
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList, Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
x.PersonId,
x.PersonName,
x.JobNum,
x.Account,
x.IdentityCard,
Sex = x.Sex ?? "1",
x.Birthday,
x.UnitId,
x.DepartId,
x.WorkPostId,
WorkPostName = WorkPostService.getWorkPostNamesWorkPostIds(db, x.WorkPostId),
x.Major,
x.PostTitleId,
PostTitleName = PostTitleService.getPostTitleNameById(db, x.PostTitleId),
x.IsOffice,
x.RoleIds,
RoleName = RoleService.getRoleNamesRoleIds(db, x.RoleIds),
x.CurrentProjectId,
LastProjectName = getCurrentProjectName(db, x.PersonId),
x.CurrentProjectWorkPostId,
LastWorkPostName = getCurrentProjectWorkPostName(db, x.PersonId),
IsPost = x.IsPost ?? true,
IsPostName = x.IsPost == false ? "否" : "是",
x.SignatureUrl,
x.CertificateId,
};
}
#endregion