Exemplo n.º 1
0
 void LoadData()
 {
     try
     {
         dvgNV.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
         dvgNV.Enabled             = true;
         //
         dtNhanVien = new DataTable();
         dtNhanVien.Clear();
         //
         dtgioitinh = new DataTable();
         dtgioitinh.Clear();
         //
         dtNhanVien       = dbNhanVien.LayBangNhanVien();
         dvgNV.DataSource = dtNhanVien;
         //
         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;
         //
         checkBoxKhac.Enabled = true;
         checkBoxNam.Enabled  = true;
         checkBoxNu.Enabled   = true;
         //
         this.txtMaNV.Enabled    = false;
         this.txtTenNV.Enabled   = false;
         this.cbGioiTinh.Enabled = false;
         this.txtSDT.Enabled     = false;
         this.txtDiaChi.Enabled  = false;
         this.txtEmail.Enabled   = false;
         this.txtMK.Enabled      = false;
         this.cbQuyen.Enabled    = false;
         //
         this.txtTimNV.Enabled = true;
         this.btnTim.Enabled   = true;
         this.txtTimNV.ResetText();
         //
         this.txtCN.Enabled = false;
         //
         DvgNV_CellClick(null, null);
         this.txtMaNV.Focus();
         //
     }
     catch (SqlException)
     {
         MessageBox.Show("Lỗi Rồi! Không Load Được Bảng", "Thông Báo", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo 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 ??");
     }
 }
Exemplo n.º 3
0
 void LoadMaNV(ComboBox cb)
 {
     cbMaNV.DataSource    = dbNhanVien.LayBangNhanVien();
     cbMaNV.ValueMember   = "MaNV";
     cbMaNV.DropDownStyle = ComboBoxStyle.DropDownList;
 }