ZHJA_HJGL/HJGL_ZH/FineUIPro.Web/Welder/QualifiedProjectEdit.aspx.cs

129 lines
5.2 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.Welder
{
public partial class QualifiedProjectEdit : PageBase
{
#region
/// <summary>
/// 合格项目id
/// </summary>
public string WelderQualifiedProjectId
{
get
{
return (string)ViewState["WelderQualifiedProjectId"];
}
set
{
ViewState["WelderQualifiedProjectId"] = value;
}
}
/// <summary>
/// 焊工id
/// </summary>
public string WED_ID
{
get
{
return (string)ViewState["WED_ID"];
}
set
{
ViewState["WED_ID"] = 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.GetHideReference();
this.WelderQualifiedProjectId = Request.Params["WelderQualifiedProjectId"];
this.WED_ID = Request.Params["WED_ID"];
if (!string.IsNullOrEmpty(this.WelderQualifiedProjectId))
{
var welderQualifiedProject = BLL.HJGL_WelderQualifiedProjectService.GetWelderQualifiedProjectById(this.WelderQualifiedProjectId);
if (welderQualifiedProject != null)
{
this.WED_ID = welderQualifiedProject.WED_ID;
this.txtQualifiedProjectCode.Text = welderQualifiedProject.QualifiedProjectCode;
if (welderQualifiedProject.LimitDate.HasValue)
{
this.txtLimitDate.Text = string.Format("{0:yyyy-MM-dd}", welderQualifiedProject.LimitDate);
}
this.txtCertificateNo.Text = welderQualifiedProject.CertificateNo;
if (welderQualifiedProject.CheckDate.HasValue)
{
this.txtCheckDate.Text = string.Format("{0:yyyy-MM-dd}", welderQualifiedProject.CheckDate);
}
}
}
Model.HJGL_BS_Welder welder = BLL.HJGL_PersonManageService.GetWelderByWenId(this.WED_ID);
if (welder != null)
{
this.lbWedlerName.Text = welder.WED_Name;
this.lbWedlerCode.Text = welder.WED_Code;
}
}
}
#endregion
#region
/// <summary>
/// 提交按钮事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
SaveData();
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
private void SaveData()
{
if (BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.Welder_QualifiedProjectMenuId, BLL.Const.BtnSave))
{
Model.HJGL_BS_WelderQualifiedProject welderQualifiedProject = new Model.HJGL_BS_WelderQualifiedProject();
welderQualifiedProject.WED_ID = this.WED_ID;
welderQualifiedProject.QualifiedProjectCode = this.txtQualifiedProjectCode.Text.Trim();
welderQualifiedProject.LimitDate = Funs.GetNewDateTime(this.txtLimitDate.Text.Trim());
welderQualifiedProject.CertificateNo = this.txtCertificateNo.Text.Trim();
welderQualifiedProject.CheckDate = Funs.GetNewDateTime(this.txtCheckDate.Text.Trim());
if (!string.IsNullOrEmpty(WelderQualifiedProjectId))
{
welderQualifiedProject.WelderQualifiedProjectId = this.WelderQualifiedProjectId;
BLL.HJGL_WelderQualifiedProjectService.UpdateWelderQualifiedProject(welderQualifiedProject);
BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "修改焊工合格项目信息");
}
else
{
welderQualifiedProject.WelderQualifiedProjectId = SQLHelper.GetNewID(typeof(Model.HJGL_BS_WelderQualifiedProject));
this.WelderQualifiedProjectId = welderQualifiedProject.WelderQualifiedProjectId;
BLL.HJGL_WelderQualifiedProjectService.AddWelderQualifiedProject(welderQualifiedProject);
BLL.Sys_LogService.AddLog(Const.System_6, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加焊工合格项目信息");
}
}
else
{
ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
#endregion
}
}