ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/HJGLServer/FileControl/DomesticStandardsEdit.aspx.cs

107 lines
4.6 KiB
C#

using System;
using BLL;
namespace FineUIPro.Web.HJGLServer.FileControl
{
public partial class DomesticStandardsEdit : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string DomesticStandardsId
{
get
{
return (string)ViewState["DomesticStandardsId"];
}
set
{
ViewState["DomesticStandardsId"] = 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.DomesticStandardsId = Request.Params["DomesticStandardsId"];
var DomesticStandards = BLL.HJGL_FileControl_DomesticStandardsService.GetDomesticStandardsById(this.DomesticStandardsId);
if (DomesticStandards != null)
{
this.txtDomesticStandardsCode.Text = DomesticStandards.DomesticStandardsCode;
this.txtDomesticStandardsName.Text = DomesticStandards.DomesticStandardsName;
this.txtAbstract.Text = DomesticStandards.Summary;
this.txtCompileMan.Text = DomesticStandards.CompileMan;
this.txtRemarks.Text = DomesticStandards.Remarks;
if (DomesticStandards.CompileDate != null)
{
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DomesticStandards.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_DomesticStandards newDomesticStandards = new Model.HJGL_FileControl_DomesticStandards();
newDomesticStandards.DomesticStandardsCode = this.txtDomesticStandardsCode.Text.Trim();
newDomesticStandards.DomesticStandardsName = this.txtDomesticStandardsName.Text.Trim();
newDomesticStandards.Summary = this.txtAbstract.Text.Trim();
newDomesticStandards.CompileMan = this.txtCompileMan.Text.Trim();
newDomesticStandards.Remarks = this.txtRemarks.Text.Trim();
newDomesticStandards.CompileDate = Funs.GetNewDateTime(this.dpkCompileDate.Text.Trim());
if (string.IsNullOrEmpty(this.DomesticStandardsId))
{
this.DomesticStandardsId = newDomesticStandards.DomesticStandardsId = SQLHelper.GetNewID(typeof(Model.HJGL_FileControl_DomesticStandards));
BLL.HJGL_FileControl_DomesticStandardsService.AddDomesticStandards(newDomesticStandards);
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加国内现行相关标准规范");
}
else
{
newDomesticStandards.DomesticStandardsId = this.DomesticStandardsId;
BLL.HJGL_FileControl_DomesticStandardsService.UpdateDomesticStandards(newDomesticStandards);
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.DomesticStandardsId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/DomesticStandards&menuId={1}&edit=1", this.DomesticStandardsId, BLL.Const.HJGLServer_DomesticStandardsMenuId)));
}
}
}