SGGL_SHJ/SGGL/FineUIPro.Web/SysManage/DocEdit.aspx.cs

133 lines
4.0 KiB
C#
Raw Permalink Normal View History

2023-12-22 14:36:26 +08:00
using BLL;
using System;
namespace FineUIPro.Web.SysManage
{
public partial class DocEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string DocId
{
get
{
return (string)ViewState["DocId"];
}
set
{
ViewState["DocId"] = value;
}
}
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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());
}
/// <summary>
/// 保存数据
/// </summary>
/// <param name="type"></param>
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
/// <summary>
/// 上传附件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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
}
}