157 lines
6.2 KiB
C#
157 lines
6.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
namespace BLL
|
|
{
|
|
/// <summary>
|
|
/// 项目策划
|
|
/// </summary>
|
|
public static class ProjectPlanService
|
|
{
|
|
/// <summary>
|
|
/// 根据主键获取项目策划
|
|
/// </summary>
|
|
/// <param name="ProjectPlanId"></param>
|
|
/// <returns></returns>
|
|
public static Model.ActionPlan_ProjectPlan GetProjectPlanById(string ProjectPlanId)
|
|
{
|
|
return Funs.DB.ActionPlan_ProjectPlan.FirstOrDefault(e => e.ProjectPlanId == ProjectPlanId);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据日期获取项目策划集合
|
|
/// </summary>
|
|
/// <param name="startTime">开始时间</param>
|
|
/// <param name="endTime">结束时间</param>
|
|
/// <param name="projectId">项目号</param>
|
|
/// <returns>项目策划集合</returns>
|
|
public static List<Model.ActionPlan_ProjectPlan> GetProjectPlansByDate(DateTime startTime, DateTime endTime, string projectId)
|
|
{
|
|
return (from x in Funs.DB.ActionPlan_ProjectPlan where x.CompileDate >= startTime && x.CompileDate <= endTime && x.ProjectId == projectId orderby x.CompileDate select x).ToList();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 添加项目策划
|
|
/// </summary>
|
|
/// <param name="ProjectPlan"></param>
|
|
public static void AddProjectPlan(Model.ActionPlan_ProjectPlan ProjectPlan)
|
|
{
|
|
Model.ActionPlan_ProjectPlan newProjectPlan = new Model.ActionPlan_ProjectPlan
|
|
{
|
|
ProjectPlanId = ProjectPlan.ProjectPlanId,
|
|
ProjectId = ProjectPlan.ProjectId,
|
|
ProjectPlanCode = ProjectPlan.ProjectPlanCode,
|
|
ProjectPlanName = ProjectPlan.ProjectPlanName,
|
|
VersionNo = ProjectPlan.VersionNo,
|
|
ProjectType = ProjectPlan.ProjectType,
|
|
Edition = ProjectPlan.Edition,
|
|
IsReview = ProjectPlan.IsReview,
|
|
ReviewMan = ProjectPlan.ReviewMan,
|
|
IsCompanyReview = ProjectPlan.IsCompanyReview,
|
|
ProjectPlanContents = ProjectPlan.ProjectPlanContents,
|
|
CompileMan = ProjectPlan.CompileMan,
|
|
CompileDate = ProjectPlan.CompileDate,
|
|
States = ProjectPlan.States
|
|
};
|
|
Funs.DB.ActionPlan_ProjectPlan.InsertOnSubmit(newProjectPlan);
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改项目策划
|
|
/// </summary>
|
|
/// <param name="ProjectPlan"></param>
|
|
public static void UpdateProjectPlan(Model.ActionPlan_ProjectPlan ProjectPlan)
|
|
{
|
|
Model.ActionPlan_ProjectPlan newProjectPlan = Funs.DB.ActionPlan_ProjectPlan.FirstOrDefault(e => e.ProjectPlanId == ProjectPlan.ProjectPlanId);
|
|
if (newProjectPlan != null)
|
|
{
|
|
//newProjectPlan.ProjectId = ProjectPlan.ProjectId;
|
|
newProjectPlan.ProjectPlanCode = ProjectPlan.ProjectPlanCode;
|
|
newProjectPlan.ProjectPlanName = ProjectPlan.ProjectPlanName;
|
|
newProjectPlan.VersionNo = ProjectPlan.VersionNo;
|
|
newProjectPlan.ProjectType = ProjectPlan.ProjectType;
|
|
newProjectPlan.Edition = ProjectPlan.Edition;
|
|
newProjectPlan.IsReview = ProjectPlan.IsReview;
|
|
newProjectPlan.ReviewMan = ProjectPlan.ReviewMan;
|
|
newProjectPlan.IsCompanyReview = ProjectPlan.IsCompanyReview;
|
|
newProjectPlan.ProjectPlanContents = ProjectPlan.ProjectPlanContents;
|
|
newProjectPlan.CompileMan = ProjectPlan.CompileMan;
|
|
newProjectPlan.CompileDate = ProjectPlan.CompileDate;
|
|
newProjectPlan.States = ProjectPlan.States;
|
|
Funs.DB.SubmitChanges();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据主键删除项目策划
|
|
/// </summary>
|
|
/// <param name="ProjectPlanId"></param>
|
|
public static void DeleteProjectPlanById(string ProjectPlanId)
|
|
{
|
|
Model.ActionPlan_ProjectPlan ProjectPlan = Funs.DB.ActionPlan_ProjectPlan.FirstOrDefault(e => e.ProjectPlanId == ProjectPlanId);
|
|
if (ProjectPlan != null)
|
|
{
|
|
BLL.ProjectPlanOpinionService.DeleteProjectPlanOpinionsByProjectPlanId(ProjectPlanId);
|
|
BLL.ProjectPlanApproveService.DeleteProjectPlanApprovesByProjectPlanId(ProjectPlanId);
|
|
///删除附件
|
|
BLL.CommonService.DeleteAttachFileById(ProjectPlanId);
|
|
Funs.DB.ActionPlan_ProjectPlan.DeleteOnSubmit(ProjectPlan);
|
|
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.ProjectPlan_ReCompile)
|
|
{
|
|
return "重报";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ProjectPlan_Compile)
|
|
{
|
|
return "编制";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ProjectPlan_Reviewing)
|
|
{
|
|
return "施工管理部评审";
|
|
}
|
|
else if (state.ToString() == BLL.Const.ProjectPlan_Complete)
|
|
{
|
|
return "审批完成";
|
|
}
|
|
}
|
|
return "";
|
|
}
|
|
|
|
public static string IsAgree(Object type, Object res)
|
|
{
|
|
string result = string.Empty;
|
|
if (type.ToString().Equals(Const.ProjectPlan_ReCompile) || type.ToString().Equals(Const.ProjectPlan_Compile))
|
|
{
|
|
res = null;
|
|
}
|
|
if (res != null)
|
|
{
|
|
if (Convert.ToBoolean(res))
|
|
{
|
|
result = "是";
|
|
}
|
|
else
|
|
{
|
|
result = "否";
|
|
}
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
}
|