Beispiel #1
0
        private void ht_dn_Click(object sender, EventArgs e)
        {
            dangnhap f = new dangnhap();

            f.Show();
            this.Hide();
        }
Beispiel #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            dangnhap d = new dangnhap();

            d.Show();
            this.Hide();
        }
Beispiel #3
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         string pass   = textBox2.Text;
         string repass = textBox3.Text;
         if (pass.Equals(repass))
         {
             string sql = "select count(*) from tkad where tk=N'" + textBox1.Text + "'";
             if (textBox1.Text.Trim().Equals(""))
             {
                 MessageBox.Show("Bạn Chưa Nhập Tên Người Dùng!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else if (textBox2.Text.Trim().Equals(""))
             {
                 MessageBox.Show("Bạn Chưa Nhập Mật Khẩu!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
             }
             else
             {
                 int i = (int)KetNoiCSDL.count(sql);
                 if (i != 0)
                 {
                     MessageBox.Show("Tài Khoản Đã Được Đăng Ký. Vui Lòng Sử Dụng Tên Khác! ", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                     textBox1.Clear();
                     textBox2.Clear();
                     textBox3.Clear();
                     textBox1.Focus();
                 }
                 else
                 {
                     string txt  = getMD5(textBox2.Text);
                     string them = "insert into tkad values(N'" + textBox1.Text + "',N'" + txt + "',N'User')";
                     KetNoiCSDL.themsuaxoa(them);
                     if (MessageBox.Show("Đăng Ký Thành Công. Bạn Có Muốn Đăng Nhập Không?", "Đăng Ký", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                     {
                         this.Hide();
                         dangnhap f = new dangnhap();
                         f.Show();
                     }
                 }
             }
         }
         else
         {
             MessageBox.Show("Mật Khẩu Bạn Nhập Không Khớp! Bạn Vui Lòng Kiểm Tra Lại!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Error);
             textBox2.Clear();
             textBox3.Clear();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Thao Tác Không Thực Hiện Được! Vui Lòng Kiểm Tra Lại!", "Đăng Ký", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }