182 lines
7.0 KiB
C#
182 lines
7.0 KiB
C#
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
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
/// 根据方案审查Id删除一个方案审查信息
|
|
/// </summary>
|
|
/// <param name="constructSolutionCode">方案审查Id</param>
|
|
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();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加方案审查信息
|
|
/// </summary>
|
|
/// <param name="constructSolution">方案审查实体</param>
|
|
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();
|
|
}
|
|
/// <summary>
|
|
/// 修改方案审查信息
|
|
/// </summary>
|
|
/// <param name="constructSolution">方案审查实体</param>
|
|
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();
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
///
|
|
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 "";
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据方案审查Id获取一个方案审查信息
|
|
/// </summary>
|
|
/// <param name="constructSolutionCode">方案审查Id</param>
|
|
/// <returns>一个方案审查实体</returns>
|
|
public static Model.Solution_CQMSConstructSolution_Final GetConstructSolutionByConstructSolutionId(string constructSolutionId)
|
|
{
|
|
return Funs.DB.Solution_CQMSConstructSolution_Final.FirstOrDefault(x => x.ConstructSolutionId == constructSolutionId);
|
|
}
|
|
/// <summary>
|
|
/// 获取方案类别
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
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;
|
|
}
|
|
}
|
|
}
|