using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using BLL; namespace FineUIPro.Web.HJGL.PersonManage { public partial class PersonQualifiedProjectEdit : PageBase { #region 定义项 /// /// 合格项目id /// public string WelderQualifiedProjectId { get { return (string)ViewState["WelderQualifiedProjectId"]; } set { ViewState["WelderQualifiedProjectId"] = value; } } /// /// 焊工id /// public string WED_ID { get { return (string)ViewState["WED_ID"]; } set { ViewState["WED_ID"] = value; } } #endregion /// /// 加载页面 /// /// /// 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 != null) { this.txtLimitDate.Text = string.Format("{0:yyyy-MM-dd}", welderQualifiedProject.LimitDate); } } } 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; } } } /// /// 提交按钮事件 /// /// /// 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.HJGL_PersonManageMenuId, 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()); if (!string.IsNullOrEmpty(WelderQualifiedProjectId)) { welderQualifiedProject.WelderQualifiedProjectId = this.WelderQualifiedProjectId; BLL.HJGL_WelderQualifiedProjectService.UpdateWelderQualifiedProject(welderQualifiedProject); BLL.Sys_LogService.AddLog(Const.System_3, 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_3, this.CurrUser.LoginProjectId, this.CurrUser.UserId, "添加焊工合格项目信息"); } } else { ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } } }