This commit is contained in:
2026-06-10 12:32:12 +08:00
parent ac6777e5f4
commit 403833e4b6
4 changed files with 165 additions and 58 deletions
+89 -58
View File
@@ -38,64 +38,67 @@ namespace BLL
/// <returns></returns>
public static IEnumerable getListData(string workPostId, string postTitleId, string name, string certificateId, Grid Grid1)
{
IQueryable<Model.Person_Persons> getDataList = from x in Funs.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)
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
getDataList = getDataList.Where(e => e.WorkPostId == workPostId);
}
if (!string.IsNullOrEmpty(postTitleId) && postTitleId != Const._Null)
{
getDataList = getDataList.Where(e => e.PostTitleId == postTitleId);
}
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));
}
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;
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 = 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(x.WorkPostId),
x.Major,
x.PostTitleId,
PostTitleName = PostTitleService.getPostTitleNameById(x.PostTitleId),
x.IsOffice,
x.RoleIds,
RoleName = RoleService.getRoleNamesRoleIds(x.RoleIds),
x.CurrentProjectId,
LastProjectName = getCurrentProjectName(x.PersonId),
x.CurrentProjectWorkPostId,
LastWorkPostName = getCurrentProjectWorkPostName(x.PersonId),
IsPost = x.IsPost ?? true,
IsPostName = x.IsPost == false ? "否" : "是",
x.SignatureUrl,
x.CertificateId,
};
}
#endregion
@@ -125,18 +128,46 @@ namespace BLL
/// <summary>
///
/// </summary>
/// <param name="WorkPostId"></param>
/// <param name="ProjectId"></param>
/// <param name="PersonId"></param>
/// <returns></returns>
public static string getCurrentProjectWorkPostName(string PersonId)
public static string getCurrentProjectName(Model.SGGLDB db, string PersonId)
{
var getItem = (from x in Funs.DB.SitePerson_PersonItem
var getItem = (from x in db.SitePerson_PersonItem
where x.PersonId == PersonId
orderby x.InTime descending
select x).FirstOrDefault();
if (getItem != null)
{
return WorkPostService.getWorkPostNamesWorkPostIds(getItem.WorkPostId);
string name = string.Empty;
var project = db.Base_Project.FirstOrDefault(e => e.ProjectId == getItem.ProjectId);
if (project != null)
{
name = project.ShortName;
}
return name;
}
else
{
return null;
}
}
/// <summary>
///
/// </summary>
/// <param name="WorkPostId"></param>
/// <param name="PersonId"></param>
/// <returns></returns>
public static string getCurrentProjectWorkPostName(Model.SGGLDB db, string PersonId)
{
var getItem = (from x in db.SitePerson_PersonItem
where x.PersonId == PersonId
orderby x.InTime descending
select x).FirstOrDefault();
if (getItem != null)
{
return WorkPostService.getWorkPostNamesWorkPostIds(db, getItem.WorkPostId);
}
else
{