Ejemplo n.º 1
0
 private void btExit_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn muốn thoát khỏi chức năng Quản Lý Thông Tin Gạo?", "THOÁT CHỨC NĂNG", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
     {
         this.Hide();
         frmQLCHG frm = new frmQLCHG();
         frm.ShowDialog();
     }
 }
Ejemplo n.º 2
0
 private void DangNhap()
 {
     if (txtTaiKhoan.Text == "" || txtMatKhau.Text == "")
     {
         lbThongBao.Text = "Tài Khoản hoặc Mật Khẩu chưa được nhập";
     }
     else
     {
         try
         {
             SqlConnection conn = SQLDatabase.GetDBConnection();
             conn.Open();
             string     sql     = "SELECT COUNT(*) FROM TAIKHOAN WHERE TAIKHOAN.MATAIKHOAN = @TAIKHOAN AND TAIKHOAN.MATKHAU = @MATKHAU";
             SqlCommand command = new SqlCommand(sql, conn);
             command.Parameters.Add(new SqlParameter("@TAIKHOAN", txtTaiKhoan.Text));
             command.Parameters.Add(new SqlParameter("@MATKHAU", txtMatKhau.Text));
             int x = (int)command.ExecuteScalar();
             if (x > 0)
             {
                 MessageBox.Show("Đăng Nhập thành công!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 TenTaiKhoan = txtTaiKhoan.Text;
                 this.Hide();
                 frmQLCHG frm = new frmQLCHG();
                 frm.ShowDialog();
                 //Application.Exit();
             }
             else
             {
                 lbThongBao.Text = "Tài Khoản hoặc Mật Khẩu không đúng";
                 txtTaiKhoan.Focus();
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }