CNCEC_SUBQHSE_WUHUAN/SGGL/BLL/ZHGL/RealName/OnPostService.cs

114 lines
4.1 KiB
C#

using FineUIPro;
using System;
using System.Collections;
using System.Linq;
namespace BLL
{
public static class OnPostService
{
public static Model.SGGLDB db = Funs.DB;
#region
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.SitePerson_Person> getDataLists = from x in db.SitePerson_Person
where x.IsUsed == true
select x;
/// <summary>
///
/// </summary>
/// <param name="projectId"></param>
/// <param name="personName"></param>
/// <param name="identityCard"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getListData(string projectId, string personName, string identityCard, string rblStates, string rbInfo, string rbIDCardNo, string rbRealName,
Grid Grid1)
{
IQueryable<Model.SitePerson_Person> getDataList = getDataLists;
if (projectId != Const._Null && !string.IsNullOrEmpty(projectId))
{
getDataList = getDataList.Where(x => x.ProjectId == projectId);
}
if (!string.IsNullOrEmpty(personName))
{
getDataList = getDataList.Where(x => x.PersonName.Contains(personName));
}
if (!string.IsNullOrEmpty(identityCard))
{
getDataList = getDataList.Where(x => x.IdentityCard.Contains(identityCard));
}
if (rblStates == "1")
{
getDataList = getDataList.Where(x => !x.OutTime.HasValue);
}
if (rblStates == "0")
{
getDataList = getDataList.Where(x => x.OutTime.HasValue);
}
if (rbInfo == "1")
{
getDataList = getDataList.Where(x => x.HeadImage != null && x.IsCardNoOK ==true);
}
if (rbInfo == "0")
{
getDataList = getDataList.Where(x => x.HeadImage == null || x.IsCardNoOK ==false);
}
if (rbInfo == "1")
{
getDataList = getDataList.Where(x => x.IsCardNoOK == true);
}
if (rbInfo == "0")
{
getDataList = getDataList.Where(x =>x.IsCardNoOK == false);
}
if (rbRealName == "1")
{
getDataList = getDataList.Where(x => x.RealNameAddTime.HasValue);
}
if (rbRealName == "0")
{
getDataList = getDataList.Where(x => !x.RealNameAddTime.HasValue);
}
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.IdentityCard,
x.PersonName,
x.ProjectId,
//db.Base_Project.First(y => x.ProjectId == y.ProjectId).ShortName,
SexName = x.Sex == "1" ? "男" : "女",
x.InTime,
x.OutTime,
x.Birthday,
x.CountryCode,
x.ProvinceCode,
db.ProjectData_TeamGroup.First(z => x.TeamGroupId == z.TeamGroupId).TeamGroupName,
db.Base_WorkPost.First(z => x.WorkPostId == z.WorkPostId).WorkPostName,
IsPostName = x.OutTime.HasValue ? "是" : "否",
};
}
#endregion
}
}