private void btn_ModiPwd_Click(object sender, EventArgs e) { if (this.tbx_OldPwd.Text.Trim() == "") { MessageBox.Show("请输入用户原密码", "修改密码", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (this.tbx_NewPwd.Text.Trim() == "") { MessageBox.Show("请输入新密码", "修改密码", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (this.tbx_NewPwd.Text.Trim() != this.tbx_ConfirmNewPwd.Text.Trim()) { MessageBox.Show("两次密码输入不一致", "修改密码", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { User user = new User(); if (user.UserLogin(User.UserName, this.tbx_OldPwd.Text.Trim()) == 1) { if (user.ModiPwd(this.tbx_NewPwd.Text.Trim())) { MessageBox.Show("密码修改成功", "修改密码", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } } else { MessageBox.Show("用户原密码错误", "修改密码", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } }
private void LoginButton_Click(object sender, System.EventArgs e) { User user = new User(); string userno=this.txt_Name.Text.Trim(); if (userno == "") { MessageBox.Show("�������û���������Ϣ", "ϵͳ��¼", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { switch (user.UserLogin(userno, this.textBox1.Text.Trim())) { case -2: MessageBox.Show("�û�������,�������������", "ϵͳ��¼", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.txt_Name.Focus(); return; case -1: MessageBox.Show("�û��������", "ϵͳ��¼", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.textBox1.Focus(); return; } PSWD pswd = PSWD.GetById("0000", userno); LoginUser lguser = new LoginUser(pswd); AttnObjects.PSWD.LoginUser = pswd; LoginService.LoginUser = lguser; SetQxMod(); if (isLogin) { WorkbenchSingleton.Workbench.RedrawAllComponents(); } this.DialogResult = DialogResult.OK; isLogin = true; PropertyService.Set<string>("PrvLoginName", userno); this.DialogResult = DialogResult.OK; } }
private void OK_Click(object sender, EventArgs e) { User user = new User(); if ((this.tbxUserName.Text.Trim() == "") || (this.tbxPassword.Text.Trim() == "")) { MessageBox.Show("请输入用户的完整信息", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { switch (user.UserLogin(this.tbxUserName.Text.Trim(), this.tbxPassword.Text.Trim())) { case -2: MessageBox.Show("用户不存在,请检查后重新输入", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.tbxUserName.Focus(); return; case -1: MessageBox.Show("用户密码错误", "系统登录", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); this.tbxPassword.Focus(); return; } base.Hide(); new Frm_Main().Show(); } }