using FineUIPro; using System; using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; namespace BLL { public class ProjectConstructionLogService { public static Model.SGGLDB db = Funs.DB; #region 获取人员列表信息 /// /// 记录数 /// public static int count { get; set; } /// /// 定义变量 /// private static IQueryable getDataLists = from x in db.InformationProject_ConstructionLog select x; /// /// 数据列表 /// /// /// /// /// /// public static IEnumerable getListData(string projetcId, string unitId, DateTime? startTime, DateTime? endTime, 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 (startTime.HasValue) { getDataList = getDataList.Where(e => e.WorkDate >= startTime); } if (endTime.HasValue) { getDataList = getDataList.Where(e => e.WorkDate <= endTime); } count = getDataList.Count(); if (count == 0) { return null; } var getData = from x in getDataList select new { x.ProjectId, x.UnitId, x.WorkDate }; return from x in SortConditionHelper.SortingAndPaging(getData.Distinct(), Grid1.SortField, Grid1.SortDirection, Grid1.PageIndex, Grid1.PageSize) select new { ID = (x.UnitId ?? x.ProjectId + "|" + Convert.ToString(x.WorkDate ?? DateTime.Now)), x.ProjectId, ProjectName = ProjectService.GetProjectNameByProjectId(x.ProjectId), x.UnitId, UnitName = UnitService.GetUnitNameByUnitId(x.UnitId), x.WorkDate, }; } #endregion } }