136 lines
		
	
	
		
			5.7 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			136 lines
		
	
	
		
			5.7 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.WelderManage
 | 
						|
{
 | 
						|
    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.WelderQualifiedService.GetWelderQualifiedProjectById(this.WelderQualifiedProjectId);
 | 
						|
                    if (welderQualifiedProject != null)
 | 
						|
                    {
 | 
						|
                        this.WED_ID = welderQualifiedProject.WelderId;
 | 
						|
                        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);
 | 
						|
                        }
 | 
						|
                        this.txtExamProject.Text = welderQualifiedProject.ExamProject;
 | 
						|
                        txtRemark.Text = welderQualifiedProject.Remark;
 | 
						|
                        drpIsPass.SelectedValue = welderQualifiedProject.IsPass == true ? "是" : "否";
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                Model.Welder_Welder welder = BLL.WelderService.GetWelderById(this.WED_ID);
 | 
						|
                if (welder != null)
 | 
						|
                {
 | 
						|
                    this.lbWedlerName.Text = welder.WelderName;
 | 
						|
                    this.lbWedlerCode.Text = welder.WelderCode;
 | 
						|
                }
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #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.Welder_WelderQualify welderQualifiedProject = new Model.Welder_WelderQualify();
 | 
						|
                welderQualifiedProject.WelderId = 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());
 | 
						|
                welderQualifiedProject.ExamProject = txtExamProject.Text.Trim();
 | 
						|
                welderQualifiedProject.Remark = txtRemark.Text;
 | 
						|
                welderQualifiedProject.IsPass = drpIsPass.SelectedValue == "是" ? true : false;
 | 
						|
 | 
						|
                if (!string.IsNullOrEmpty(WelderQualifiedProjectId))
 | 
						|
                {
 | 
						|
                    welderQualifiedProject.WelderQualifiedProjectId = this.WelderQualifiedProjectId;
 | 
						|
                    BLL.WelderQualifiedService.UpdateWelderQualifiedProject(welderQualifiedProject);
 | 
						|
                    BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.Welder_QualifiedProjectMenuId, Const.BtnModify, this.WED_ID);
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    welderQualifiedProject.WelderQualifiedProjectId = SQLHelper.GetNewID(typeof(Model.Welder_Welder));
 | 
						|
                    this.WelderQualifiedProjectId = welderQualifiedProject.WelderQualifiedProjectId;
 | 
						|
                    BLL.WelderQualifiedService.AddWelderQualifiedProject(welderQualifiedProject);
 | 
						|
                    BLL.Sys_LogService.AddLog(Const.System_1, this.CurrUser.LoginProjectId, this.CurrUser.UserId, Const.Welder_QualifiedProjectMenuId, Const.BtnAdd, this.WED_ID);
 | 
						|
                }
 | 
						|
            }
 | 
						|
            else
 | 
						|
            {
 | 
						|
                ShowNotify("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
 | 
						|
            }
 | 
						|
        }
 | 
						|
        #endregion
 | 
						|
    }
 | 
						|
} |