using System; using BLL; namespace FineUIPro.Web.HJGLServer.FileControl { public partial class ForeignStandardsEdit : PageBase { /// /// 主键 /// public string ForeignStandardsId { get { return (string)ViewState["ForeignStandardsId"]; } set { ViewState["ForeignStandardsId"] = value; } } /// /// 加载页面 /// /// /// 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); } } } /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { this.SaveData(); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } /// /// 保存数据方法 /// 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, "添加国外现行相关标准规范"); } } /// /// 上传附件资源 /// /// /// 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))); } } }