using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web.UI.WebControls; namespace BLL { public class CQMSConstructSolutionFinalService { /// /// 根据方案审查Id删除一个方案审查信息 /// /// 方案审查Id public static void DeleteConstructSolution(string constructSolutionId) { Model.SGGLDB db = Funs.DB; Model.Solution_CQMSConstructSolution_Final constructSolution = db.Solution_CQMSConstructSolution_Final.First(e => e.ConstructSolutionId == constructSolutionId); db.Solution_CQMSConstructSolution_Final.DeleteOnSubmit(constructSolution); db.SubmitChanges(); } /// /// 增加方案审查信息 /// /// 方案审查实体 public static void AddConstructSolution(Model.Solution_CQMSConstructSolution_Final constructSolution) { Model.SGGLDB db = Funs.DB; Model.Solution_CQMSConstructSolution_Final newConstructSolution = new Model.Solution_CQMSConstructSolution_Final(); newConstructSolution.ConstructSolutionId = constructSolution.ConstructSolutionId; newConstructSolution.ProjectId = constructSolution.ProjectId; newConstructSolution.UnitId = constructSolution.UnitId; newConstructSolution.SolutionName = constructSolution.SolutionName; newConstructSolution.SolutionCode = constructSolution.SolutionCode; newConstructSolution.CompileMan = constructSolution.CompileMan; newConstructSolution.State = constructSolution.State; newConstructSolution.AuditDate = constructSolution.AuditDate; db.Solution_CQMSConstructSolution_Final.InsertOnSubmit(newConstructSolution); db.SubmitChanges(); } /// /// 修改方案审查信息 /// /// 方案审查实体 public static void UpdateConstructSolution(Model.Solution_CQMSConstructSolution_Final constructSolution) { Model.SGGLDB db = Funs.DB; Model.Solution_CQMSConstructSolution_Final newConstructSolution = db.Solution_CQMSConstructSolution_Final.FirstOrDefault(e => e.ConstructSolutionId == constructSolution.ConstructSolutionId); if (newConstructSolution == null) { AddConstructSolution(constructSolution); } else { newConstructSolution.AuditDate = constructSolution.AuditDate; newConstructSolution.UnitId = constructSolution.UnitId; newConstructSolution.SolutionName = constructSolution.SolutionName; newConstructSolution.SolutionCode= constructSolution.SolutionCode; newConstructSolution.CompileMan = constructSolution.CompileMan; newConstructSolution.State = constructSolution.State; db.SubmitChanges(); } } /// /// 把状态转换代号为文字形式 /// /// /// /// public static string ConvertState(object state) { if (state != null) { if (state.ToString() == BLL.Const.CQMSConstructSolution_ReCompile) { return "重报"; } else if (state.ToString() == BLL.Const.CQMSConstructSolution_Compile) { return "编制"; } else if (state.ToString() == BLL.Const.CQMSConstructSolution_Audit) { return "会签"; } else if (state.ToString() == BLL.Const.CQMSConstructSolution_Complete) { return "审批完成"; } } return ""; } /// /// 根据方案审查Id获取一个方案审查信息 /// /// 方案审查Id /// 一个方案审查实体 public static Model.Solution_CQMSConstructSolution_Final GetConstructSolutionByConstructSolutionId(string constructSolutionId) { return Funs.DB.Solution_CQMSConstructSolution_Final.FirstOrDefault(x => x.ConstructSolutionId == constructSolutionId); } /// /// 获取方案类别 /// /// /// public static string ConvertSolutionType(object solutionType) { if (solutionType != null) { if (solutionType.ToString() == "1") { return "施工组织设计"; } else if (solutionType.ToString() == "2") { return "专项施工方案"; } else if (solutionType.ToString() == "3") { return "施工方案"; } } return ""; } public static string GetProfessionalName(string cNProfessionalCodes) { string professionalName = string.Empty; if (!string.IsNullOrEmpty(cNProfessionalCodes)) { string[] strs = cNProfessionalCodes.Split(','); foreach (var item in strs) { var cn = BLL.CNProfessionalService.GetCNProfessional(item); if (cn != null) { professionalName += cn.ProfessionalName + ","; } } if (!string.IsNullOrEmpty(professionalName)) { professionalName = professionalName.Substring(0, professionalName.LastIndexOf(",")); } } return professionalName; } public static string GetUnitWorkName(string unitWorkIds) { string unitWorkName = string.Empty; if (!string.IsNullOrEmpty(unitWorkIds)) { string[] strs = unitWorkIds.Split(','); foreach (var item in strs) { var un = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(item); if (un != null) { unitWorkName += un.UnitWorkName + BLL.UnitWorkService.GetProjectType(un.ProjectType) + ","; } } if (!string.IsNullOrEmpty(unitWorkName)) { unitWorkName = unitWorkName.Substring(0, unitWorkName.LastIndexOf(",")); } } return unitWorkName; } } }