95 lines
3.6 KiB
C#
95 lines
3.6 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
|
|||
|
namespace FineUIPro.Web.CQMS.DataBase
|
|||
|
{
|
|||
|
public partial class FileEdit : PageBase
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 加载
|
|||
|
/// </summary>
|
|||
|
/// <param name="sender"></param>
|
|||
|
/// <param name="e"></param>
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
string fileId = Request.Params["fileId"];
|
|||
|
string dataTypeProjectId = Request.Params["dataTypeProjectId"];
|
|||
|
if (!string.IsNullOrEmpty(fileId))
|
|||
|
{
|
|||
|
var files = BLL.FileService.GetFileById(fileId);
|
|||
|
if (files!=null)
|
|||
|
{
|
|||
|
this.txtFileCode.Text = files.FileCode;
|
|||
|
this.txtFileName.Text = files.FileName;
|
|||
|
this.txtPages.Text = files.Pages.HasValue ? files.Pages.ToString() : "";
|
|||
|
this.txtRemark.Text = files.Remark;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
#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
|
|||
|
|
|||
|
#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"];
|
|||
|
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;
|
|||
|
if (!string.IsNullOrEmpty(Request.Params["unitId"]))
|
|||
|
{
|
|||
|
newFile.UnitId = Request.Params["unitId"];
|
|||
|
}
|
|||
|
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
|
|||
|
}
|
|||
|
}
|