public List <BienLaiDTO> load_BienLaiDAO()
        {
            List <BienLaiDTO> lst_Bienlai = new List <BienLaiDTO>();
            SqlConnection     conn        = DataProvider.TaoKetNoi();
            string            query       = "SELECT BL.MaBienLai, BL.MaHV, HV.HoTen as HoTenHV, CT.KhoaHoc, CT.HocPhi, BL.TongThanhToan, BL.NguoiLap, NV.HoTen as HoTenNV, BL.NgayLap FROM HocVien HV, NhanVien NV, BienLai BL, ChiTietBienLai CT WHERE BL.MaBienLai = CT.MaBienLai AND BL.MaHV = HV.MaHV AND BL.NguoiLap = NV.MaNV";
            SqlDataReader     sdr         = DataProvider.ThucHienTruyVan(query, conn);

            while (sdr.Read())
            {
                BienLaiDTO item = new BienLaiDTO();
                item.MaBienLai     = sdr["MaBienLai"].ToString();
                item.MaHV          = sdr["MaHV"].ToString();
                item.HoTenHV       = sdr["HoTenHV"].ToString();
                item.MaKH          = sdr["KhoaHoc"].ToString();
                item.HocPhi        = int.Parse(sdr["HocPhi"].ToString());
                item.TongThanhToan = int.Parse(sdr["TongThanhToan"].ToString());
                item.NguoiLap      = sdr["NguoiLap"].ToString();
                item.HoTenNV       = sdr["HoTenNV"].ToString();
                item.NgayLap       = DateTime.Parse(sdr["NgayLap"].ToString());
                lst_Bienlai.Add(item);
            }
            sdr.Close();
            conn.Close();
            return(lst_Bienlai);
        }
 private void GetDataChiTiet()
 {
     if (blchon == null)
     {
         blchon = new BienLaiDTO();
     }
     txt_MaBL.Text         = blchon.MaBienLai;
     txt_MaHV.Text         = blchon.MaHV;
     txt_TongTien.Text     = blchon.TongThanhToan.ToString();
     ucNhanVienKT.NhanVien = blchon.NguoiLap;
     dtp_Ngaylap.Text      = blchon.NgayLap.ToString();
 }
        private void dgv_bienlai_SelectionChanged(object sender, EventArgs e)
        {
            if (dgv_bienlai.SelectedRows.Count > 0)
            {
                blchon = (BienLaiDTO)dgv_bienlai.SelectedRows[0].DataBoundItem;
            }
            else
            {
                blchon = null;
            }

            BindingChiTiet();
        }