private void btnOk_Click(object sender, EventArgs e) { if (this.txtUser.Text.Trim().Length <= 0 || this.txtPwd.Text.Trim().Length <= 0) { MessageBox.Show("用户或密码不正确!"); this.txtUser.Focus(); return; } if (!T_Sysset.IsCheckUser(this.txtUser.Text.Trim(), this.txtPwd.Text.Trim())) { MessageBox.Show("用户或密码不正确!"); this.txtUser.Focus(); return; } if (!Setusersys()) { txtUser.Focus(); return; } try { FrmMain fmMain = new FrmMain(); this.Hide(); Wirteini(); fmMain.ShowDialog(); } catch { Application.Exit(); } }
private bool istxt() { if (txtOldpwd.Text.Trim().Length <= 0) { MessageBox.Show("请输入旧密码!"); txtOldpwd.Focus(); return(false); } if (txtNewPwd.Text.Trim().Length <= 0 || txtNewPwd2.Text.Trim().Length <= 0) { MessageBox.Show("请输入新密码或重复新密码!"); txtNewPwd.Focus(); return(false); } else { if (txtNewPwd.Text.Trim() != txtNewPwd2.Text.Trim()) { MessageBox.Show("两次密码不一致!"); txtNewPwd.Focus(); return(false); } } if (!T_Sysset.IsCheckUser(T_User.LoginName, txtOldpwd.Text.Trim())) { MessageBox.Show("旧密码不正确!"); txtOldpwd.Focus(); return(false); } return(true); }
private bool isuser(int user) { bool tf = true; if (txtUser.Text.Trim().Length <= 0) { MessageBox.Show("请输入用户名!"); txtUser.Focus(); tf = false; } if (user == 0) { if (txtPwd.Text.Trim().Length <= 0 || txtPwd2.Text.Trim().Length <= 0) { MessageBox.Show("请输入密码!"); txtPwd.Focus(); tf = false; } else { if (txtPwd.Text.Trim() != txtPwd2.Text.Trim()) { MessageBox.Show("两次密码不一致!"); tf = false; } } if (T_Sysset.IsCheckUser(txtUser.Text.Trim())) { MessageBox.Show("用户已存在!"); txtUser.Focus(); tf = false; } } else { if (!T_Sysset.IsCheckUser(txtUser.Text.Trim())) { MessageBox.Show("用户不存在!"); txtUser.Focus(); tf = false; } } if (txtTime.Text.Trim().Length <= 0) { MessageBox.Show("请输入入职时间!"); txtTime.Focus(); tf = false; } return(tf); }