367 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C#
		
	
	
	
		
		
			
		
	
	
			367 lines
		
	
	
		
			16 KiB
		
	
	
	
		
			C#
		
	
	
	
| 
								 | 
							
								using BLL;
							 | 
						|||
| 
								 | 
							
								using FineUIPro.Web.HJGL.BaseInfo;
							 | 
						|||
| 
								 | 
							
								using System;
							 | 
						|||
| 
								 | 
							
								using System.Collections.Generic;
							 | 
						|||
| 
								 | 
							
								using System.Linq;
							 | 
						|||
| 
								 | 
							
								using System.Web;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI;
							 | 
						|||
| 
								 | 
							
								using System.Web.UI.WebControls;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								namespace FineUIPro.Web.HJGL.PersonManage
							 | 
						|||
| 
								 | 
							
								{
							 | 
						|||
| 
								 | 
							
								    public partial class PersonEntranceManageEdit : PageBase
							 | 
						|||
| 
								 | 
							
								    {
							 | 
						|||
| 
								 | 
							
								        #region 加载
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 加载页面
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void Page_Load(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (!IsPostBack)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                 BLL.UnitService.InitUnitDropDownList(this.drpUnitId, this.CurrUser.LoginProjectId, true);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                var unit = BLL.UnitService.GetUnitByUnitId(this.CurrUser.UnitId);
							 | 
						|||
| 
								 | 
							
								                var db = Funs.DB;
							 | 
						|||
| 
								 | 
							
								                var userList = from x in db.Sys_User
							 | 
						|||
| 
								 | 
							
								                               join y in db.Project_ProjectUnit
							 | 
						|||
| 
								 | 
							
								                               on x.UnitId equals y.UnitId
							 | 
						|||
| 
								 | 
							
								                               join p in db.Project_ProjectUser
							 | 
						|||
| 
								 | 
							
								                               on x.UserId equals p.UserId
							 | 
						|||
| 
								 | 
							
								                               where y.UnitId == Const.UnitId_TCC && p.ProjectId == CurrUser.LoginProjectId && y.ProjectId == CurrUser.LoginProjectId
							 | 
						|||
| 
								 | 
							
								                               where p.RoleId.Contains(Const.ZBCNEngineer)
							 | 
						|||
| 
								 | 
							
								                               select new { UserId = x.UserId, UserName = x.UserName };
							 | 
						|||
| 
								 | 
							
								                drpAudit.DataValueField = "UserId";
							 | 
						|||
| 
								 | 
							
								                drpAudit.DataTextField = "UserName";
							 | 
						|||
| 
								 | 
							
								                this.drpAudit.DataSource = userList.ToList();
							 | 
						|||
| 
								 | 
							
								                this.drpAudit.DataBind();
							 | 
						|||
| 
								 | 
							
								                 
							 | 
						|||
| 
								 | 
							
								                drpAudit2.DataValueField = "UserId";
							 | 
						|||
| 
								 | 
							
								                drpAudit2.DataTextField = "UserName";
							 | 
						|||
| 
								 | 
							
								                this.drpAudit2.DataSource = userList.ToList();
							 | 
						|||
| 
								 | 
							
								                this.drpAudit2.DataBind();
							 | 
						|||
| 
								 | 
							
								                ListItem[] lis = new ListItem[3];
							 | 
						|||
| 
								 | 
							
								                lis[0] = new ListItem("不通过", "不通过");//是 加载
							 | 
						|||
| 
								 | 
							
								                lis[1] = new ListItem("一次合格", "一次合格");//否加载
							 | 
						|||
| 
								 | 
							
								                lis[2] = new ListItem("二次合格", "二次合格");//否加载
							 | 
						|||
| 
								 | 
							
								                drpRes.DataTextField = "Text";
							 | 
						|||
| 
								 | 
							
								                drpRes.DataValueField = "Value";
							 | 
						|||
| 
								 | 
							
								                drpRes.DataSource = lis;
							 | 
						|||
| 
								 | 
							
								                drpRes.DataBind();
							 | 
						|||
| 
								 | 
							
								                Funs.FineUIPleaseSelect(drpRes);
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (unit == null || unit.UnitId == BLL.Const.UnitId_TCC)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    drpUnitId.Enabled = true;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    drpUnitId.SelectedValue = this.CurrUser.UnitId;
							 | 
						|||
| 
								 | 
							
								                    drpUnitId.Enabled = false;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                string welderId = Request.Params["welderId"];
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(welderId))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.hdWelderId.Text = welderId;
							 | 
						|||
| 
								 | 
							
								                    Model.BS_Welder_Entrance welder = BLL.WelderEntranceService.GetWelderById(this.hdWelderId.Text);
							 | 
						|||
| 
								 | 
							
								                    if (welder != null)
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        if (welder.Status == "2" && welder.Auditor == CurrUser.UserId)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            ContentPanel5.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                            this.btnSave.Text = "转办";
							 | 
						|||
| 
								 | 
							
								                            this.btnSave.ToolTip = "转办";
							 | 
						|||
| 
								 | 
							
								                            this.btnSave.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                            this.drpAudit.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                            this.drpAudit2.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        else if (welder.Status == "3")
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpRes.Hidden = false;
							 | 
						|||
| 
								 | 
							
								                            this.btnSubmit.Hidden = true;
							 | 
						|||
| 
								 | 
							
								                            this.drpAudit.Hidden = true;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(welder.WED_Unit))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpUnitId.SelectedValue = welder.WED_Unit;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        if (!string.IsNullOrEmpty(welder.Exam_Res))
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            this.drpRes.SelectedValue = welder.Exam_Res;
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        this.txtWED_Name.Text = welder.WED_Name;
							 | 
						|||
| 
								 | 
							
								                        this.txtWED_Code.Text = welder.WED_Code;
							 | 
						|||
| 
								 | 
							
								                        this.txtWorkCode.Text = welder.WED_WorkCode;
							 | 
						|||
| 
								 | 
							
								                        this.txtLimitDate.Text = welder.Limit_Date.HasValue ? string.Format("{0:yyyy-MM-dd}", welder.Limit_Date) : "";
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                        this.txtIdentityCard.Text = welder.IdentityCard;
							 | 
						|||
| 
								 | 
							
								                        this.txtSE_EquipmentID.Text = welder.SE_Equipment;
							 | 
						|||
| 
								 | 
							
								                        this.txtSE_Equipment_Apply.Text = welder.SE_Equipment_Apply;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								        protected void rblIsAgree_SelectedIndexChanged(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (rblIsAgree.SelectedValue.Equals("true"))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.txtWED_Code.Hidden = false;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.txtWED_Code.Hidden = true;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 附件上传
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 上传附件
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnAttachUrl_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            if (string.IsNullOrEmpty(this.hdWelderId.Text))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                this.hdWelderId.Text = SQLHelper.GetNewID(typeof(Model.BS_Welder));
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/HJGL/PersonManage/&menuId={1}", this.hdWelderId.Text, BLL.Const.HJGL_WelderManageMenuId)));
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								  
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        #region 保存
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 保存按钮
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSave_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {
							 | 
						|||
| 
								 | 
							
								            string welderId = Request.Params["welderId"];
							 | 
						|||
| 
								 | 
							
								            Model.BS_Welder_Entrance welder = new Model.BS_Welder_Entrance();
							 | 
						|||
| 
								 | 
							
								            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.WED_Unit = this.drpUnitId.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!this.drpAudit.Hidden)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Auditor = this.drpAudit.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }else if (!this.drpAudit2.Hidden)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Auditor = this.drpAudit2.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            welder.WED_Code = this.txtWED_Code.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.WED_Name = this.txtWED_Name.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.Limit_Date = Funs.GetNewDateTime(this.txtLimitDate.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            welder.WED_WorkCode = this.txtWorkCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								           
							 | 
						|||
| 
								 | 
							
								            welder.IdentityCard = this.txtIdentityCard.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.SE_Equipment = this.txtSE_EquipmentID.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.SE_Equipment_Apply = this.txtSE_Equipment_Apply.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								            if (drpRes.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Exam_Res = this.drpRes.SelectedText;
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(welderId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.WED_ID = welderId;
							 | 
						|||
| 
								 | 
							
								                var wed = BLL.WelderEntranceService.GetWelderById(welderId);
							 | 
						|||
| 
								 | 
							
								                string name = wed.WED_Name;
							 | 
						|||
| 
								 | 
							
								                string wedCode = wed.WED_Code;
							 | 
						|||
| 
								 | 
							
								            
							 | 
						|||
| 
								 | 
							
								                welder.Status = wed.Status;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                if (name != this.txtWED_Name.Text.Trim())
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (BLL.WelderEntranceService.IsExistWEDName(this.txtWED_Name.Text.Trim(), this.CurrUser.LoginProjectId))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Alert.ShowInTop("焊工姓名已存在!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtWED_Code.Text.Trim()) && wedCode != this.txtWED_Code.Text.Trim())
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (BLL.WelderEntranceService.IsExistWEDCode(this.txtWED_Code.Text.Trim(), this.CurrUser.LoginProjectId))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Alert.ShowInTop("焊工代号已存在!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                BLL.WelderEntranceService.UpdateBSWelder(welder);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Status="1";
							 | 
						|||
| 
								 | 
							
								                if (BLL.WelderEntranceService.IsExistWEDName(this.txtWED_Name.Text.Trim(), this.CurrUser.LoginProjectId ))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Alert.ShowInTop("焊工姓名已存在!", MessageBoxIcon.Warning);                   
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtWED_Code.Text.Trim()) && BLL.WelderEntranceService.IsExistWEDCode(this.txtWED_Code.Text.Trim(), this.CurrUser.LoginProjectId ))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Alert.ShowInTop("焊工代号已存在!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.hdWelderId.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    welder.WED_ID = this.hdWelderId.Text;
							 | 
						|||
| 
								 | 
							
								                }else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.hdWelderId.Text = SQLHelper.GetNewID(typeof(Model.BS_Welder));
							 | 
						|||
| 
								 | 
							
								                    welder.WED_ID = this.hdWelderId.Text;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                BLL.WelderEntranceService.AddBSWelder(welder);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            ShowNotify("保存成功!", MessageBoxIcon.Success);
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								        #endregion
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        /// <summary>
							 | 
						|||
| 
								 | 
							
								        /// 提交
							 | 
						|||
| 
								 | 
							
								        /// </summary>
							 | 
						|||
| 
								 | 
							
								        /// <param name="sender"></param>
							 | 
						|||
| 
								 | 
							
								        /// <param name="e"></param>
							 | 
						|||
| 
								 | 
							
								        protected void btnSubmit_Click(object sender, EventArgs e)
							 | 
						|||
| 
								 | 
							
								        {   string welderId = Request.Params["welderId"];
							 | 
						|||
| 
								 | 
							
								            Model.BS_Welder_Entrance welder = new Model.BS_Welder_Entrance();
							 | 
						|||
| 
								 | 
							
								            if (this.drpUnitId.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.WED_Unit = this.drpUnitId.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            if (!this.drpAudit.Hidden)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Auditor = this.drpAudit.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else if (!this.drpAudit2.Hidden)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Auditor = this.drpAudit2.SelectedValue;
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            welder.WED_Code = this.txtWED_Code.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.WED_Name = this.txtWED_Name.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.Limit_Date = Funs.GetNewDateTime(this.txtLimitDate.Text.Trim());
							 | 
						|||
| 
								 | 
							
								            welder.WED_WorkCode = this.txtWorkCode.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.Status = "2";
							 | 
						|||
| 
								 | 
							
								            welder.IdentityCard = this.txtIdentityCard.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.SE_Equipment = this.txtSE_EquipmentID.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.SE_Equipment_Apply = this.txtSE_Equipment_Apply.Text.Trim();
							 | 
						|||
| 
								 | 
							
								            welder.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (drpRes.SelectedValue != BLL.Const._Null)
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Exam_Res = this.drpRes.SelectedText;
							 | 
						|||
| 
								 | 
							
								                    
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								            if (!string.IsNullOrEmpty(welderId))
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.WED_ID = welderId;
							 | 
						|||
| 
								 | 
							
								                var wed = BLL.WelderEntranceService.GetWelderById(welderId);
							 | 
						|||
| 
								 | 
							
								                string name = wed.WED_Name;
							 | 
						|||
| 
								 | 
							
								                string wedCode = wed.WED_Code;
							 | 
						|||
| 
								 | 
							
								                if (wed.Status == "1")
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    welder.Status = "2";
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                else if (wed.Status == "2" && welder.Auditor == CurrUser.UserId)
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (rblIsAgree.SelectedValue.Equals("true"))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        welder.WED_Code = this.txtWED_Code.Text.Trim();
							 | 
						|||
| 
								 | 
							
								                        welder.Status = "3";
							 | 
						|||
| 
								 | 
							
								                        var bswelder = WelderService.GetWelderByCode(this.CurrUser.LoginProjectId,welder.WED_Code);
							 | 
						|||
| 
								 | 
							
								                        if (bswelder == null)
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            bswelder = new Model.BS_Welder();
							 | 
						|||
| 
								 | 
							
								                            bswelder.IdentityCard = welder.IdentityCard;
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_Unit = welder.WED_Unit;
							 | 
						|||
| 
								 | 
							
								                            bswelder.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_Name = welder.WED_Name;
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_ID = Guid.NewGuid().ToString();
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_Code = welder.WED_Code;
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_WorkCode = welder.WED_WorkCode;
							 | 
						|||
| 
								 | 
							
								                            bswelder.LimitDate = welder.Limit_Date;
							 | 
						|||
| 
								 | 
							
								                            WelderService.AddBSWelder(bswelder);
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								                        else
							 | 
						|||
| 
								 | 
							
								                        {
							 | 
						|||
| 
								 | 
							
								                            bswelder.IdentityCard = welder.IdentityCard;
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_Unit = welder.WED_Unit;
							 | 
						|||
| 
								 | 
							
								                            bswelder.ProjectId = this.CurrUser.LoginProjectId;
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_Name = welder.WED_Name;
							 | 
						|||
| 
								 | 
							
								                           // bswelder.WED_ID = Guid.NewGuid().ToString();
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_Code = welder.WED_Code;
							 | 
						|||
| 
								 | 
							
								                            bswelder.WED_WorkCode = welder.WED_WorkCode;
							 | 
						|||
| 
								 | 
							
								                            bswelder.LimitDate = welder.Limit_Date;
							 | 
						|||
| 
								 | 
							
								                            WelderService.UpdateBSWelder(bswelder);
							 | 
						|||
| 
								 | 
							
								                        }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                    else
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        welder.Status = "0";
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								                } 
							 | 
						|||
| 
								 | 
							
								                if (name != this.txtWED_Name.Text.Trim())
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (BLL.WelderEntranceService.IsExistWEDName(this.txtWED_Name.Text.Trim(), this.CurrUser.LoginProjectId))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Alert.ShowInTop("焊工姓名已存在!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (wedCode != this.txtWED_Code.Text.Trim())
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    if (!string.IsNullOrEmpty(this.txtWED_Code.Text.Trim()) && BLL.WelderEntranceService.IsExistWEDCode(this.txtWED_Code.Text.Trim(), this.CurrUser.LoginProjectId))
							 | 
						|||
| 
								 | 
							
								                    {
							 | 
						|||
| 
								 | 
							
								                        Alert.ShowInTop("焊工代号已存在!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                        return;
							 | 
						|||
| 
								 | 
							
								                    }
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                BLL.WelderEntranceService.UpdateBSWelder(welder);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            else
							 | 
						|||
| 
								 | 
							
								            {
							 | 
						|||
| 
								 | 
							
								                welder.Status = "2";
							 | 
						|||
| 
								 | 
							
								                if (BLL.WelderEntranceService.IsExistWEDName(this.txtWED_Name.Text.Trim(), this.CurrUser.LoginProjectId ))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Alert.ShowInTop("焊工姓名已存在!", MessageBoxIcon.Warning);                   
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.txtWED_Code.Text.Trim()) && BLL.WelderEntranceService.IsExistWEDCode(this.txtWED_Code.Text.Trim(), this.CurrUser.LoginProjectId ))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    Alert.ShowInTop("焊工代号已存在!", MessageBoxIcon.Warning);
							 | 
						|||
| 
								 | 
							
								                    return;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                if (!string.IsNullOrEmpty(this.hdWelderId.Text.Trim()))
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    welder.WED_ID = this.hdWelderId.Text;
							 | 
						|||
| 
								 | 
							
								                }else
							 | 
						|||
| 
								 | 
							
								                {
							 | 
						|||
| 
								 | 
							
								                    this.hdWelderId.Text = SQLHelper.GetNewID(typeof(Model.BS_Welder));
							 | 
						|||
| 
								 | 
							
								                    welder.WED_ID = this.hdWelderId.Text;
							 | 
						|||
| 
								 | 
							
								                }
							 | 
						|||
| 
								 | 
							
								                BLL.WelderEntranceService.AddBSWelder(welder);
							 | 
						|||
| 
								 | 
							
								            }
							 | 
						|||
| 
								 | 
							
								            ShowNotify("保存成功!", MessageBoxIcon.Success);
							 | 
						|||
| 
								 | 
							
								            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
							 | 
						|||
| 
								 | 
							
								
							 | 
						|||
| 
								 | 
							
								        }
							 | 
						|||
| 
								 | 
							
								    }
							 | 
						|||
| 
								 | 
							
								}
							 |