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

107 lines
4.6 KiB
C#

using System;
using BLL;
namespace FineUIPro.Web.HJGLServer.FileControl
{
public partial class CompanyStandardsEdit : PageBase
{
/// <summary>
/// 主键
/// </summary>
public string CompanyStandardsId
{
get
{
return (string)ViewState["CompanyStandardsId"];
}
set
{
ViewState["CompanyStandardsId"] = 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.CompanyStandardsId = Request.Params["CompanyStandardsId"];
var CompanyStandards = BLL.HJGL_FileControl_CompanyStandardsService.GetCompanyStandardsById(this.CompanyStandardsId);
if (CompanyStandards != null)
{
this.txtCompanyStandardsCode.Text = CompanyStandards.CompanyStandardsCode;
this.txtCompanyStandardsName.Text = CompanyStandards.CompanyStandardsName;
this.txtAbstract.Text = CompanyStandards.Summary;
this.txtCompileMan.Text = CompanyStandards.CompileMan;
this.txtRemarks.Text = CompanyStandards.Remarks;
if (CompanyStandards.CompileDate != null)
{
this.dpkCompileDate.Text = string.Format("{0:yyyy-MM-dd}", CompanyStandards.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_CompanyStandards newCompanyStandards = new Model.HJGL_FileControl_CompanyStandards();
newCompanyStandards.CompanyStandardsCode = this.txtCompanyStandardsCode.Text.Trim();
newCompanyStandards.CompanyStandardsName = this.txtCompanyStandardsName.Text.Trim();
newCompanyStandards.Summary = this.txtAbstract.Text.Trim();
newCompanyStandards.CompileMan = this.txtCompileMan.Text.Trim();
newCompanyStandards.Remarks = this.txtRemarks.Text.Trim();
newCompanyStandards.CompileDate = Funs.GetNewDateTime(this.dpkCompileDate.Text.Trim());
if (string.IsNullOrEmpty(this.CompanyStandardsId))
{
this.CompanyStandardsId = newCompanyStandards.CompanyStandardsId = SQLHelper.GetNewID(typeof(Model.HJGL_FileControl_CompanyStandards));
BLL.HJGL_FileControl_CompanyStandardsService.AddCompanyStandards(newCompanyStandards);
BLL.Sys_LogService.AddLog(BLL.Const.System_2, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加国外现行相关标准规范");
}
else
{
newCompanyStandards.CompanyStandardsId = this.CompanyStandardsId;
BLL.HJGL_FileControl_CompanyStandardsService.UpdateCompanyStandards(newCompanyStandards);
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.CompanyStandardsId))
{
SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/FileControl/CompanyStandards&menuId={1}&edit=1", this.CompanyStandardsId, BLL.Const.HJGLServer_CompanyStandardsMenuId)));
}
}
}