SGGL_SHJ/SGGL/BLL/DigData/WBSAnalysisService.cs

99 lines
3.2 KiB
C#

using FineUIPro;
using NPOI.SS.Formula.Functions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
/// <summary>
/// WBS分析
/// </summary>
public static class WBSAnalysisService
{
public static Model.SGGLDB db = Funs.DB;
#region WBS分析
/// <summary>
/// 记录数
/// </summary>
public static int count
{
get;
set;
}
/// <summary>
/// 定义变量
/// </summary>
private static IQueryable<Model.WBS_WorkPackageInit> getDataLists = from x in db.WBS_WorkPackageInit
select x;
/// <summary>
/// 合同管理数据仓库
/// </summary>
/// <param name="projectId"></param>
/// <param name="startTime"></param>
/// <param name="endTime"></param>
/// <param name="Grid1"></param>
/// <returns></returns>
public static IEnumerable getDataDWList(string workPackageId, Grid Grid1)
{
var getDataList = getDataLists;
if (string.IsNullOrEmpty(workPackageId) )
{
List<Model.WBS_WorkPackageInit> listWork = new List<Model.WBS_WorkPackageInit>();
Model.WBS_WorkPackageInit work1 = new Model.WBS_WorkPackageInit
{
WorkPackageCode = "1",
PackageContent = "建筑工程",
};
listWork.Add(work1);
Model.WBS_WorkPackageInit work2 = new Model.WBS_WorkPackageInit
{
WorkPackageCode = "2",
PackageContent = "安装工程",
};
listWork.Add(work2);
getDataList = listWork.AsQueryable();
}
else
{
if (workPackageId != "1" && workPackageId != "2")
{
getDataList = getDataList.Where(x => x.SuperWorkPack == workPackageId);
if (getDataList.Count() == 0)
{
getDataList = getDataLists.Where(x => x.WorkPackageCode == workPackageId);
}
}
else
{
getDataList = getDataList.Where(x => x.ProjectType == workPackageId && x.SuperWorkPack == 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.WorkPackageCode,
x.PackageContent,
Count1=0,
Count2 = 0,
Count3 = 0,
Count4 = 0,
Count5 = 0,
Count6 = 0,
};
}
#endregion
}
}