Advertisement
hocle97th

Untitled

Jan 20th, 2018
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.60 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using System.Data.SqlClient;
  11. using QuanLyDiemHocSinhTHPT.DAO;
  12.  
  13. namespace QuanLyDiemHocSinhTHPT
  14. {
  15.     public partial class frmLogin : Form
  16.     {
  17.         public frmLogin()
  18.         {
  19.             InitializeComponent();
  20.         }
  21.                
  22.         private void btDangNhap_Click(object sender, EventArgs e)
  23.         {
  24.             string userName = txtTenDangNhap.Text;
  25.             string passWord = txtTenDangNhap.Text;
  26.             if (Login(userName, passWord))
  27.             {
  28.                 frmMain f = new frmMain();
  29.                 this.Hide();
  30.                 f.ShowDialog();
  31.                 this.Show();
  32.             }
  33.             else
  34.             {
  35.                 MessageBox.Show("Sai tên tài khoản hoặc mật khẩu!");
  36.             }
  37.         }
  38.  
  39.         bool Login(string userName, string passWord)
  40.         {
  41.             return AccountDAO.Instance.Login(userName, passWord);
  42.         }        
  43.  
  44.         private void btThoat_Click(object sender, EventArgs e)
  45.         {
  46.             Application.Exit();
  47.         }
  48.  
  49.         private void frmLogin_FormClosing(object sender, FormClosingEventArgs e)
  50.         {
  51.             if (MessageBox.Show("Bạn có thật sự muốn thoát chương trình?", "Thông báo", MessageBoxButtons.OKCancel) != System.Windows.Forms.DialogResult.OK)
  52.             {
  53.                 e.Cancel = true;
  54.             }
  55.         }
  56.     }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement