public void hienthi() { txtMaCV.Focus(); txtMaCV.text = ""; dvgChucVu.DataSource = chucVuBUL.LayDSChucVu(); dvgChucVu.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }
private void frmAddNVCV_Load(object sender, EventArgs e) { cbbMaNhanVien.DataSource = hoSoBUL.LayDSHoSo(); cbbMaNhanVien.DisplayMember = "manhanvien"; cbbMaNhanVien.ValueMember = "manhanvien"; cbbMaNhanVien.SelectedIndex = 0; cbbMaChucVu.DataSource = chucVuBUL.LayDSChucVu(); cbbMaChucVu.DisplayMember = "tenchucvu"; cbbMaChucVu.ValueMember = "machucvu"; dtTuNgay.Format = DateTimePickerFormat.Custom; dtTuNgay.CustomFormat = "dd/MM/yyyy"; dtDenNgay.Format = DateTimePickerFormat.Custom; dtDenNgay.CustomFormat = "dd/MM/yyyy"; txtTenNhanVien.Text = hoSoBUL.LayTenTheoMaNhanVien(Convert.ToInt32(cbbMaNhanVien.SelectedValue.ToString())); }
private void btnThem_Click_1(object sender, EventArgs e) { string hodem = txtHodem.Text.ToString(); string ten = txtTen.Text.ToString(); DateTime ngaysinh = dtNgaySinh.Value; string ns = ngaysinh.ToString("MM/dd/yyyy"); string gioitinh = ""; if (rdoNam.Checked) { gioitinh = rdoNam.Text; } else if (rdoNu.Checked) { gioitinh = rdoNu.Text; } string sdt = txtSodt.Text.ToString(); string email = txtEmail.Text.ToString(); DateTime ngaytd = dtNgayTD.Value; string ntd = ngaytd.ToString("MM/dd/yyyy"); int maphongban = Convert.ToInt32(cbbMaPhongBan.SelectedValue); bool kt = hosoBUL.ThemHoSo(hodem, ten, ns, gioitinh, sdt, email, ntd, maphongban); if (kt) { MessageBox.Show("Thêm thành công!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Thêm thất bại!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Warning); } UCQLHoSo ucQLHS = new UCQLHoSo(); int ma = hosoBUL.LayMaHoSoMoiThem(); lbMaNhanVien.Text = ma.ToString(); cbbMaChucVu.DataSource = chucVuBUL.LayDSChucVu(); cbbMaChucVu.DisplayMember = "tenchucvu"; cbbMaChucVu.ValueMember = "machucvu"; dtTuNgay.Format = DateTimePickerFormat.Custom; dtTuNgay.CustomFormat = "dd/MM/yyyy"; dtDenNgay.Format = DateTimePickerFormat.Custom; dtDenNgay.CustomFormat = "dd/MM/yyyy"; lblTen.Text = hosoBUL.LayTenTheoMaNhanVien(ma); lbMaNhanVienTDCM.Text = ma.ToString(); lbTenNhanVienTDCM.Text = hosoBUL.LayTenTheoMaNhanVien(ma); cboTrinhDo.DataSource = trinhDoChuyenMonBUL.LayThongTinTrinhDoCHuyenMongopTD(); cboTrinhDo.DisplayMember = "TrinhDo"; cboTrinhDo.ValueMember = "TrinhDo"; cbbLoaihinhDaoTao.DataSource = trinhDoChuyenMonBUL.LayThongTinTrinhDoCHuyenMongopLHDT(); cbbLoaihinhDaoTao.DisplayMember = "LoaiHinhDaoTao"; cbbLoaihinhDaoTao.ValueMember = "LoaiHinhDaoTao"; lbMaNhanVienTDNN.Text = ma.ToString(); lbTenNhanVienTDNN.Text = hosoBUL.LayTenTheoMaNhanVien(ma); cboNgoaiNgu.DataSource = trinhdoNNBUL.LayThongTinTDNNgopNN(); cboNgoaiNgu.DisplayMember = "NgoaiNgu"; cboNgoaiNgu.ValueMember = "NgoaiNgu"; lbMaNhanvienQTCT.Text = ma.ToString(); dtTuNgay.Format = DateTimePickerFormat.Custom; dtTuNgay.CustomFormat = "dd/MM/yyyy"; dtDenNgay.Format = DateTimePickerFormat.Custom; dtDenNgay.CustomFormat = "dd/MM/yyyy"; cbbChucVu.DataSource = chucVuBUL.LayDSChucVu(); cbbChucVu.DisplayMember = "tenchucvu"; cbbChucVu.ValueMember = "tenchucvu"; lbTenNhanVienQTCT.Text = hosoBUL.LayTenTheoMaNhanVien(ma); ucQLHS.HienThi(); }