//授权认证 //根据登陆有授权权限的账号,登陆成功即为授权成功! public void Accredit() { bool _isOK = false; try { if (this.tbox_Name.Text.Length == 0) { MessageBox.Show("请输入用户名", Gattr.AppTitle); return; } if (this.tbox_PWD.Text.Length == 0 && this.tbox_Name.Text.Length == 4) { this.tbox_PWD.Focus(); return; } if (this.tbox_PWD.Text.Length == 0) { MessageBox.Show("请输入密码", Gattr.AppTitle); return; } t_operator _oper = Gattr.Bll.GetOperatorInfo(this.tbox_Name.Text.Trim(), SecurityUtility.Instance.GetMD5Hash(this.tbox_PWD.Text.Trim()), Gattr.BranchNo); if (_oper != null) { _isOK = true; if (Gattr.Bll.SetOperatorLoginTime(_oper.oper_id, DateTime.Now) > 0) { if (SetIsOKEvent != null) { SetIsOKEvent(_isOK); } DialogResult = DialogResult.OK; LoggerHelper.Log("MsmkLogger", this.tbox_Name.Text + "为" + Gattr.OperId + "进行授权!", LogEnum.SysLog); } } else { this.tbox_PWD.Text = ""; this.tbox_PWD.Focus(); MessageBox.Show("用户名或密码错误", Gattr.AppTitle); } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", "FrmSQ--->Accredit()-->Error:" + ex.ToString(), LogEnum.ExceptionLog); } }
private void btnOk_Click(object sender, EventArgs e) { try { if (this.tbNewPwd.Text.Trim() != this.tbReNewPwd.Text.Trim()) { MessageBox.Show("两次密码不一致!!!", Gattr.AppTitle); } _oper = Gattr.Bll.GetOperatorInfo(Gattr.OperId, SecurityUtility.Instance.GetMD5Hash(this.tbOldPwd.Text.Trim()), Gattr.BranchNo); if (_oper != null) { if (Gattr.Bll.UpdateOperPwd(_oper.oper_id, SecurityUtility.Instance.GetMD5Hash(this.tbNewPwd.Text.Trim())) > 0) { Gattr.Oper_Pwd = SecurityUtility.Instance.GetMD5Hash(this.tbNewPwd.Text.Trim()); Dictionary <string, object> _dic = Gfunc.GetServiceParameter(); _dic.Add("operId", Gattr.OperId); _dic.Add("pwd", Gattr.Oper_Pwd); bool isok1 = true; string errorMessage = string.Empty; string result = PServiceProvider.Instance.InvokeMethod(Gattr.serverUrl + "/UpdateOperPwd", _dic, ref isok1, ref errorMessage); if (result == "1") { this._updateStatus = true; MessageBox.Show("修改密码成功!!!", Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", System.DateTime.Now.ToString() + Gattr.OperId + "修改密码成功!", LogEnum.SysLog); this.DialogResult = DialogResult.OK; } else { MessageBox.Show("密码修改失败!!!", Gattr.AppTitle); LoggerHelper.Log("MsmkLogger", System.DateTime.Now.ToString() + Gattr.OperId + "修改密码失败!", LogEnum.SysLog); } } } else { MessageBox.Show("原密码错误!!!", Gattr.AppTitle); } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", "FrmUpatePwd--->btnOk_Click-->Error:" + ex.ToString(), LogEnum.ExceptionLog); } }
/// <summary> /// 登录按钮事件逻辑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOk_Click(object sender, EventArgs e) { try { if (this.tbUserName.Text.Length == 0) { MessageBox.Show("请输入用户名", Gattr.AppTitle); return; } if (this.tbPwd.Text.Length == 0 && this.tbUserName.Text.Length == 4) { this.tbPwd.Focus(); return; } if (this.tbPwd.Text.Length == 0) { MessageBox.Show("请输入密码", Gattr.AppTitle); return; } _oper = Gattr.Bll.GetOperatorInfo(this.tbUserName.Text.Trim(), SecurityUtility.Instance.GetMD5Hash(this.tbPwd.Text.Trim()), Gattr.BranchNo); if (_oper != null) { if (Gattr.Bll.SetOperatorLoginTime(_oper.oper_id, DateTime.Now) > 0) { Gattr.Oper_Pwd = _oper.oper_pwd; this.iniSysInfo(true); LoggerHelper.Log("MsmkLogger", System.DateTime.Now.ToString() + this.tbUserName.Text + "登陆成功!", LogEnum.SysLog); } } else { this.tbUserName.Text = ""; this.tbPwd.Text = ""; this.tbUserName.Focus(); MessageBox.Show("用户名或密码错误", Gattr.AppTitle); } } catch (Exception ex) { LoggerHelper.Log("MsmkLogger", "FrmLogin--->btnOk_Click-->Error:" + ex.ToString(), LogEnum.ExceptionLog); } }