Пример #1
0
 void LoadData()
 {
     try
     {
         DvgPhieuXH.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         DvgPhieuXH.Enabled             = true;
         //
         dtXuat = new DataTable();
         dtXuat.Clear();
         //
         dtXuat = dbPhieuXuat.LayBangPhieuXuat();
         DvgPhieuXH.DataSource = dtXuat;
         //
         this.btnHuy.Enabled = false;
         this.btnLuu.Enabled = false;
         //
         this.btnSua.Enabled    = true;
         this.btnTaiLai.Enabled = true;
         this.btnThem.Enabled   = true;
         this.btnTroVe.Enabled  = true;
         this.btnXoa.Enabled    = true;
         //
         this.txtGia.Enabled      = false;
         this.txtMaPX.Enabled     = false;
         this.txtSoLuong.Enabled  = false;
         this.cbMaKH.Enabled      = false;
         this.cbMaHH.Enabled      = false;
         this.cbMaNV.Enabled      = false;
         this.cbXuLy.Enabled      = false;
         this.rtxtGhiChu.Enabled  = false;
         this.txtNgayXuat.Enabled = false;
         //
         cbNgay.Enabled     = true;
         btnThongke.Enabled = true;
         LoadNgay(cbNgay);
         //
         DvgPhieuXH_CellClick(null, null);
         this.txtMaPX.Focus();
     }
     catch (SqlException)
     {
         MessageBox.Show("Lỗi Rồi! Không Load Được Bảng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
 private void BtnHT_Click(object sender, EventArgs e)
 {
     //LoadData();
     if (cbTable.SelectedValue.ToString() == "CHINHANH")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dt = dbChiNhanh.LayBangChiNhanh();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else if (cbTable.SelectedValue.ToString() == "NHANVIEN")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
         dt = dbNhanVien.LayBangNhanVien();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else if (cbTable.SelectedValue.ToString() == "PHIEUNHAPHANG")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
         dt = dbPhieuNhap.LayBangPhieuNhap();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else if (cbTable.SelectedValue.ToString() == "KHO")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dt = dbKho.LayBangKho();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else if (cbTable.SelectedValue.ToString() == "HANGHOA")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
         dt = dbHangHoa.LayBangHangHoa();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else if (cbTable.SelectedValue.ToString() == "NHACUNGCAP")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dt = dbNhaCungCap.LayBangNhaCungCap();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else if (cbTable.SelectedValue.ToString() == "PHIEUXUATHANG")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
         dt = dbPhieuXuat.LayBangPhieuXuat();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else if (cbTable.SelectedValue.ToString() == "KHACHHANG")
     {
         LoadData();
         dvgShowTable.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
         dt = dbKhachHang.LayBangKhachHang();
         dvgShowTable.DataSource       = dt;
         dvgShowTable.Rows[0].Selected = false;
     }
     else
     {
         MessageBox.Show("Chưa Chọn bảng ??");
     }
 }