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

107 lines
4.6 KiB
C#

using System;
using BLL;
namespace FineUIPro.Web.HJGLServer.FileControl
{
public partial class ForeignStandardsEdit : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string ForeignStandardsId
{
get
{
return (string)ViewState["ForeignStandardsId"];
}
set
{
ViewState["ForeignStandardsId"] = 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.ForeignStandardsId = Request.Params["ForeignStandardsId"];
var ForeignStandards = BLL.HJGL_FileControl_ForeignStandardsService.GetForeignStandardsById(this.ForeignStandardsId);
if (ForeignStandards != null)
{
this.txtForeignStandardsCode.Text = ForeignStandards.ForeignStandardsCode;
this.txtForeignStandardsName.Text = ForeignStandards.ForeignStandardsName;
this.txtAbstract.Text = ForeignStandards.Summary;
this.txtCompileMan.Text = ForeignStandards.CompileMan;
this.txtRemarks.Text = ForeignStandards.Remarks;
if (ForeignStandards.CompileDate != null)
{
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", ForeignStandards.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_ForeignStandards newForeignStandards = new Model.HJGL_FileControl_ForeignStandards();
newForeignStandards.ForeignStandardsCode = this.txtForeignStandardsCode.Text.Trim();
newForeignStandards.ForeignStandardsName = this.txtForeignStandardsName.Text.Trim();
newForeignStandards.Summary = this.txtAbstract.Text.Trim();
newForeignStandards.CompileMan = this.txtCompileMan.Text.Trim();
newForeignStandards.Remarks = this.txtRemarks.Text.Trim();
newForeignStandards.CompileDate = Funs.GetNewDateTime(this.dpkCompileDate.Text.Trim());
if (string.IsNullOrEmpty(this.ForeignStandardsId))
{
this.ForeignStandardsId = newForeignStandards.ForeignStandardsId = SQLHelper.GetNewID(typeof(Model.HJGL_FileControl_ForeignStandards));
BLL.HJGL_FileControl_ForeignStandardsService.AddForeignStandards(newForeignStandards);
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加国外现行相关标准规范");
}
else
{
newForeignStandards.ForeignStandardsId = this.ForeignStandardsId;
BLL.HJGL_FileControl_ForeignStandardsService.UpdateForeignStandards(newForeignStandards);
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.ForeignStandardsId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/ForeignStandards&menuId={1}&edit=1", this.ForeignStandardsId, BLL.Const.HJGLServer_ForeignStandardsMenuId)));
}
}
}