コード例 #1
0
        private void btnDangky_Click(object sender, EventArgs e)
        {
            User_BUS ub = new User_BUS();

            try
            {
                if (txtNhaplai.Text == txtMatkhau.Text)
                {
                    ub.insertUser(txtTaikhoan.Text, txtMatkhau.Text, txtMaNv.Text);
                    MessageBox.Show("Đăng ký tài khoản thành công !");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Mật khẩu nhập lại không đúng !");
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Bạn nhập sai cú pháp !");
            }

            catch (SqlException)
            {
                MessageBox.Show("Lỗi kết nối CSDL!");
            }
        }
コード例 #2
0
ファイル: DangKy.cs プロジェクト: phuoctai1703/Quanlynhansu
        private void btnDangky_Click(object sender, EventArgs e)
        {
            User_BUS ub = new User_BUS();

            StringBuilder s   = new StringBuilder(txtMatkhau.Text);
            StringBuilder s1  = new StringBuilder(txtNhaplai.Text);
            string        key = "daylachuoimahoa";

            vegeMahoa(ref s, key);
            vegeMahoa(ref s1, key);
            txtMatkhau.Text = Convert.ToString(s);
            txtNhaplai.Text = Convert.ToString(s1);
            try
            {
                if (txtNhaplai.Text == txtMatkhau.Text)
                {
                    String chucvu = "nhanvien";
                    ub.insertUser(txtTaikhoan.Text, txtMatkhau.Text, txtMaNv.Text, chucvu);
                    MessageBox.Show("Đăng ký tài khoản thành công !");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Mật khẩu nhập lại không đúng !");
                }
            }
            catch (FormatException)
            {
                MessageBox.Show("Bạn nhập sai cú pháp !");
            }
            catch (SqlException)
            {
                MessageBox.Show("Lỗi kết nối CSDL!");
            }
        }