/// <summary> /// 登陆按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { try { string username = txtuser.Text.Trim(); string pwd = txtpwd.Text.Trim(); string qx = comboBox1.SelectedIndex.ToString(); //0 普通用户 1管理员 if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(pwd)) { MessageBox.Show("请输入用户或密码"); } if (userInfobll.IsLoginSucces(username, Common.GetMD532(pwd, ""), qx)) { this.DialogResult = DialogResult.OK; this.UserName = username; this.Qx = qx; Common.Add(username, "登陆成功"); } else { MessageBox.Show("登陆失败,请核对信息!"); } } catch (Exception) { MessageBox.Show("登陆异常!"); } }