Example #1
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Users u = new Users();

            u.UserName = txtUser.Text.Trim();
            u.Password = ToMD5(txtPassword.Text.Trim());
            if (DBOption.readDBPro(u) > 0)
            {
                frmMain frmmain1 = new frmMain();
                frmmain1.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("用户名或密码错误!");
            }
        }
Example #2
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (txtPassword.Text.Trim() != txtPassword2.Text.Trim())
            {
                MessageBox.Show("两次密码输入不一致!");
                return;
            }
            Users u = new Users();

            u.UserName = txtUser.Text.Trim();
            u.Password = ToMD5(txtPassword.Text.Trim());
            if (DBOption.writeDBPro(u) > 0)
            {
                MessageBox.Show("注册成功!");
                frmLogin l = new frmLogin();
                l.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("注册失败!");
            }
        }