private void bt_register_Click(object sender, EventArgs e) { if (!tb_username.Text.Equals("") && !tb_pwd.Equals("") && !tb_repwd.Equals("")) { if (tb_pwd.Text.Equals(tb_repwd.Text)) { AdminInfo admin = new AdminInfo(); admin.UserName = tb_username.Text; admin.PassWord = tb_pwd.Text; bool isInsert = AdminInfoManage.InsertAdmin(admin); if (!isInsert) { MessageBox.Show("该用户已存在!请重新注册!"); } else { this.DialogResult = System.Windows.Forms.DialogResult.OK; MessageBox.Show("恭喜您成为新用户!"); } } else { MessageBox.Show("请保持密码一致!"); } } else { MessageBox.Show("请输入有效信息!"); } }
public void LoginSysTem() { if (txt_name.Text == "") { MessageBox.Show("请输入用户名", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txt_pwd.Text == "") { MessageBox.Show("请输入密码", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txt_yanzhengma.Text == lbl_yzm.Text) { //实例化Admininfo对象 AdminInfo ai = new AdminInfo(); ai.UserName = txt_name.Text; //ai.PassWord = GetMD5String(jiami(txt_pwd.Text)); ai.PassWord = txt_pwd.Text; //执行查询,验证登陆账号密码 AdminInfo msg = AdminInfoManage.SelectAdminInfo(ai); if (msg != null) { MainForm fm = new MainForm(); ////fm.lbl_admin.Text = txt_name.Text; ////fm.quanxian = msg.IsSysAdmin; Common.Username = msg.UserName; Common.Pwd = msg.PassWord; fm.Show(); MessageBox.Show("登陆成功"); notifyIcon1.Visible = false; this.Visible = false; } else { txt_name.Text = ""; txt_pwd.Text = ""; txt_yanzhengma.Text = ""; yanzhengma(); MessageBox.Show("用户名或密码错误", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { txt_yanzhengma.Text = ""; yanzhengma(); MessageBox.Show("验证码错误", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void LoginSysTem() { if (txt_name.Text == "") { MessageBox.Show("请输入用户名", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txt_pwd.Text == "") { MessageBox.Show("请输入密码", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txt_yanzhengma.Text == lbl_yzm.Text) { //实例化Admininfo对象 AdminInfo ai = new AdminInfo(); ai.UserName = txt_name.Text; ai.PassWord = txt_pwd.Text; //执行查询,验证登陆账号密码 AdminInfo msg = AdminInfoManage.SelectAdminInfo(ai); if (msg != null) { frmMain fm = new frmMain(ai.UserName, ai.PassWord); //Common.Username = msg.UserName; Common.Username = "******"; Common.Pwd = ""; //Common.Pwd = msg.PassWord; fm.Show(); MessageBox.Show("登陆成功"); notifyIcon1.Visible = false; this.Visible = false; } else { txt_name.Text = ""; txt_pwd.Text = ""; txt_yanzhengma.Text = ""; yanzhengma(); MessageBox.Show("用户名或密码错误", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { txt_yanzhengma.Text = ""; yanzhengma(); MessageBox.Show("验证码错误", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 清空输入框,并注册 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { AdminInfo admin = new AdminInfo(); admin.UserName = txt_name.Text; admin.PassWord = txt_pwd.Text; bool isInsert = AdminInfoManage.InsertAdmin(admin); if (isInsert) { MessageBox.Show("恭喜您成为新用户!"); MainForm mfm = new MainForm(); mfm.Show(); this.Visible = false; } else { MessageBox.Show("该用户已存在,请重新填写信息"); } txt_name.Text = ""; txt_pwd.Text = ""; }