Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     try
     {
         using (var cmd = new LoginRepository.LoginLoadRepository())
         {
             cmd.username = this.txtUser.Text;
             cmd.password = this.txtPass.Text;
             if (cmd.Execute())
             {
                 this.Hide();
                 var f = new mainForm();
                 if (f.ShowDialog() != DialogResult.OK)
                 {
                     this.Close();
                 }
             }
             else
             {
                 MessageBox.Show("Tài khoản hoặc mật khẩu không đúng!", "THÔNG BÁO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
     catch
     {
         MessageBox.Show("Xảy ra lỗi không xác định!", "THÔNG BÁO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemple #2
0
 private void btnLogin_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         using (var cmd = new LoginRepository.LoginLoadRepository())
         {
             cmd.username = this.txtUsername.Text;
             cmd.password = this.txtPassword.Password;
             if (cmd.Execute() == true)
             {
                 this.Hide();
                 this.lblInfo.Visibility = Visibility.Hidden;
                 var f = new mainForm.mainForm();
                 f.ShowDialog();
                 this.Close();
             }
             else
             {
                 this.lblInfo.Visibility = Visibility.Visible;
                 this.lblInfo.Content    = "Tài khoản hoặc mật khẩu không đúng!";
             }
         }
     }
     catch
     {
         this.lblInfo.Visibility = Visibility.Visible;
         this.lblInfo.Content    = "Xảy ra lỗi không xác định!";
     }
 }