HJGL_DS/HJGL_DS/FineUIPro.Web/JGZL/NDTPersonEdit.aspx.cs

115 lines
4.0 KiB
C#

using BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.JGZL
{
public partial class NDTPersonEdit : PageBase
{
#region
/// <summary>
/// 主键
/// </summary>
private string NDTPersonId
{
get
{
return (string)ViewState["NDTPersonId"];
}
set
{
ViewState["NDTPersonId"] = value;
}
}
/// <summary>
/// 项目Id
/// </summary>
private 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 = Request.Params["projectId"];
this.NDTPersonId = Request.Params["NDTPersonId"];
if (!string.IsNullOrEmpty(this.NDTPersonId))
{
var report = BLL.NDTPersonService.GetNDTPersonById(this.NDTPersonId);
if (report != null)
{
this.txtPersonName.Text = report.PersonName;
this.txtCertificateNumber.Text = report.CertificateNumber;
this.txtQualifiedProjectCode.Text = report.QualifiedProjectCode;
this.txtLevels.Text = report.Levels;
this.txtValidityDate.Text = report.ValidityDate.HasValue ? string.Format("{0:yyyy-MM-dd}", report.ValidityDate) : "";
}
}
}
}
#endregion
#region
/// <summary>
/// 提交按钮
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
if (CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.JGZL_NDTPersonMenuId, Const.BtnSave))
{
Model.JGZL_NDTPerson newReport = new Model.JGZL_NDTPerson();
newReport.PersonName = this.txtPersonName.Text.Trim();
newReport.CertificateNumber = this.txtCertificateNumber.Text.Trim();
newReport.QualifiedProjectCode = this.txtQualifiedProjectCode.Text.Trim();
newReport.Levels = this.txtLevels.Text.Trim();
newReport.ValidityDate = Funs.GetNewDateTime(this.txtValidityDate.Text.Trim());
if (!string.IsNullOrEmpty(this.NDTPersonId))
{
newReport.NDTPersonId = this.NDTPersonId;
BLL.NDTPersonService.UpdateNDTPerson(newReport);
}
else
{
newReport.ProjectId = this.ProjectId;
newReport.CompileMan = this.CurrUser.UserId;
newReport.CompileDate = DateTime.Now;
newReport.NDTPersonId = SQLHelper.GetNewID(typeof(Model.JGZL_NDTPerson));
this.NDTPersonId = newReport.NDTPersonId;
BLL.NDTPersonService.AddNDTPerson(newReport);
}
ShowNotify("保存成功!", MessageBoxIcon.Success);
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
return;
}
}
#endregion
}
}