ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGLServer/FileControl/DomesticLawsRegulationsEdit...

107 lines
4.9 KiB
C#

using System;
using BLL;
namespace FineUIPro.Web.HJGLServer.FileControl
{
public partial class DomesticLawsRegulationsEdit : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string DomesticLawsRegulationsId
{
get
{
return (string)ViewState["DomesticLawsRegulationsId"];
}
set
{
ViewState["DomesticLawsRegulationsId"] = value;
}
}
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
this.DomesticLawsRegulationsId = Request.Params["DomesticLawsRegulationsId"];
var domesticLawsRegulations = BLL.HJGL_FileControl_DomesticLawsRegulationsService.GetDomesticLawsRegulationsById(this.DomesticLawsRegulationsId);
if (domesticLawsRegulations != null)
{
this.txtDomesticLawsRegulationsCode.Text = domesticLawsRegulations.DomesticLawsRegulationsCode;
this.txtDomesticLawsRegulationsName.Text = domesticLawsRegulations.DomesticLawsRegulationsName;
this.txtAbstract.Text = domesticLawsRegulations.Summary;
this.txtCompileMan.Text = domesticLawsRegulations.CompileMan;
this.txtRemarks.Text = domesticLawsRegulations.Remarks;
if (domesticLawsRegulations.CompileDate != null)
{
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", domesticLawsRegulations.CompileDate);
}
}
else
{
this.txtCompileMan.Text = this.CurrUser.UserName;
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
}
}
}
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
this.SaveData();
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
}
/// <summary>
/// 保存数据方法
/// </summary>
private void SaveData()
{
Model.HJGL_FileControl_DomesticLawsRegulations newDomesticLawsRegulations = new Model.HJGL_FileControl_DomesticLawsRegulations();
newDomesticLawsRegulations.DomesticLawsRegulationsCode = this.txtDomesticLawsRegulationsCode.Text.Trim();
newDomesticLawsRegulations.DomesticLawsRegulationsName = this.txtDomesticLawsRegulationsName.Text.Trim();
newDomesticLawsRegulations.Summary = this.txtAbstract.Text.Trim();
newDomesticLawsRegulations.CompileMan = this.txtCompileMan.Text.Trim();
newDomesticLawsRegulations.Remarks = this.txtRemarks.Text.Trim();
newDomesticLawsRegulations.CompileDate = Funs.GetNewDateTime(this.dpkCompileDate.Text.Trim());
if (string.IsNullOrEmpty(this.DomesticLawsRegulationsId))
{
this.DomesticLawsRegulationsId = newDomesticLawsRegulations.DomesticLawsRegulationsId = SQLHelper.GetNewID(typeof(Model.HJGL_FileControl_DomesticLawsRegulations));
BLL.HJGL_FileControl_DomesticLawsRegulationsService.AddDomesticLawsRegulations(newDomesticLawsRegulations);
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加国内法律法规相关条款");
}
else
{
newDomesticLawsRegulations.DomesticLawsRegulationsId = this.DomesticLawsRegulationsId;
BLL.HJGL_FileControl_DomesticLawsRegulationsService.UpdateDomesticLawsRegulations(newDomesticLawsRegulations);
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加国内法律法规相关条款");
}
}
/// <summary>
/// 上传附件资源
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.DomesticLawsRegulationsId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/DomesticLawsRegulations&menuId={1}&edit=1", this.DomesticLawsRegulationsId, BLL.Const.HJGLServer_DomesticLawsRegulationsMenuId)));
}
}
}