void LoadData() { //try //{ dgv.DataSource = dbNhanVien.LayNV(); dgv.AutoResizeColumns(); // Xóa trống các đối tượng trong Panel this.txtDiaChi.ResetText(); this.txtGioiTinh.ResetText(); this.txtMaNV.ResetText(); this.txtNgaySinh.ResetText(); this.txtPhong.ResetText(); this.txtTenNV.ResetText(); // Không cho thao tác trên các nút Lưu / Hủy this.btnLuu.Enabled = false; this.btnHuy.Enabled = false; this.panel1.Enabled = false; // Cho thao tác trên các nút Thêm / Sửa / Xóa /Thoát this.btnThem.Enabled = true; this.btnSua.Enabled = true; this.btnXoa.Enabled = true; // dgv_CellClick(null, null); //} //catch //{ // MessageBox.Show("Không lấy được nội dung trong table KH. Lỗi rồi!!!"); //} }
void showCbbMaNV() { dtK = new DataTable(); dtK.Clear(); BLNhanVien bl = new BLNhanVien(); DataSet ds = bl.LayNV(); dtK = ds.Tables[0]; cbbMaNV.DataSource = dtK; cbbMaNV.DisplayMember = BLNhanVien.manv; cbbMaNV.ValueMember = BLNhanVien.manv; }
void LoadData() { try { dtNV = new DataTable(); dtNV.Clear(); DataSet ds = dbNV.LayNV(); dtNV = ds.Tables[0]; // Đưa dữ liệu lên DataGridView dgvNV.DataSource = dtNV; // Thay đổi độ rộng cột dgvNV.AutoResizeColumns(); // Xóa trống các đối tượng trong Panel this.txtMaNV.ResetText(); this.txtTenNV.ResetText(); // Không cho thao tác trên các nút Lưu / Hủy this.btnLuu.Enabled = false; this.btnHuy.Enabled = false; this.pnlNV.Enabled = false; // Cho thao tác trên các nút Thêm / Sửa / Xóa /Thoát if (SHAREVAR.ChonNV == true) { this.btnSua.Enabled = false; this.btnXoa.Enabled = false; this.btnThem.Enabled = false; } else { this.btnSua.Enabled = true; this.btnXoa.Enabled = true; this.btnThem.Enabled = true; } this.btnThoat.Enabled = true; //// dgvNV_CellClick(null, null); } catch { MessageBox.Show("Không lấy được nội dung trong table Xe. Lỗi rồi!!!"); } }
void LoadData() { try { dtNhanvien = new DataTable(); dtNhanvien.Clear(); DataSet ds = dbNV.LayNV(); dtNhanvien = ds.Tables[0]; dgvTimNV.DataSource = dtNhanvien; dgvTimNV.AutoResizeColumns(); this.txtTimkiem.ResetText(); dgvTimNV_CellClick(null, null); } catch (SqlException) { MessageBox.Show("Không lấy được nội dung trong table NhanVien. Lỗi rồi!!!"); } }
void LoadData() { try { dtNV = new DataTable(); dtNV.Clear(); DataSet ds = dbNV.LayNV(); dtNV = ds.Tables[0]; dgvNV.DataSource = dtNV; dgvNV.AutoResizeColumns(); this.txtMaNV.ResetText(); this.txtHoTen.ResetText(); this.txtDC.ResetText(); this.txtDT.ResetText(); this.txtEmail.ResetText(); this.txtTimkiem.ResetText(); this.btnThem.Enabled = true; this.btnSua.Enabled = true; this.btnXoa.Enabled = true; this.btnLuu.Enabled = false; dgvNV_CellClick(null, null); // Sum(dtNV); } catch (SqlException) { MessageBox.Show("Không lấy được nội dung trong table NhanVien. Lỗi rồi!!!"); } }