/// <summary> /// 给控件赋值 /// </summary> private void SetData() { BLL.T_Users_BLL userBLL = new T_Users_BLL(); MDL.T_Users users = userBLL.Find(this.userid); this.txtLogin.Text = users.login; this.txtpasswd.Text = HandlePwd.Decrypt(users.password); this.txtpasswd2.Text = HandlePwd.Decrypt(users.password); this.txtFullname.Text = users.fullname; this.txtTitle.Text = users.title; this.txtphone.Text = users.phone; this.cmbUnits.Text = users.units; this.cmbUnitsType.Text = users.unitstype; }
/// <summary> /// 验证数据必填项 /// </summary> /// <returns></returns> private bool ValidatorData() { if (this.txtUserLogin.Text.Trim() == "") { TXMessageBoxExtensions.Info(SystemTips.MSG_USERID_NOTNULL, SystemTips.MSG_TITLE);//用户ID不能为空 this.txtUserLogin.Focus(); return(false); } if (this.txtOldPasswd.Text.Trim() == "") { TXMessageBoxExtensions.Info(SystemTips.MSG_USERPWD_NOTNULL, SystemTips.MSG_TITLE);//用户名不能为空 this.txtOldPasswd.Focus(); return(false); } if (this.txtNewPasswd.Text.Trim() == "") { TXMessageBoxExtensions.Info("新密码不能为空", SystemTips.MSG_TITLE);//用户全名不能为空 this.txtNewPasswd.Focus(); return(false); } if (this.txtNewPasswd.Text.Trim() != txtConfrmPasswd.Text.Trim()) { TXMessageBoxExtensions.Info("确认密码与新密码不相符,请重新输入确认密码", SystemTips.MSG_TITLE);//请选择用户风格 this.txtConfrmPasswd.Focus(); return(false); } BLL.T_Users_BLL bll1 = new ERM.BLL.T_Users_BLL(); MDL.T_Users mdl1 = bll1.Find(Globals.UserID); if (HandlePwd.Decrypt(mdl1.password) != this.txtOldPasswd.Text.Trim()) { TXMessageBoxExtensions.Info("原密码错误,不可以修改!", SystemTips.MSG_TITLE);//请选择用户风格 this.txtConfrmPasswd.Focus(); return(false); } return(true); }
/// <summary> /// 登录时触发的事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { if (MyCommon.IsCheckFD()) { #region KEY 验证操作 //USBKey usbkey = new USBKey(); //if (!usbkey.CheckUSB()) //{ // TXMessageBoxExtensions.Info("UKey校验失败,请插入加密锁后,再进行操作! \n 【温馨提示:如有疑问请与我们联系,0755-83995038】", "信息提示", // MessageBoxButtons.OK, MessageBoxIcon.Error); // return; //} string DoResult = ERM.UI.WriteDog.DoReader(); if (DoResult != "") { USBKey usbkey = new USBKey(); if (!usbkey.CheckUSB()) { //if (!ERM.UI.FDKey.CheckUserKey()) //{ TXMessageBoxExtensions.Info("UKey校验失败,请插入加密锁后,再进行操作! \n 【温馨提示:如有疑问请与我们联系,0755-83995038】", "信息提示"); return; //} } } #endregion } if (cboLogin.SelectedValue == null || txtPasswd.Text == null || cboLogin.SelectedValue.ToString().Trim() == "" || txtPasswd.Text.Trim() == "")//不能为空的处理 { TXMessageBoxExtensions.Info("用户名或密码不能为空,请重新输入!"); txtPasswd.Focus(); return; } else//验证密码 { int userid = Convert.ToInt32(this.cboLogin.SelectedValue.ToString()); string pwd = this.txtPasswd.Text.Trim(); int i111 = (new BLL.T_Users_BLL()).GetCount(); MDL.T_Users users = (new BLL.T_Users_BLL()).Find(userid); if (pwd == HandlePwd.Decrypt(users.password))//解密之后 进行密码较验 { Globals.UserID = userid; Globals.SH = users.sh; Globals.Theme = users.theme; Globals.Password = users.password;//加密的密码 用户修改密码用到 Globals.LoginUser = users.login; Globals.Fullname = users.fullname; Globals.CompanyTitle = users.units; this.DialogResult = DialogResult.OK; } else { TXMessageBoxExtensions.Info("密码错误,请重新输入!"); txtPasswd.Text = ""; txtPasswd.Focus(); return; } } }