Basf_EProject/EProject/BLL/APIService/APIEpojectService.cs

100 lines
4.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
namespace BLL
{
public static class APIEpojectService
{
/// <summary>
/// 获取EProject信息列表
/// </summary>
/// <param name="jobNo">任务代码</param>
/// <param name="jobStatus">任务状态</param>
/// <param name="startCreateTime">创建日期起</param>
/// <param name="endCreateTime">创建日期止</param>
/// <param name="startUpdateTime">修改日期起</param>
/// <param name="endUpdateTime">修改日期止</param>
/// <returns>EProject信息列表</returns>
public static List<Model.EprojectInfo> GetEprojectList(string jobNo,string jobStatus,DateTime? startCreateTime, DateTime? endCreateTime, DateTime? startUpdateTime, DateTime? endUpdateTime)
{
var eproject = from x in Funs.DB.View_EprojectAPI select x;
if (!string.IsNullOrEmpty(jobNo))
{
eproject = eproject.Where(x => x.Job_no.Contains(jobNo));
}
if (!string.IsNullOrEmpty(jobStatus))
{
eproject = eproject.Where(x => x.Job_status==jobStatus);
}
if (startCreateTime != null)
{
eproject = eproject.Where(x => x.Create_time >= startCreateTime);
}
if (endCreateTime != null)
{
eproject = eproject.Where(x => x.Create_time <= endCreateTime);
}
if (startUpdateTime != null)
{
eproject = eproject.Where(x => x.Update_time >= startUpdateTime);
}
if (endUpdateTime != null)
{
eproject = eproject.Where(x => x.Update_time <= endUpdateTime);
}
var getEproject = (from x in eproject
select new Model.EprojectInfo
{
id=x.Id,
createBy = x.Create_by,
createTime = x.Create_time,
updateBy = x.Update_by,
updateTime = x.Update_time,
buCode = x.Bu_code,
jobNo = x.Job_no,
jobType = x.Job_type,
leadBy = x.Lead_by,
jobTitle = x.Job_title,
budget = x.Budget.HasValue ? x.Budget.Value.ToString() : "",
projectManager = x.Project_manager,
constructionManager = x.Construction_manager,
engineeringManager = x.Engineering_manager,
approvalDate = x.Approval_date,
mcPlaned = x.Mc_planed,
mcRevised = x.Mc_revised,
priority = x.Priority,
category = x.Category,
jobStatus = x.Job_status,
schedule = x.Schedule,
cost = x.Cost,
scope = x.Scope,
receivedDate = x.Received_date,
estimatedFianlCost = x.Estimated_fianl_cost != null ? x.Estimated_fianl_cost.ToString() : "",
mcActual = x.Mc_actual,
mcsigned = x.MC_Signed,
rfsu = x.Rfsu,
punchCkilled = x.Punch_c_killed,
fcSigned = x.Fc_signed,
businessClosed = x.Business_closed,
ifcReceived = x.Ifc_received,
asBuiltReceived = x.As_built_received,
mdReceived = x.Md_received,
dateRegisteration = x.Date_registeration,
costEffectivity = x.Cost_effectivity,
pvi = x.PVI.HasValue ? x.PVI.Value.ToString() : "",
cancelDate = x.Cancel_date,
accountNo = x.Account_no,
networkNo = x.Network_no,
studyWo = x.Study_wo,
cteInvolved = x.Cte_involved,
capexPlanNo = x.Capex_plan_no,
cdi = x.CDI
}).ToList();
return getEproject;
}
}
}