Beispiel #1
0
 private void reg()
 {
     if (textBox1.Text.Equals(""))
     {
         MessageBox.Show("Bạn chưa nhập tên truy cập", "Hệ thống cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         textBox1.Focus();
     }
     else if (textBox2.Text.Equals(""))
     {
         MessageBox.Show("Bạn chưa nhập mật khẩu truy cập", "Hệ thống cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         textBox2.Focus();
     }
     else
     {
         string p = "dhtvietnam12345";
         try
         {
             List <string> kq = KTienIch.DocFile();
             p = kq[1];
         }
         catch (Exception)
         {
             //Quá trình đọc file bị lỗi, file chưa tồn tại thì lấy u và p mặc định
         }
         if (textBox3.Text.Equals(""))
         {
             MessageBox.Show("Chưa nhập mật khẩu cũ");
             textBox3.Focus();
         }
         else if (textBox3.Text.Equals(p))
         {
             try
             {
                 KTienIch.GhiFile(textBox1.Text, textBox2.Text);
                 MyGetData(textBox1.Text, textBox2.Text);
                 MessageBox.Show("Đăng ký thành công!");
                 this.Close();
             }
             catch { MessageBox.Show("Ghi Thất Bại"); }
         }
         else
         {
             MessageBox.Show("Mật khẩu cũ chưa chính xác!");
             textBox3.Focus();
         }
     }
 }
Beispiel #2
0
 private void login()
 {
     if (textBox1.Text.Equals(""))
     {
         MessageBox.Show("Bạn chưa nhập tên truy cập", "Hệ thống cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         textBox1.Focus();
     }
     else if (textBox2.Text.Equals(""))
     {
         MessageBox.Show("Bạn chưa nhập mật khẩu truy cập", "Hệ thống cảnh báo", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
         textBox2.Focus();
     }
     else
     {
         string u = "dhtvietnam";
         string p = "dhtvietnam12345";
         try
         {
             List <string> kq = KTienIch.DocFile();
             u = kq[0];
             p = kq[1];
         }
         catch (Exception)
         {
             //Quá trình đọc file bị lỗi, file chưa tồn tại thì lấy u và p mặc định
         }
         if (textBox1.Text.Equals(u) && textBox2.Text.Equals(p))
         {
             //MessageBox.Show("Đăng Nhập Thành Công!");
             this.Hide();
             new Form1().Show();
         }
         else
         {
             dem++;
             if (dem == 4)
             {
                 MessageBox.Show("Bạn đã nhập sai quá nhiều lần, chương trình sẽ thoát!");
                 Application.Exit();
             }
             else
             {
                 MessageBox.Show("Đăng nhập thất bại!", "Hệ thống cảnh báo!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
Beispiel #3
0
 public Form1()
 {
     InitializeComponent();
     l = KTienIch.GEN();
 }