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