using BLL; using System; namespace FineUIPro.Web.SysManage { public partial class DocEdit : PageBase { #region 定义项 /// /// 主键 /// public string DocId { get { return (string)ViewState["DocId"]; } set { ViewState["DocId"] = value; } } /// /// 项目主键 /// public string ProjectId { get { return (string)ViewState["ProjectId"]; } set { ViewState["ProjectId"] = value; } } #endregion #region 加载 /// /// 加载页面 /// /// /// protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.ProjectId = this.CurrUser.LoginProjectId; this.DocId = Request.Params["DocId"]; if (!string.IsNullOrEmpty(this.DocId)) { Model.Doc_Doc Doc = BLL.DocService.GetDocById(this.DocId); if (Doc != null) { hdId.Text = this.DocId; this.txtDocName.Text = Doc.DocName; this.txtRemark.Text = Doc.Remark; } } } } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { if (!AttachFileService.Getfile(hdId.Text, Const.HelpMenuId)) { Alert.ShowInTop("请上传附件!", MessageBoxIcon.Warning); return; } this.SaveData(BLL.Const.BtnSave); PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } /// /// 保存数据 /// /// private void SaveData(string type) { Model.Doc_Doc Doc = new Model.Doc_Doc { DocName = this.txtDocName.Text.Trim(), Remark = this.txtRemark.Text.Trim(), }; Doc.CompileMan = this.CurrUser.PersonId; Doc.CompileDate = DateTime.Now; if (!string.IsNullOrEmpty(this.DocId)) { Doc.DocId = this.DocId; BLL.DocService.UpdateDoc(Doc); BLL.LogService.AddSys_Log(this.CurrUser, Doc.DocName, Doc.DocId, BLL.Const.HelpMenuId, BLL.Const.BtnModify); } else { if (string.IsNullOrEmpty(hdId.Text.Trim())) { Doc.DocId = SQLHelper.GetNewID(typeof(Model.Doc_Doc)); } else { Doc.DocId = hdId.Text.Trim(); } BLL.DocService.AddDoc(Doc); BLL.LogService.AddSys_Log(this.CurrUser, Doc.DocName, Doc.DocId, BLL.Const.HelpMenuId, BLL.Const.BtnAdd); } } #endregion #region 附件上传 /// /// 上传附件 /// /// /// protected void btnAttachUrl_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(hdId.Text.Trim())) { hdId.Text = SQLHelper.GetNewID(typeof(Model.Doc_Doc)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/DocAttachUrl&menuId={1}", hdId.Text, BLL.Const.HelpMenuId))); } #endregion } }