private void LoadKhachHang() { busPhieuNhanPhong = new BUS.BUSPHIEUNHANPHONG(); busKhachHang = new BUS.BUSKHACHHANG(); busLoaiKhachHang = new BUS.BUSLOAIKH(); var _KH = (from b in busPhieuNhanPhong.LayTheoMaPHIEUNHANPHONG((int)glkvPhong.GetRowCellValue(glkvPhong.FocusedRowHandle, colMaPhieu)) join a in busKhachHang.LayTatCaKHACHHANG() on b.MAKH equals a.MAKH join c in busLoaiKhachHang.LayTatCaLOAIKH() on a.MALOAIKH equals c.MALOAIKH select new { MaKH = a.MAKH, HoTen = a.HOTEN, CMND = a.CMND, DiaChi = a.DIACHI, Email = a.EMAIL, GioiTinh = a.GIOITINH, LoaiKH = c.TENLOAIKH }).Last(); txtMaKH.Text = _KH.MaKH.ToString(); txtLKH.Text = _KH.LoaiKH; txtHoTen.Text = _KH.HoTen; txtCMND.Text = _KH.CMND; txtEmail.Text = _KH.Email; if (_KH.GioiTinh) txtGioiTinh.Text = "Nam"; else txtGioiTinh.Text = "Nữ"; }
private void usrDanhSachKhachHang_Load(object sender, EventArgs e) { busLoaiKH = new BUS.BUSLOAIKH(); usrLoaiKhachHang LKH = new usrLoaiKhachHang(); LKH.DSLoaiKH += new usrLoaiKhachHang.LoaiKH(hanhdong); panel1.Controls.Add(LKH); LKH.Dock = DockStyle.Fill; dtoLoaiKH = busLoaiKH.LayTatCaLOAIKH(); glkLKH.Properties.DataSource = dtoLoaiKH; glkLKH.Properties.DisplayMember = "TENLOAIKH"; glkLKH.Properties.ValueMember = "MALOAIKH"; LoadKhachHang(); backgroundWorker1.RunWorkerAsync(); }