201 lines
7.2 KiB
C#
201 lines
7.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.UI.WebControls;
|
|
|
|
namespace BLL
|
|
{
|
|
public class CQMS_SubPlanService
|
|
{
|
|
public static string IsAgree(Object type, Object res)
|
|
{
|
|
string result = string.Empty;
|
|
if (type.ToString().Equals(Const.SubPlan_ReCompile) || type.ToString().Equals(Const.SubPlan_Compile))
|
|
{
|
|
res = null;
|
|
}
|
|
if (res != null)
|
|
{
|
|
if (Convert.ToBoolean(res))
|
|
{
|
|
result = "是";
|
|
}
|
|
else
|
|
{
|
|
result = "否";
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据分包施工质量计划Id删除一个分包施工质量计划信息
|
|
/// </summary>
|
|
/// <param name="SubPlanId">分包施工质量计划Id</param>
|
|
public static void DeleteSubPlan(string SubPlanId)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Plan_SubPlan SubPlan = db.Plan_SubPlan.First(e => e.SubPlanId == SubPlanId);
|
|
|
|
db.Plan_SubPlan.DeleteOnSubmit(SubPlan);
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 增加分包施工质量计划信息
|
|
/// </summary>
|
|
/// <param name="SubPlan">分包施工质量计划实体</param>
|
|
public static void AddSubPlan(Model.Plan_SubPlan SubPlan)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Plan_SubPlan newSubPlan = new Model.Plan_SubPlan();
|
|
newSubPlan.SubPlanId = SubPlan.SubPlanId;
|
|
newSubPlan.Code = SubPlan.Code;
|
|
newSubPlan.ProjectId = SubPlan.ProjectId;
|
|
newSubPlan.UnitId = SubPlan.UnitId;
|
|
newSubPlan.PlanName = SubPlan.PlanName;
|
|
newSubPlan.UnitWorkIds = SubPlan.UnitWorkIds;
|
|
newSubPlan.CNProfessionalCodes = SubPlan.CNProfessionalCodes;
|
|
newSubPlan.CompileMan = SubPlan.CompileMan;
|
|
newSubPlan.CompileDate = SubPlan.CompileDate;
|
|
newSubPlan.State = SubPlan.State;
|
|
newSubPlan.Edition = SubPlan.Edition;
|
|
db.Plan_SubPlan.InsertOnSubmit(newSubPlan);
|
|
db.SubmitChanges();
|
|
}
|
|
/// <summary>
|
|
/// 修改分包施工质量计划信息
|
|
/// </summary>
|
|
/// <param name="SubPlan">分包施工质量计划实体</param>
|
|
public static void UpdateSubPlan(Model.Plan_SubPlan SubPlan)
|
|
{
|
|
Model.SGGLDB db = Funs.DB;
|
|
Model.Plan_SubPlan newSubPlan = db.Plan_SubPlan.First(e => e.SubPlanId == SubPlan.SubPlanId);
|
|
newSubPlan.Code = SubPlan.Code;
|
|
newSubPlan.UnitId = SubPlan.UnitId;
|
|
newSubPlan.PlanName = SubPlan.PlanName;
|
|
newSubPlan.UnitWorkIds = SubPlan.UnitWorkIds;
|
|
newSubPlan.CNProfessionalCodes = SubPlan.CNProfessionalCodes;
|
|
newSubPlan.State = SubPlan.State;
|
|
newSubPlan.Edition = SubPlan.Edition;
|
|
db.SubmitChanges();
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public static string ConvertState(object state)
|
|
{
|
|
if (state != null)
|
|
{
|
|
if (state.ToString() == BLL.Const.SubPlan_ReCompile)
|
|
{
|
|
return "重报";
|
|
}
|
|
else if (state.ToString() == BLL.Const.SubPlan_Compile)
|
|
{
|
|
return "编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.SubPlan_Audit)
|
|
{
|
|
return "会签";
|
|
}
|
|
else if (state.ToString() == BLL.Const.SubPlan_Complete)
|
|
{
|
|
return "审批完成";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// 根据分包施工质量计划Id获取一个分包施工质量计划信息
|
|
/// </summary>
|
|
/// <param name="SubPlanCode">分包施工质量计划Id</param>
|
|
/// <returns>一个分包施工质量计划实体</returns>
|
|
public static Model.Plan_SubPlan GetSubPlanBySubPlanId(string SubPlanId)
|
|
{
|
|
return Funs.DB.Plan_SubPlan.FirstOrDefault(x => x.SubPlanId == SubPlanId);
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
/// <summary>
|
|
/// /设置角色树
|
|
/// </summary>
|
|
/// <param name="trOne"></param>
|
|
/// <param name="projectId"></param>
|
|
/// <param name="nodeName"></param>
|
|
/// <param name="unitType"></param>
|
|
/// <param name="roleIds"></param>
|
|
public static void setRoleTree(FineUIPro.Tree trOne, string projectId, string nodeName, string unitType, string roleIds)
|
|
{
|
|
FineUIPro.TreeNode rootNode = new FineUIPro.TreeNode
|
|
{
|
|
Text = nodeName,
|
|
NodeID = "0",
|
|
Expanded = true,
|
|
EnableCheckEvent = true
|
|
};
|
|
trOne.Nodes.Add(rootNode);
|
|
trOne.EnableCheckBox = true;
|
|
var userList = SitePerson_PersonService.GetSitePerson_PersonListByProjectIdUnitTypeRoleIds(projectId, unitType, roleIds);
|
|
foreach (var u in userList)
|
|
{
|
|
FineUIPro.TreeNode roleNode = new FineUIPro.TreeNode
|
|
{
|
|
Text = u.PersonName,
|
|
NodeID = u.PersonId,
|
|
};
|
|
rootNode.Nodes.Add(roleNode);
|
|
}
|
|
}
|
|
}
|
|
}
|