CNCEC_SUBQHSE_WUHUAN/SGGL/FineUIPro.Web/CQMS/DataBase/FileEdit2.aspx.cs

92 lines
3.7 KiB
C#

using BLL;
using System;
namespace FineUIPro.Web.CQMS.DataBase
{
public partial class FileEdit2 : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//string dataTypeProjectId = Request.Params["dataTypeProjectId"];
//string divisionProjectId = Request.Params["divisionProjectId"];
//string unitWorkId = Request.Params["unitWorkId"];
string fileId = Request.Params["fileId"];
if (!string.IsNullOrEmpty(fileId))
{
Model.DataBase_File file = BLL.FileService.GetFileById(fileId);
if (file!=null)
{
this.txtFileCode.Text = file.FileCode;
this.txtFileName.Text = file.FileName;
this.txtPages.Text = file.Pages.HasValue ? file.Pages.ToString() : "";
this.txtRemark.Text = file.Remark;
}
}
}
}
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
string fileId = Request.Params["fileId"];
string dataTypeProjectId = Request.Params["dataTypeProjectId"];
string divisionProjectId = Request.Params["divisionProjectId"];
string unitWorkId = Request.Params["unitWorkId"];
Model.DataBase_File newFile = new Model.DataBase_File();
newFile.FileCode = this.txtFileCode.Text.Trim();
newFile.FileName = this.txtFileName.Text.Trim();
newFile.Pages = Funs.GetNewInt(this.txtPages.Text.Trim());
newFile.Remark = this.txtRemark.Text.Trim();
if (!string.IsNullOrEmpty(fileId))
{
newFile.FileId = fileId;
BLL.FileService.UpdateFile(newFile);
}
else
{
newFile.ProjectId = this.CurrUser.LoginProjectId;
newFile.DataTypeProjectId = dataTypeProjectId;
newFile.UnitWorkId = unitWorkId;
newFile.DivisionProjectId = divisionProjectId;
newFile.CompileMan = this.CurrUser.UserId;
newFile.CompileDate = DateTime.Now;
if (!string.IsNullOrEmpty(this.hdId.Text.Trim()))
{
newFile.FileId = this.hdId.Text.Trim();
}
else
{
newFile.FileId = SQLHelper.GetNewID(typeof(Model.DataBase_File));
this.hdId.Text = newFile.FileId;
}
BLL.FileService.AddFile(newFile);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
#region
/// <summary>
/// 附件上传
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttach_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录
{
this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DataBase_File));
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CommonUpLoadFile&menuId={1}", this.hdId.Text, BLL.Const.DataBaseProjectMenuId)));
}
#endregion
}
}