using FineUIPro;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace BLL
{
public class ProjectPersonStarService
{
public static Model.SGGLDB db = Funs.DB;
#region 劳务人员列表
///
/// 记录数
///
public static int count
{
get;
set;
}
///
/// 定义变量
///
private static IQueryable getDataLists = from x in Funs.DB.View_SitePerson_Person
select x;
///
/// 数据列表
///
///
///
///
///
///
///
///
///
public static IEnumerable getListData(string projetcId, string unitId, string name, string idCard, string states, Grid Grid1)
{
IQueryable getDataList = getDataLists;
if (!string.IsNullOrEmpty(projetcId) && projetcId != Const._Null)
{
getDataList = getDataList.Where(e => e.ProjectId == projetcId);
}
if (!string.IsNullOrEmpty(unitId) && unitId != Const._Null)
{
getDataList = getDataList.Where(e => e.UnitId == unitId);
}
if (!string.IsNullOrEmpty(states) && states != "-2")
{
if (states == "1")
{
getDataList = getDataList.Where(e => e.IsUsed == true);
}
else {
getDataList = getDataList.Where(e => e.IsUsed == false);
}
}
if (!string.IsNullOrEmpty(name))
{
getDataList = getDataList.Where(e => e.PersonName.Contains(name));
}
if (!string.IsNullOrEmpty(idCard))
{
getDataList = getDataList.Where(e => e.IdentityCard.Contains(idCard));
}
count = getDataList.Count();
if (count == 0)
{
return null;
}
getDataList = SortConditionHelper.SortingAndPaging(getDataList.OrderBy(x => x.UnitId), Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize);
return from x in getDataList
select new
{
//ProjectPersonId = x.SitePersonId + "#" + x.PersonId,
ProjectPersonId =x.PersonId,
x.PersonName,
x.CardNo,
x.IdentityCard,
x.Sex,
x.SexName,
x.UnitId,
x.UnitName,
x.WorkPostId,
x.WorkPostName,
x.ProjectId,
ProjectName = db.Base_Project.First(u => u.ProjectId == x.ProjectId).ShortName,
x.TeamGroupId,
x.TeamGroupName,
x.InTime,
x.OutTime,
x.States,
OutName = (x.States == "2" ? "是" : "否"),
x.StarMark,
x.StarLevelId,
x.LevelValue,
};
}
#endregion
}
}