186 lines
7.7 KiB
C#
186 lines
7.7 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.HSSE.SafetyActivities
|
|||
|
{
|
|||
|
public partial class ThreeYearsOfTacklingTheRootCauseEdit : PageBase
|
|||
|
{
|
|||
|
#region 定义项
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string ThreeYearsOfTacklingTheRootCauseId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ThreeYearsOfTacklingTheRootCauseId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ThreeYearsOfTacklingTheRootCauseId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 项目主键
|
|||
|
/// </summary>
|
|||
|
public string ProjectId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ProjectId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ProjectId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 主键
|
|||
|
/// </summary>
|
|||
|
public string UnitId
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["UnitId"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["UnitId"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 加载
|
|||
|
/// <summary>
|
|||
|
/// 加载页面
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|||
|
this.UnitId = Request.Params["UnitId"];
|
|||
|
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|||
|
this.InitDropDownList();
|
|||
|
|
|||
|
this.ThreeYearsOfTacklingTheRootCauseId = Request.Params["ThreeYearsOfTacklingTheRootCauseId"];
|
|||
|
if (!string.IsNullOrEmpty(this.ThreeYearsOfTacklingTheRootCauseId))
|
|||
|
{
|
|||
|
var getData = BLL.ThreeYearsOfTacklingTheRootCauseService.GetThreeYearsOfTacklingTheRootCauseById(this.ThreeYearsOfTacklingTheRootCauseId);
|
|||
|
if (getData != null)
|
|||
|
{
|
|||
|
this.ProjectId = getData.ProjectId;
|
|||
|
this.UnitId = getData.UnitId;
|
|||
|
if (this.ProjectId != this.CurrUser.LoginProjectId)
|
|||
|
{
|
|||
|
this.InitDropDownList();
|
|||
|
}
|
|||
|
|
|||
|
this.txtTitle.Text = getData.Title;
|
|||
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getData.CompileDate);
|
|||
|
this.txtEndTime.Text = string.Format("{0:yyyy-MM-dd HH:mm}", getData.EndTime);
|
|||
|
if (!string.IsNullOrEmpty(getData.CompileMan))
|
|||
|
{
|
|||
|
this.drpCompileMan.SelectedValue = getData.CompileMan;
|
|||
|
}
|
|||
|
this.txtRemark.Text = getData.Remark;
|
|||
|
this.txtSeeFile.Text = HttpUtility.HtmlDecode(getData.SeeFile);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
|||
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd HH:mm}", DateTime.Now);
|
|||
|
var codeTemplateRule = BLL.ProjectData_CodeTemplateRuleService.GetProjectData_CodeTemplateRuleByMenuIdProjectId(BLL.Const.ProjectThreeYearsOfTacklingTheRootCauseMenuId, this.ProjectId);
|
|||
|
if (codeTemplateRule != null)
|
|||
|
{
|
|||
|
this.txtSeeFile.Text = HttpUtility.HtmlDecode(codeTemplateRule.Template);
|
|||
|
}
|
|||
|
|
|||
|
this.txtTitle.Text = this.SimpleForm1.Title;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 初始化下拉框
|
|||
|
/// </summary>
|
|||
|
private void InitDropDownList()
|
|||
|
{
|
|||
|
UserService.InitFlowOperateControlUserDropDownList(this.drpCompileMan, this.ProjectId, this.UnitId, true);
|
|||
|
this.drpCompileMan.SelectedValue = this.CurrUser.UserId;
|
|||
|
}
|
|||
|
|
|||
|
#region 保存
|
|||
|
/// <summary>
|
|||
|
/// 保存按钮
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
this.SaveData(BLL.Const.BtnSave);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存数据
|
|||
|
/// </summary>
|
|||
|
/// <param name="type"></param>
|
|||
|
private void SaveData(string type)
|
|||
|
{
|
|||
|
Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause newThreeYearsOfTacklingTheRootCause = new Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause
|
|||
|
{
|
|||
|
ProjectId = this.ProjectId,
|
|||
|
UnitId = this.UnitId,
|
|||
|
Title = this.txtTitle.Text.Trim(),
|
|||
|
CompileDate = Funs.GetNewDateTime(this.txtCompileDate.Text.Trim()),
|
|||
|
EndTime = Funs.GetNewDateTime(this.txtEndTime.Text.Trim()),
|
|||
|
};
|
|||
|
if (this.drpCompileMan.SelectedValue != BLL.Const._Null)
|
|||
|
{
|
|||
|
newThreeYearsOfTacklingTheRootCause.CompileMan = this.drpCompileMan.SelectedValue;
|
|||
|
}
|
|||
|
newThreeYearsOfTacklingTheRootCause.Remark = this.txtRemark.Text.Trim();
|
|||
|
newThreeYearsOfTacklingTheRootCause.SeeFile = HttpUtility.HtmlEncode(this.txtSeeFile.Text);
|
|||
|
if (!string.IsNullOrEmpty(this.ThreeYearsOfTacklingTheRootCauseId))
|
|||
|
{
|
|||
|
newThreeYearsOfTacklingTheRootCause.ThreeYearsOfTacklingTheRootCauseId = this.ThreeYearsOfTacklingTheRootCauseId;
|
|||
|
BLL.ThreeYearsOfTacklingTheRootCauseService.UpdateThreeYearsOfTacklingTheRootCause(newThreeYearsOfTacklingTheRootCause);
|
|||
|
BLL.LogService.AddSys_Log(this.CurrUser, newThreeYearsOfTacklingTheRootCause.Title, newThreeYearsOfTacklingTheRootCause.ThreeYearsOfTacklingTheRootCauseId, BLL.Const.ProjectThreeYearsOfTacklingTheRootCauseMenuId, BLL.Const.BtnModify);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this.ThreeYearsOfTacklingTheRootCauseId = SQLHelper.GetNewID(typeof(Model.SafetyActivities_ThreeYearsOfTacklingTheRootCause));
|
|||
|
newThreeYearsOfTacklingTheRootCause.ThreeYearsOfTacklingTheRootCauseId = this.ThreeYearsOfTacklingTheRootCauseId;
|
|||
|
BLL.ThreeYearsOfTacklingTheRootCauseService.AddThreeYearsOfTacklingTheRootCause(newThreeYearsOfTacklingTheRootCause);
|
|||
|
BLL.LogService.AddSys_Log(this.CurrUser, newThreeYearsOfTacklingTheRootCause.Title, newThreeYearsOfTacklingTheRootCause.ThreeYearsOfTacklingTheRootCauseId, BLL.Const.ProjectThreeYearsOfTacklingTheRootCauseMenuId, BLL.Const.BtnAdd);
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
#region 附件上传
|
|||
|
/// <summary>
|
|||
|
/// 上传附件
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (string.IsNullOrEmpty(this.ThreeYearsOfTacklingTheRootCauseId))
|
|||
|
{
|
|||
|
SaveData(BLL.Const.BtnSave);
|
|||
|
}
|
|||
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ThreeYearsOfTacklingTheRootCauseAttachUrl&menuId={1}", ThreeYearsOfTacklingTheRootCauseId, BLL.Const.ProjectThreeYearsOfTacklingTheRootCauseMenuId)));
|
|||
|
}
|
|||
|
#endregion
|
|||
|
}
|
|||
|
}
|