333 lines
11 KiB
C#
333 lines
11 KiB
C#
|
using BLL;
|
|||
|
using Model;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Diagnostics;
|
|||
|
using System.Linq;
|
|||
|
using System.Runtime.CompilerServices;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
using AspNet = System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.CQMS.Solution
|
|||
|
{
|
|||
|
public partial class EditConstructSolutionFinal : PageBase
|
|||
|
{
|
|||
|
#region 定义变量
|
|||
|
/// <summary>
|
|||
|
/// 方案审查主键
|
|||
|
/// </summary>
|
|||
|
public string ConstructSolutionId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ConstructSolutionId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ConstructSolutionId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
public string State
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["State"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["State"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
public string showBtn
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["showBtn"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["showBtn"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 定义集合
|
|||
|
/// <summary>
|
|||
|
/// 定义会签意见集合
|
|||
|
/// </summary>
|
|||
|
public static List<Model.Solution_CQMSConstructSolutionApprove> approves = new List<Model.Solution_CQMSConstructSolutionApprove>();
|
|||
|
#endregion
|
|||
|
|
|||
|
public int ContactImg
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return Convert.ToInt32(ViewState["ContactImg"]);
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ContactImg"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public string lastCanRemoveApproveId
|
|||
|
{
|
|||
|
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["lastCanRemoveApproveId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["lastCanRemoveApproveId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, false);
|
|||
|
showBtn = "true";
|
|||
|
ContactImg = 0;
|
|||
|
//CommonService.GetAllButtonList(CurrUser.LoginProjectId, CurrUser.UserId, Const.CQMSConstructSolutionMenuId);
|
|||
|
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|||
|
ConstructSolutionId = Request.Params["constructSolutionId"];
|
|||
|
this.State = "1";
|
|||
|
if (this.CurrUser.UnitId != null && this.CurrUser.UnitId != Const.UnitId_CD && this.CurrUser.UnitId != Const.hfnbdId)
|
|||
|
{
|
|||
|
drpUnit.Enabled = false;
|
|||
|
}
|
|||
|
drpUnit.SelectedValue = this.CurrUser.UnitId;
|
|||
|
if (!string.IsNullOrWhiteSpace(ConstructSolutionId))
|
|||
|
{
|
|||
|
HFConstructSolutionId.Text = ConstructSolutionId;
|
|||
|
Model.Solution_CQMSConstructSolution_Final constructSolution = CQMSConstructSolutionFinalService.GetConstructSolutionByConstructSolutionId(ConstructSolutionId);
|
|||
|
txtCode.Text = constructSolution.SolutionCode;
|
|||
|
this.State = constructSolution.State;
|
|||
|
if (!string.IsNullOrEmpty(constructSolution.UnitId))
|
|||
|
{
|
|||
|
drpUnit.SelectedValue = constructSolution.UnitId;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if (constructSolution.AuditDate != null)
|
|||
|
{
|
|||
|
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", constructSolution.AuditDate);
|
|||
|
}
|
|||
|
txtSolutionName.Text = constructSolution.SolutionName;
|
|||
|
|
|||
|
if (constructSolution.CompileMan == this.CurrUser.UserId)
|
|||
|
{
|
|||
|
showBtn = "true";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
showBtn = "false";
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
#region 保存/提交
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
//validate(Const.BtnSave, "save");
|
|||
|
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId, Const.CQMSConstructSolutionFineMenuId, Const.BtnSave))
|
|||
|
{
|
|||
|
SaveCQMSConstructSolution("save");
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
validate(Const.BtnSubmit, "submit");
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存验证
|
|||
|
/// </summary>
|
|||
|
/// <param name="buttonName"></param>
|
|||
|
/// <param name="tip"></param>
|
|||
|
public void validate(string buttonName, string tip)
|
|||
|
{
|
|||
|
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId, Const.CQMSConstructSolutionMenuId, buttonName))
|
|||
|
{
|
|||
|
string err = string.Empty;
|
|||
|
|
|||
|
if (!AttachFileService.Getfile(HFConstructSolutionId.Text, Const.CQMSConstructSolutionMenuId))
|
|||
|
{
|
|||
|
err += "请上传附件,";
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
//if (string.IsNullOrEmpty(hdFilePath.Value))
|
|||
|
//{
|
|||
|
// err += "请上传附件,";
|
|||
|
//}
|
|||
|
|
|||
|
|
|||
|
if (!string.IsNullOrWhiteSpace(err))
|
|||
|
{
|
|||
|
err = err.Substring(0, err.LastIndexOf(","));
|
|||
|
err += "!";
|
|||
|
}
|
|||
|
if (!string.IsNullOrWhiteSpace(err))
|
|||
|
{
|
|||
|
Alert.ShowInTop(err, MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
if (tip == "save")
|
|||
|
{
|
|||
|
tip = "保存成功!";
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
tip = "提交成功!";
|
|||
|
}
|
|||
|
Alert.ShowInTop(tip, MessageBoxIcon.Success);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 编辑时候保存
|
|||
|
/// </summary>
|
|||
|
private void EditConstructSol(string saveType)
|
|||
|
{
|
|||
|
Model.Solution_CQMSConstructSolution_Final constructSolution = new Model.Solution_CQMSConstructSolution_Final();
|
|||
|
constructSolution.ProjectId = CurrUser.LoginProjectId;
|
|||
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
constructSolution.UnitId = drpUnit.SelectedValue;
|
|||
|
}
|
|||
|
|
|||
|
constructSolution.SolutionName = txtSolutionName.Text.Trim();
|
|||
|
if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
|
|||
|
{
|
|||
|
constructSolution.AuditDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(ConstructSolutionId))
|
|||
|
{
|
|||
|
constructSolution.ConstructSolutionId = ConstructSolutionId;
|
|||
|
|
|||
|
|
|||
|
CQMSConstructSolutionFinalService.UpdateConstructSolution(constructSolution);
|
|||
|
//判断状态,全部会签同意,则审批完成
|
|||
|
|
|||
|
LogService.AddSys_Log(CurrUser, constructSolution.ConstructSolutionId, ConstructSolutionId, Const.CQMSConstructSolutionMenuId, "修改施工方案");
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 添加时候的保存
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存方案审查
|
|||
|
/// </summary>
|
|||
|
/// <param name="saveType">保存类型</param>
|
|||
|
private void SaveCQMSConstructSolution(string saveType)
|
|||
|
{
|
|||
|
|
|||
|
Model.Solution_CQMSConstructSolution_Final constructSolution = new Model.Solution_CQMSConstructSolution_Final();
|
|||
|
constructSolution.ProjectId = CurrUser.LoginProjectId;
|
|||
|
if (drpUnit.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
constructSolution.UnitId = drpUnit.SelectedValue;
|
|||
|
}
|
|||
|
|
|||
|
constructSolution.SolutionName = txtSolutionName.Text.Trim();
|
|||
|
constructSolution.SolutionCode = txtCode.Text.Trim();
|
|||
|
if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
|
|||
|
{
|
|||
|
constructSolution.AuditDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
|
|||
|
}
|
|||
|
|
|||
|
if (!string.IsNullOrEmpty(HFConstructSolutionId.Text))
|
|||
|
{
|
|||
|
constructSolution.ConstructSolutionId = HFConstructSolutionId.Text;
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
constructSolution.ConstructSolutionId = SQLHelper.GetNewID(typeof(Model.Solution_CQMSConstructSolution));
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
constructSolution.CompileMan = CurrUser.UserId;
|
|||
|
if (!string.IsNullOrEmpty(HFConstructSolutionId.Text))
|
|||
|
{
|
|||
|
CQMSConstructSolutionFinalService.UpdateConstructSolution(constructSolution);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
CQMSConstructSolutionFinalService.AddConstructSolution(constructSolution);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
LogService.AddSys_Log(CurrUser, constructSolution.ConstructSolutionId, ConstructSolutionId, Const.CQMSConstructSolutionMenuId, "编制方案审查");
|
|||
|
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
protected void imgBtnFile_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(HFConstructSolutionId.Text)) //新增记录
|
|||
|
{
|
|||
|
HFConstructSolutionId.Text = SQLHelper.GetNewID(typeof(Model.Solution_CQMSConstructSolution));
|
|||
|
}
|
|||
|
|
|||
|
if (showBtn == "true")
|
|||
|
{
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
|
|||
|
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
|
|||
|
0, HFConstructSolutionId.Text, Const.CQMSConstructSolutionMenuId)));
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
|
|||
|
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
|
|||
|
-1, HFConstructSolutionId.Text, Const.CQMSConstructSolutionMenuId)));
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|