221 lines
8.4 KiB
C#
221 lines
8.4 KiB
C#
using Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
public class CostReportService
|
|
{
|
|
public static string IsAgree(Object type, Object res)
|
|
{
|
|
string result = string.Empty;
|
|
if (type.ToString().Equals(Const.CostReport_Compile) || type.ToString().Equals(Const.CostReport_ReCompile))
|
|
{
|
|
res = null;
|
|
}
|
|
if (res != null)
|
|
{
|
|
if (Convert.ToBoolean(res))
|
|
{
|
|
result = "是";
|
|
}
|
|
else
|
|
{
|
|
result = "否";
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据工程签证费用报审表Id删除一个工程签证费用报审表信息
|
|
/// </summary>
|
|
/// <param name="costReportCode">工程签证费用报审表Id</param>
|
|
public static void DeleteCostReport(string costReportId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_CostReport costReport = db.CQMS_CostReport.First(e => e.CostReportId == costReportId);
|
|
|
|
db.CQMS_CostReport.DeleteOnSubmit(costReport);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加工程签证费用报审表信息
|
|
/// </summary>
|
|
/// <param name="costReport">工程签证费用报审表实体</param>
|
|
public static void AddCostReport(Model.CQMS_CostReport costReport)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_CostReport newCostReport = new Model.CQMS_CostReport();
|
|
newCostReport.CostReportId = costReport.CostReportId;
|
|
newCostReport.ProjectId = costReport.ProjectId;
|
|
newCostReport.SecretLevelId = costReport.SecretLevelId;
|
|
newCostReport.CostReportCode = costReport.CostReportCode;
|
|
newCostReport.Edition = costReport.Edition;
|
|
newCostReport.UnitId = costReport.UnitId;
|
|
newCostReport.ContractContent = costReport.ContractContent;
|
|
newCostReport.ContractNo = costReport.ContractNo;
|
|
newCostReport.ConfirmFormIds = costReport.ConfirmFormIds;
|
|
newCostReport.PlanCost = costReport.PlanCost;
|
|
newCostReport.AuditCost = costReport.AuditCost;
|
|
newCostReport.RealCost = costReport.RealCost;
|
|
newCostReport.CompileMan = costReport.CompileMan;
|
|
newCostReport.CompileDate = costReport.CompileDate;
|
|
newCostReport.State = costReport.State;
|
|
|
|
db.CQMS_CostReport.InsertOnSubmit(newCostReport);
|
|
db.SubmitChanges();
|
|
}
|
|
/// <summary>
|
|
/// 修改工程签证费用报审表信息
|
|
/// </summary>
|
|
/// <param name="costReport">工程签证费用报审表实体</param>
|
|
public static void UpdateCostReport(Model.CQMS_CostReport costReport)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.CQMS_CostReport newCostReport = db.CQMS_CostReport.First(e => e.CostReportId == costReport.CostReportId);
|
|
newCostReport.SecretLevelId = costReport.SecretLevelId;
|
|
newCostReport.CostReportCode = costReport.CostReportCode;
|
|
newCostReport.Edition = costReport.Edition;
|
|
newCostReport.UnitId = costReport.UnitId;
|
|
newCostReport.ContractContent = costReport.ContractContent;
|
|
newCostReport.ContractNo = costReport.ContractNo;
|
|
newCostReport.ConfirmFormIds = costReport.ConfirmFormIds;
|
|
newCostReport.PlanCost = costReport.PlanCost;
|
|
newCostReport.AuditCost = costReport.AuditCost;
|
|
newCostReport.RealCost = costReport.RealCost;
|
|
newCostReport.State = costReport.State;
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public static string ConvertState(object state)
|
|
{
|
|
if (state != null)
|
|
{
|
|
if (state.ToString() == BLL.Const.CostReport_ReCompile)
|
|
{
|
|
return "重报";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CostReport_Compile)
|
|
{
|
|
return "编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CostReport_Audit1)
|
|
{
|
|
return "分包项目经理审核";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CostReport_Audit2)
|
|
{
|
|
return "费控工程师审核";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CostReport_Audit3)
|
|
{
|
|
return "控制经理审核";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CostReport_Audit4)
|
|
{
|
|
return "项目经理审核";
|
|
}
|
|
else if (state.ToString() == BLL.Const.CostReport_Complete)
|
|
{
|
|
return "审批完成";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据工程签证费用报审表Id获取一个工程签证费用报审表信息
|
|
/// </summary>
|
|
/// <param name="costReportCode">工程签证费用报审表Id</param>
|
|
/// <returns>一个工程签证费用报审表实体</returns>
|
|
public static Model.CQMS_CostReport GetCostReportByCostReportId(string costReportId)
|
|
{
|
|
return Funs.DB.CQMS_CostReport.FirstOrDefault(x => x.CostReportId == costReportId);
|
|
}
|
|
|
|
public static void Init(FineUIPro.DropDownList dropName, string state, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "Value";
|
|
dropName.DataTextField = "Text";
|
|
dropName.DataSource = GetDHandleTypeByState(state);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据状态选择下一步办理类型
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
public static ListItem[] GetDHandleTypeByState(string state)
|
|
{
|
|
if (state == Const.CostReport_Compile || state == Const.CostReport_ReCompile) //无是否同意
|
|
{
|
|
ListItem[] lis = new ListItem[1];
|
|
lis[0] = new ListItem("分包项目经理审核", Const.CostReport_Audit1);
|
|
return lis;
|
|
}
|
|
else if (state == Const.CostReport_Audit1)//有是否同意
|
|
{
|
|
ListItem[] lis = new ListItem[2];
|
|
lis[0] = new ListItem("费控工程师审核", Const.CostReport_Audit2);//是 加载
|
|
lis[1] = new ListItem("重新编制", Const.CostReport_ReCompile);//是 加载
|
|
return lis;
|
|
}
|
|
else
|
|
return null;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据项目id获取工程签证费用报审表下拉框
|
|
/// </summary>
|
|
/// <param name="dropName">下拉框名字</param>
|
|
/// <param name="isShowPlease">是否显示请选择</param>
|
|
public static void InitCostReportList(FineUIPro.DropDownList dropName, string projectId, bool isShowPlease)
|
|
{
|
|
dropName.DataValueField = "CostReportId";
|
|
dropName.DataTextField = "CostReportCode";
|
|
dropName.DataSource = GetCostReportList(projectId);
|
|
dropName.DataBind();
|
|
if (isShowPlease)
|
|
{
|
|
Funs.FineUIPleaseSelect(dropName);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据项目Id获取单位名称下拉选择项
|
|
/// </summary>
|
|
/// <param name="projectId"></param>
|
|
/// <returns></returns>
|
|
public static List<Model.CQMS_CostReport> GetCostReportList(string projectId)
|
|
{
|
|
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
|
{
|
|
var q = (from x in db.CQMS_CostReport
|
|
where x.ProjectId == projectId && x.State == BLL.Const.CostReport_Complete
|
|
orderby x.CostReportCode
|
|
select x).ToList();
|
|
return q;
|
|
}
|
|
}
|
|
}
|
|
}
|