Esempio n. 1
0
 void LoadData()
 {
     try
     {
         DvgNCC.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         DvgNCC.Enabled             = true;
         //
         dtNhaCC = new DataTable();
         dtNhaCC.Clear();
         //
         dtNhaCC           = dbNhaCungCap.LayBangNhaCungCap();
         DvgNCC.DataSource = dtNhaCC;
         //
         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.txtTimNCC.Enabled = true;
         this.btnTim.Enabled    = true;
         this.txtTimNCC.ResetText();
         //
         this.txtDiaChi.Enabled = false;
         this.txtEmail.Enabled  = false;
         this.txtMaNCC.Enabled  = false;
         this.txtTenNCC.Enabled = false;
         this.txtSDT.Enabled    = false;
         //
         DvgNCC_CellClick(null, null);
         this.txtMaNCC.Focus();
     }
     catch (SqlException)
     {
         MessageBox.Show("Lỗi Rồi! Không Load Được Bảng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Esempio n. 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 ??");
     }
 }
Esempio n. 3
0
 void LoadMaNCC(ComboBox cb)
 {
     cbMaNCC.DataSource    = dbNhaCungCap.LayBangNhaCungCap();
     cbMaNCC.ValueMember   = "MaNCC";
     cbMaNCC.DropDownStyle = ComboBoxStyle.DropDownList;
 }