| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  | 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.Personal | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class PersonalInfo : PageBase | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 定义变量 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 照片附件路径 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public string PhotoAttachUrl | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (string)ViewState["PhotoAttachUrl"]; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ViewState["PhotoAttachUrl"] = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 加载页面 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void Page_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsPostBack) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 /// Tab1加载页面方法 | 
					
						
							|  |  |  |  |                 this.Tab1LoadData(); | 
					
						
							| 
									
										
										
										
											2022-04-24 18:29:54 +08:00
										 |  |  |  |                 if (this.CurrUser.UserId == Const.hfnbdId) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.btnCustomQuery.Hidden = false; | 
					
						
							| 
									
										
										
										
											2022-05-07 15:12:59 +08:00
										 |  |  |  |                     this.lbSystemVersion.Hidden = false; | 
					
						
							|  |  |  |  |                     this.lbSystemVersion.Text = Funs.SystemVersion; | 
					
						
							| 
									
										
										
										
											2022-07-26 13:51:21 +08:00
										 |  |  |  |                     this.btnPassRefresh.Hidden = false; | 
					
						
							| 
									
										
										
										
											2022-04-24 18:29:54 +08:00
										 |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2022-07-26 13:51:21 +08:00
										 |  |  |  |                 if (this.CurrUser.UserId == Const.sysglyId) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.lbSystemVersion.Hidden = false; | 
					
						
							|  |  |  |  |                     this.lbSystemVersion.Text = Funs.SystemVersion; | 
					
						
							|  |  |  |  |                     this.btnPassRefresh.Hidden = false; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region Tab1 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// Tab1加载页面方法 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         private void Tab1LoadData() | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2021-09-17 16:04:52 +08:00
										 |  |  |  |             var user = Funs.DB.Sys_User.FirstOrDefault(x => x.UserId == this.CurrUser.UserId); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |             if (user != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 this.txtUserName.Text = user.UserName; | 
					
						
							|  |  |  |  |                 this.txtUserCode.Text = user.UserCode; | 
					
						
							|  |  |  |  |                 var sexVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0002).FirstOrDefault(x => x.ConstValue == user.Sex); | 
					
						
							|  |  |  |  |                 if (sexVules != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.drpSex.Text = sexVules.ConstText; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 this.dpBirthDay.Text = string.Format("{0:yyyy-MM-dd}", user.BirthDay); | 
					
						
							|  |  |  |  |                 var MarriageVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0003).FirstOrDefault(x => x.ConstValue == user.Marriage); | 
					
						
							|  |  |  |  |                 if (MarriageVules != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.drpMarriage.Text = MarriageVules.ConstText; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 var NationVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0005).FirstOrDefault(x => x.ConstValue == user.Nation); | 
					
						
							|  |  |  |  |                 if (NationVules != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.drpNation.Text = NationVules.ConstText; | 
					
						
							|  |  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2021-09-17 16:04:52 +08:00
										 |  |  |  |                 var units = Funs.DB.Base_Unit.FirstOrDefault(x => x.UnitId == user.UnitId); | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |                 if (units != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.drpUnit.Text = units.UnitName; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 this.txtAccount.Text = user.Account; | 
					
						
							|  |  |  |  |                 this.txtIdentityCard.Text = user.IdentityCard; | 
					
						
							|  |  |  |  |                 this.txtEmail.Text = user.Email; | 
					
						
							|  |  |  |  |                 this.txtTelephone.Text = user.Telephone; | 
					
						
							|  |  |  |  |                 var EducationVules = BLL.ConstValue.drpConstItemList(ConstValue.Group_0004).FirstOrDefault(x => x.ConstValue == user.Education); | 
					
						
							|  |  |  |  |                 if (EducationVules != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.drpEducation.Text = EducationVules.ConstText; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 this.txtHometown.Text = user.Hometown; | 
					
						
							|  |  |  |  |                 //var position = BLL.PositionService.GetPositionById(user.PositionId); | 
					
						
							|  |  |  |  |                 //if (position != null) | 
					
						
							|  |  |  |  |                 //{ | 
					
						
							|  |  |  |  |                 //    this.drpPosition.Text = position.PositionName; | 
					
						
							|  |  |  |  |                 //} | 
					
						
							|  |  |  |  |                 this.txtPerformance.Text = user.Performance; | 
					
						
							|  |  |  |  |                 if (!string.IsNullOrEmpty(user.PhotoUrl)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     this.PhotoAttachUrl = user.PhotoUrl; | 
					
						
							|  |  |  |  |                     this.Image1.ImageUrl = "~/" + this.PhotoAttachUrl; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-09-17 16:04:52 +08:00
										 |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 保存按钮 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnSave_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var q = Funs.DB.Sys_User.FirstOrDefault(x => x.Account == this.txtAccount.Text.Trim() && (x.UserId != this.CurrUser.UserId || (this.CurrUser.UserId == null && x.UserId != null))); | 
					
						
							|  |  |  |  |             if (q != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Alert.ShowInParent("输入的账号已存在!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.txtUserCode.Text)) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 var q2 = Funs.DB.Sys_User.FirstOrDefault(x => x.UserCode == this.txtUserCode.Text.Trim() && (x.UserId != this.CurrUser.UserId || (this.CurrUser.UserId == null && x.UserId != null))); | 
					
						
							|  |  |  |  |                 if (q2 != null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     Alert.ShowInParent("输入的编号已存在!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                     return; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(this.txtIdentityCard.Text) && BLL.UserService.IsExistUserIdentityCard(this.CurrUser.UserId, this.txtIdentityCard.Text.Trim()) == true) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Alert.ShowInParent("输入的身份证号码已存在!", MessageBoxIcon.Warning); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             Model.Sys_User newUser = new Model.Sys_User | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 UserCode = this.txtUserCode.Text.Trim(), | 
					
						
							|  |  |  |  |                 UserName = this.txtUserName.Text.Trim(), | 
					
						
							|  |  |  |  |                 Account = this.txtAccount.Text.Trim(), | 
					
						
							|  |  |  |  |                 IdentityCard = this.txtIdentityCard.Text.Trim(), | 
					
						
							|  |  |  |  |                 Email = this.txtEmail.Text.Trim(), | 
					
						
							|  |  |  |  |                 Telephone = this.txtTelephone.Text.Trim(), | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             newUser.UserId = this.CurrUser.UserId; | 
					
						
							|  |  |  |  |             UserService.UpdateUserInfo(newUser); | 
					
						
							|  |  |  |  |             Alert.ShowInParent("保存成功!", MessageBoxIcon.Success); | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-04-24 18:29:54 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         protected void btnCustomQuery_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("../SysManage/CustomQuery.aspx"), "查询")); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2022-07-26 13:51:21 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         ///  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="sender"></param> | 
					
						
							|  |  |  |  |         /// <param name="e"></param> | 
					
						
							|  |  |  |  |         protected void btnPassRefresh_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var getUsers = from x in Funs.DB.Sys_User | 
					
						
							|  |  |  |  |                            where x.RawPassword == null | 
					
						
							|  |  |  |  |                            select x; | 
					
						
							|  |  |  |  |             foreach (var item in getUsers) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 string password = Funs.getInitialPassword(item.UnitId, item.IdentityCard); | 
					
						
							|  |  |  |  |                 UserService.UpdatePassword(item.UserId, password); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             var getPersons = from x in Funs.DB.SitePerson_Person | 
					
						
							|  |  |  |  |                              where  x.RawPassword == null | 
					
						
							|  |  |  |  |                              select x; | 
					
						
							|  |  |  |  |             foreach (var item in getPersons) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 string password = Funs.getInitialPassword(item.UnitId, item.IdentityCard); | 
					
						
							|  |  |  |  |                 PersonService.UpdateSitePersonPassword(item.PersonId, password); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             ShowNotify("重置成功!", MessageBoxIcon.Success); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2021-04-30 10:28:37 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } |