private void loadHoaDonBan() { balChiTietBanHang = new BALChiTietHDBanHang(); balHoaDonBanHang = new BAHoaDonBanHang(); try { if (balHoaDonBanHang.LayListHoaDonBanHang().Tables[0].Rows.Count != 0) { this.gridHdBanHang.DataSource = balHoaDonBanHang.LayListHoaDonBanHang().Tables[0]; int rowSelected2 = gridView1.FocusedRowHandle; txtMaHDBan.Text = gridView1.GetRowCellValue(rowSelected2, "MaHD").ToString(); dtNgayLapHD.EditValue = (DateTime)gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NgayLapHD"); txtMaNV.Text = gridView1.GetRowCellValue(rowSelected2, "MaNV").ToString(); txtMaKH.Text = gridView1.GetRowCellValue(rowSelected2, "MaKH").ToString(); txtThanhTienBAn.Text = gridView1.GetRowCellValue(rowSelected2, "ThanhTien").ToString(); this.gridChiTietHDBanHang.DataSource = balChiTietBanHang.LayChiTietHDBanHangTheoMaHD(txtMaHDBan.Text).Tables[0]; } } catch (SqlException error) { MessageBox.Show("Không truy cập dữ liệu chi tiết hóa đơn bán hàng được!\rLỗi: " + error.Message, "Lỗi SQL", MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception er) { MessageBox.Show("Không truy cập dữ liệu chi tiết hóa đơn bán hàng được!\rLỗi: " + er.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error); } //HienThiChucNangCTHD(true); //HienThiHanhDongCTHD(false); }
private void FormBanHang_Load(object sender, EventArgs e) { balHoaDon = new BAHoaDonBanHang(); balChiTietHD = new BALChiTietHDBanHang(); LoadLoaiSP(); gbThongTin.Enabled = false; txtNhanVien.Text = "1"; }
public FormBaoHanh() { InitializeComponent(); balBaoHanh = new BABaoHanh(); balHDBH = new BAHoaDonBanHang(); }