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; } /// /// 根据工程签证费用报审表Id删除一个工程签证费用报审表信息 /// /// 工程签证费用报审表Id 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(); } /// /// 增加工程签证费用报审表信息 /// /// 工程签证费用报审表实体 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(); } /// /// 修改工程签证费用报审表信息 /// /// 工程签证费用报审表实体 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(); } /// /// 把状态转换代号为文字形式 /// /// /// /// 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 ""; } /// /// 根据工程签证费用报审表Id获取一个工程签证费用报审表信息 /// /// 工程签证费用报审表Id /// 一个工程签证费用报审表实体 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); } } /// /// 根据状态选择下一步办理类型 /// /// /// 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; } /// /// 根据项目id获取工程签证费用报审表下拉框 /// /// 下拉框名字 /// 是否显示请选择 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); } } /// /// 根据项目Id获取单位名称下拉选择项 /// /// /// public static List 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; } } } }