180 lines
7.5 KiB
C#
180 lines
7.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 实施计划
|
|
/// </summary>
|
|
public static class ActionPlanListService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取实施计划
|
|
/// </summary>
|
|
/// <param name="actionPlanListId"></param>
|
|
/// <returns></returns>
|
|
public static Model.ActionPlan_ActionPlanList GetActionPlanListById(string actionPlanListId)
|
|
{
|
|
return Funs.DB.ActionPlan_ActionPlanList.FirstOrDefault(e => e.ActionPlanListId == actionPlanListId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据日期获取实施计划集合
|
|
/// </summary>
|
|
/// <param name="startTime">开始时间</param>
|
|
/// <param name="endTime">结束时间</param>
|
|
/// <param name="projectId">项目号</param>
|
|
/// <returns>实施计划集合</returns>
|
|
public static List<Model.ActionPlan_ActionPlanList> GetActionPlanListsByDate(DateTime startTime, DateTime endTime, string projectId)
|
|
{
|
|
return (from x in Funs.DB.ActionPlan_ActionPlanList where x.CompileDate >= startTime && x.CompileDate <= endTime && x.ProjectId == projectId orderby x.CompileDate select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加实施计划
|
|
/// </summary>
|
|
/// <param name="actionPlanList"></param>
|
|
public static void AddActionPlanList(Model.ActionPlan_ActionPlanList actionPlanList)
|
|
{
|
|
Model.ActionPlan_ActionPlanList newActionPlanList = new Model.ActionPlan_ActionPlanList
|
|
{
|
|
ActionPlanListId = actionPlanList.ActionPlanListId,
|
|
ProjectId = actionPlanList.ProjectId,
|
|
ActionPlanListCode = actionPlanList.ActionPlanListCode,
|
|
ActionPlanListName = actionPlanList.ActionPlanListName,
|
|
VersionNo = actionPlanList.VersionNo,
|
|
ProjectType = actionPlanList.ProjectType,
|
|
Edition = actionPlanList.Edition,
|
|
IsReview = actionPlanList.IsReview,
|
|
ReviewMan = actionPlanList.ReviewMan,
|
|
IsCompanyReview = actionPlanList.IsCompanyReview,
|
|
ActionPlanListContents = actionPlanList.ActionPlanListContents,
|
|
CompileMan = actionPlanList.CompileMan,
|
|
CompileDate = actionPlanList.CompileDate,
|
|
States = actionPlanList.States
|
|
};
|
|
Funs.DB.ActionPlan_ActionPlanList.InsertOnSubmit(newActionPlanList);
|
|
Funs.DB.SubmitChanges();
|
|
|
|
////增加一条编码记录
|
|
BLL.CodeRecordsService.InsertCodeRecordsByMenuIdProjectIdUnitId(BLL.Const.ProjectActionPlanListMenuId, newActionPlanList.ProjectId, null, newActionPlanList.ActionPlanListId, newActionPlanList.CompileDate);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改实施计划
|
|
/// </summary>
|
|
/// <param name="actionPlanList"></param>
|
|
public static void UpdateActionPlanList(Model.ActionPlan_ActionPlanList actionPlanList)
|
|
{
|
|
Model.ActionPlan_ActionPlanList newActionPlanList = Funs.DB.ActionPlan_ActionPlanList.FirstOrDefault(e => e.ActionPlanListId == actionPlanList.ActionPlanListId);
|
|
if (newActionPlanList != null)
|
|
{
|
|
//newActionPlanList.ProjectId = actionPlanList.ProjectId;
|
|
newActionPlanList.ActionPlanListCode = actionPlanList.ActionPlanListCode;
|
|
newActionPlanList.ActionPlanListName = actionPlanList.ActionPlanListName;
|
|
newActionPlanList.VersionNo = actionPlanList.VersionNo;
|
|
newActionPlanList.ProjectType = actionPlanList.ProjectType;
|
|
newActionPlanList.Edition = actionPlanList.Edition;
|
|
newActionPlanList.IsReview = actionPlanList.IsReview;
|
|
newActionPlanList.ReviewMan = actionPlanList.ReviewMan;
|
|
newActionPlanList.IsCompanyReview = actionPlanList.IsCompanyReview;
|
|
newActionPlanList.ActionPlanListContents = actionPlanList.ActionPlanListContents;
|
|
newActionPlanList.CompileMan = actionPlanList.CompileMan;
|
|
newActionPlanList.CompileDate = actionPlanList.CompileDate;
|
|
newActionPlanList.States = actionPlanList.States;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除实施计划
|
|
/// </summary>
|
|
/// <param name="actionPlanListId"></param>
|
|
public static void DeleteActionPlanListById(string actionPlanListId)
|
|
{
|
|
Model.ActionPlan_ActionPlanList actionPlanList = Funs.DB.ActionPlan_ActionPlanList.FirstOrDefault(e => e.ActionPlanListId == actionPlanListId);
|
|
if (actionPlanList != null)
|
|
{
|
|
BLL.ActionPlanListApproveService.DeleteActionPlanListApprovesByActionPlanListId(actionPlanListId);
|
|
////删除审核流程表
|
|
BLL.CommonService.DeleteFlowOperateByID(actionPlanList.ActionPlanListId);
|
|
///删除附件
|
|
BLL.CommonService.DeleteAttachFileById(actionPlanListId);
|
|
////删除编码表记录
|
|
BLL.CodeRecordsService.DeleteCodeRecordsByDataId(actionPlanList.ActionPlanListId);
|
|
Funs.DB.ActionPlan_ActionPlanList.DeleteOnSubmit(actionPlanList);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 把状态转换代号为文字形式
|
|
/// </summary>
|
|
/// <param name="state"></param>
|
|
/// <returns></returns>
|
|
///
|
|
public static string ConvertState(object state)
|
|
{
|
|
if (state != null)
|
|
{
|
|
if (state.ToString() == BLL.Const.ActionPlanList_ReCompile)
|
|
{
|
|
return "重报";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ActionPlanList_Compile)
|
|
{
|
|
return "编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ActionPlanList_Audit)
|
|
{
|
|
return "会签";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ActionPlanList_Review)
|
|
{
|
|
return "评审负责人办理";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ActionPlanList_Reviewing)
|
|
{
|
|
return "施工管理部评审";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ActionPlanList_Review2)
|
|
{
|
|
return "评审负责人办理";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ActionPlanList_DepartReview)
|
|
{
|
|
return "公司部门评审";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ActionPlanList_Complete)
|
|
{
|
|
return "审批完成";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public static string IsAgree(Object type, Object res)
|
|
{
|
|
string result = string.Empty;
|
|
if (type.ToString().Equals(Const.ActionPlanList_ReCompile) || type.ToString().Equals(Const.ActionPlanList_Compile))
|
|
{
|
|
res = null;
|
|
}
|
|
if (res != null)
|
|
{
|
|
if (Convert.ToBoolean(res))
|
|
{
|
|
result = "是";
|
|
}
|
|
else
|
|
{
|
|
result = "否";
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|