public void DataLoad() { BuidHoaDonMoi(); dbSanPham = new DBSanPham(); dbHoaDon = new DBHoaDon(); dbNhanVien = new DBNhanVien(); dgvDanhMucSanPham.DataSource = dbSanPham.GetAllProduct(); dgvDanhMucSanPham.Columns["GiaMua"].Visible = false; dgvDanhMucSanPham.Columns["ChiTietHoaDons"].Visible = false; dgvDanhMucSanPham.Columns["ChiTietHopDongs"].Visible = false; SetMaHoaDon(); // Tạo số thứ tự đầu dòng của dgvDanhMucSanPham và tự auto size foreach (DataGridViewRow row in dgvDanhMucSanPham.Rows) { row.HeaderCell.Value = (row.Index + 1).ToString(); } dgvDanhMucSanPham.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); var numbers = from n in Enumerable.Range(1, 20) select n; cmSoLuong.DataSource = numbers.ToList(); // Đổ dữ liệu lên cmNhanVien cmNhanVien.DataSource = dbNhanVien.GetAllEmployee(); cmNhanVien.DisplayMember = "HoTenNV"; cmNhanVien.ValueMember = "MaNV"; btnGiamSP.Enabled = false; btnXoaSP.Enabled = false; btnThanhToan.Enabled = false; toolStrip2.Enabled = false; }
private void DataLoad() { dbHoaDon = new DBHoaDon(); dgvDanhMucHoaDon.DataSource = dbHoaDon.GetAllHoaDon(); dgvDanhMucHoaDon.Columns["ChiTietHoaDons"].Visible = false; dgvDanhMucHoaDon.Columns["KhachHang"].Visible = false; foreach (DataGridViewRow row in dgvDanhMucHoaDon.Rows) { row.HeaderCell.Value = (row.Index + 1).ToString(); } dgvDanhMucHoaDon.AutoResizeRowHeadersWidth(DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders); cmNhanVien.DataSource = new DBNhanVien().GetAllEmployee(); cmNhanVien.DisplayMember = "MaNV"; cmNhanVien.ValueMember = "MaNV"; cmCotTimKiem.DataSource = new string[] { "MaHoaDon", "MaKH", "NgayLap", "NhanVien" }; cmMaKH.DataSource = new DBKhachHang().GetAllCustomer(); cmMaKH.DisplayMember = "MaKH"; cmMaKH.ValueMember = "MaKH"; DataBind(); }
private void LoadDgvHoaDonData(string maKH) { dbHoaDon = new DBHoaDon(); dtHoaDon = new DataTable(); dtHoaDon = dbHoaDon.GetHoaDonTheoKH(maKH).Tables[0]; dgvDanhMucHoaDon.DataSource = dtHoaDon; SetDgvHeaderColIndex(dgvDanhMucHoaDon); }
public formLapHoaDon() { InitializeComponent(); dbhd = new DBHoaDon(); dbcthd = new DBCTHoaDon(); }
private void SetMaHoaDon() { dbHoaDon = new DBHoaDon(); txtMaHoaDon.Text = dbHoaDon.SetNewPrimaryKey(); }
private void LuuThongTinHoaDon(string maKH) { DBHoaDon dbHoaDon = new DBHoaDon(); dbHoaDon.InsertHoaDon(dbHoaDon.SetNewPrimaryKey(), maKH, ngayLap, tienHang, giamGia, thue, tongTien, nhanVien); }