private void btnOK_Click(object sender, EventArgs e) { if (this.textBox1.Text.Trim() != FrmMain.localinfo.user.Pass) { MessageBox.Show("旧密码不对!"); this.textBox1.Focus(); this.textBox1.SelectAll(); } else { this.textBox2.Focus(); this.textBox2.SelectAll(); if (this.textBox2.Text.Trim() == "") { MessageBox.Show("新密码不能为空!"); this.textBox2.Focus(); this.textBox2.SelectAll(); } else { this.textBox3.Focus(); this.textBox3.SelectAll(); if (this.textBox2.Text.Trim() != this.textBox3.Text.Trim()) { MessageBox.Show("新密码不一致!"); this.textBox3.Focus(); this.textBox3.SelectAll(); } else { VehIC_WF.AuthService.AuthService service = new VehIC_WF.AuthService.AuthService(); service.Url = "http://" + FrmMain.localinfo.ServerUrl + "/VehIC_WS/AuthService.asmx"; if (service.ChangePassword(LocalInfo.Current.user.ID, this.textBox3.Text.Trim()) != 1) { MessageBox.Show("操作失败!请重试!"); } else { MessageBox.Show("操作成功!"); FrmMain.localinfo.user.Pass = this.textBox2.Text.Trim(); base.Close(); } } } } }
public void Login() { string uid = this.textBox1.Text.Trim(); string str2 = this.textBox2.Text.Trim(); if (uid == string.Empty) { MessageBox.Show("用户ID不允许为空!"); this.textBox1.SelectAll(); this.textBox1.Focus(); } else if (str2 == string.Empty) { MessageBox.Show("用户密码不允许为空!"); this.textBox2.SelectAll(); this.textBox2.Focus(); } else if (FrmMain.localinfo.ISLocked) { if (uid != LocalInfo.Current.user.ID) { MessageBox.Show("用户名错误!"); } else if (FrmMain.localinfo.user.Pass != str2) { MessageBox.Show("用户密码不对!"); } else { base.DialogResult = DialogResult.OK; base.Close(); } } else { VehIC_WF.AuthService.AuthService service = new VehIC_WF.AuthService.AuthService(); service.Url = "http://" + FrmMain.localinfo.ServerUrl + "/VehIC_WS/AuthService.asmx"; VehIC_WF.AuthService.UserInfo userInfo = service.GetUserInfo(uid); if (userInfo == null) { MessageBox.Show("不存在此用户!"); } else if (userInfo.PassWord != str2) { MessageBox.Show("用户密码不对!"); } else if (!userInfo.Enable) { MessageBox.Show("此用户已经被禁用!"); } else { FrmMain.localinfo.user = new VehIC_WF.UserInfo(); FrmMain.localinfo.user.authority = new AuthorityList(userInfo.authoritylist); FrmMain.localinfo.user.workpointlist = new WorkPointList(userInfo.workpointlist); FrmMain.localinfo.user.Dept = userInfo.Dept; FrmMain.localinfo.user.Enable = userInfo.Enable; FrmMain.localinfo.user.ICCardID = userInfo.ICCardID; FrmMain.localinfo.user.ICCardNo = userInfo.ICCardNo; FrmMain.localinfo.user.ICCardStatus = userInfo.ICCardStatus; LocalInfo.Current.user.ID = userInfo.ID; FrmMain.localinfo.user.Name = userInfo.Name; FrmMain.localinfo.user.Pass = userInfo.PassWord; base.DialogResult = DialogResult.OK; base.Close(); } } }