xinjiang/SGGL/FineUIPro.Web/HSSE/InformationProject/ConstructionStandardIdentif...

170 lines
5.8 KiB
C#
Raw Normal View History

2024-11-19 09:45:27 +08:00
using BLL;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Linq;
namespace FineUIPro.Web.HSSE.InformationProject
{
public partial class ConstructionStandardIdentifyFileEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
public string ConstructionStandardIdentifyFileId
{
get
{
return (string)ViewState["ConstructionStandardIdentifyFileId"];
}
set
{
ViewState["ConstructionStandardIdentifyFileId"] = 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.btnClose.OnClientClick = ActiveWindow.GetHidePostBackReference();
this.ProjectId = this.CurrUser.LoginProjectId;
this.ConstructionStandardIdentifyFileId = Request.Params["ConstructionStandardIdentifyFileId"];
var model=BLL.InformationProject_ConstructionStandardIdentifyFileService.GetInformationProject_ConstructionStandardIdentifyFileById(this.ConstructionStandardIdentifyFileId);
if (model != null)
{
txtCode.Text=model.Code;
txtFileName.Text=model.FileName;
txtVersionNumber.Text = model.VersionNumber;
txtCreateUser.Text = UserService.GetUserNameByUserId(model.Creater);
txtRemark.Text = model.Remark;
}
else
{
this.txtCode.Text = BLL.CodeRecordsService.ReturnCodeByMenuIdProjectId(BLL.Const.ConstructionStandardIdentifyFileMenuId, this.ProjectId, this.CurrUser.UnitId);
txtCreateUser.Text = UserService.GetUserNameByUserId(this.CurrUser.UserId);
}
}
}
#endregion
#region
/// <summary>
/// 保存按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
this.SaveData();
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
#endregion
#region
/// <summary>
/// 保存数据
/// </summary>
/// <param name="type"></param>
private void SaveData()
{
var model =new Model.InformationProject_ConstructionStandardIdentifyFile ();
model.Code = txtCode.Text;
model.FileName = txtFileName.Text;
model.VersionNumber = txtVersionNumber.Text;
model.Remark = txtRemark.Text;
model.Creater=this.CurrUser.UserId ;
model.CreateDate = DateTime.Now;
model.ProjectId= ProjectId;
if (string.IsNullOrEmpty( ConstructionStandardIdentifyFileId) )
{
ConstructionStandardIdentifyFileId = SQLHelper.GetNewID(typeof(Model.InformationProject_ConstructionStandardIdentifyFile));
model.Id = ConstructionStandardIdentifyFileId ;
BLL.InformationProject_ConstructionStandardIdentifyFileService.AddInformationProject_ConstructionStandardIdentifyFile(model);
}
else
{
model.Id = ConstructionStandardIdentifyFileId;
BLL.InformationProject_ConstructionStandardIdentifyFileService.UpdateInformationProject_ConstructionStandardIdentifyFile (model);
}
}
#endregion
#region
/// <summary>
/// 关闭弹出窗
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, EventArgs e)
{
}
#endregion
#region
/// <summary>
/// 上传附件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnAttachUrl_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.ConstructionStandardIdentifyFileId))
{
this.SaveData();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/ConstructionStandardIdentifyFile&menuId={1}", this.ConstructionStandardIdentifyFileId, BLL.Const.ConstructionStandardIdentifyFileMenuId)));
}
#endregion
///// <summary>
///// 选择培训教材类型
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//protected void btnTrainingType_Click(object sender, EventArgs e)
//{
// if (string.IsNullOrEmpty(this.ConstructionStandardIdentifyFileId))
// {
// this.SaveData(BLL.Const.BtnSave);
// }
// PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ShowTrainingType.aspx?ConstructionStandardIdentifyFileId={0}&TrainTypeId={1}", this.ConstructionStandardIdentifyFileId, this.drpTrainType.SelectedValue, "编辑 - ")));
//}
}
}