private void roundedButton1_Click(object sender, EventArgs e) { UsersBusinesscs userBusiness = new UsersBusinesscs(); if (!userBusiness.UserExists(this.txtLoginName.Text)) { MessageBox.Show("此用户名不存在", "用户登录"); return; } if (!userBusiness.PasswordExists(this.textBoxPwd.SkinTxt.Text)) { MessageBox.Show("此密码不正确", "用户登录"); return; } if (!userBusiness.Exists(this.txtLoginName.Text, this.textBoxPwd.SkinTxt.Text)) { MessageBox.Show("此用户名或密码错误", "用户登录"); return; } UserInfo.LoginName = txtLoginName.Text; new MainForm().ShowDialog(); }
private void btnLogin_Click(object sender, System.EventArgs e) { UsersBusinesscs users = new UsersBusinesscs(); //DataTable dt = null; bool isLogin = users.Exists(this.txtLoginName.Text, this.textBoxPwd.Text); if (isLogin) { UserInfo.LoginName = txtLoginName.Text; this.DialogResult = DialogResult.OK; this.Close(); } else { this.Hide(); // 提示 if (MessageBox.Show("对不起,用户名和密码不匹配,请重新输入!", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Warning) == System.Windows.Forms.DialogResult.OK) { this.Show(); txtLoginName.Focus(); } } }