private void txtCariPegawai_TextChanged(object sender, EventArgs e) { mlvPegawai.Items.Clear(); List <Pegawai> pegawai = DbQuery.GetPegawai(txtCariPegawai.Text); int j = 1; foreach (var p in pegawai) { ListViewItem i = new ListViewItem(j.ToString()); i.SubItems.Add(p.id.ToString()); i.SubItems.Add(p.nama.Trim()); i.SubItems.Add(p.nip.Trim()); i.SubItems.Add(p.bidang.Trim()); i.SubItems.Add(p.seksi.Trim()); i.SubItems.Add(p.jabatan.Trim()); i.SubItems.Add(p.pangkat.Trim()); mlvPegawai.Items.Add(i); j++; } }
private void Home_Load(object sender, EventArgs e) { string currentYear = DateTime.Now.Year.ToString(); th_anggaran.Text = currentYear; List <Pegawai> pegawai = DbQuery.GetPegawai(); Dictionary <int, string> dCmbPegawai = new Dictionary <int, string>(); // dCmbPegawai.Add(-1, "Pilih Pegawai"); foreach (var p in pegawai) { dCmbPegawai.Add(p.id, p.nama); } cmb_komitmen.DataSource = new BindingSource(dCmbPegawai, null); cmb_komitmen.DisplayMember = "Value"; cmb_komitmen.ValueMember = "Key"; cmb_komitmen.Enabled = false; }
public void RefPegawai() { mlvPegawai.Items.Clear(); List <Pegawai> pegawai = DbQuery.GetPegawai(); int j = 1; foreach (var p in pegawai) { ListViewItem i = new ListViewItem(j.ToString()); i.SubItems.Add(p.id.ToString()); i.SubItems.Add(p.nama.Trim()); i.SubItems.Add(p.nip.Trim()); i.SubItems.Add(p.bidang.Trim()); i.SubItems.Add(p.seksi.Trim()); i.SubItems.Add(p.jabatan.Trim()); i.SubItems.Add(p.pangkat.Trim()); mlvPegawai.Items.Add(i); j++; } }
private void cbPengikut3_CheckStateChanged(object sender, EventArgs e) { if (cbPengikut3.Checked) { gpPengikut3.Enabled = true; List <Pegawai> pegawai = DbQuery.GetPegawai(); Dictionary <int, string> dCmbPengikut3 = new Dictionary <int, string>(); dCmbPengikut3.Add(-1, "Pilih Pegawai"); foreach (var p in pegawai) { dCmbPengikut3.Add(p.id, p.nip + " | " + p.nama); } cmbPengikut3.DataSource = new BindingSource(dCmbPengikut3, null); cmbPengikut3.DisplayMember = "Value"; cmbPengikut3.ValueMember = "Key"; } else { gpPengikut3.Enabled = false; } }
private void FrmSPD_Load(object sender, EventArgs e) { List <Pegawai> pegawai = DbQuery.GetPegawai(); Dictionary <int, string> dCmbPegawai = new Dictionary <int, string>(); dCmbPegawai.Add(-1, "Pilih Pegawai"); foreach (var p in pegawai) { dCmbPegawai.Add(p.id, p.nip + " | " + p.nama); } cmbPegawai.DataSource = new BindingSource(dCmbPegawai, null); cmbPegawai.DisplayMember = "Value"; cmbPegawai.ValueMember = "Key"; List <Transport> transport = DbQuery.GetTransport(); Dictionary <int, string> dCmbTransport = new Dictionary <int, string>(); dCmbTransport.Add(-1, "Pilih Transport"); foreach (var t in transport) { dCmbTransport.Add(t.id, t.transport); } cmbTrasportasi.DataSource = new BindingSource(dCmbTransport, null); cmbTrasportasi.DisplayMember = "Value"; cmbTrasportasi.ValueMember = "Key"; Dictionary <int, string> dCmbKotaBerangkat = new Dictionary <int, string>(); dCmbKotaBerangkat.Add(438, "Kota Palu"); cmbBerangkat.DataSource = new BindingSource(dCmbKotaBerangkat, null); cmbBerangkat.DisplayMember = "Value"; cmbBerangkat.ValueMember = "Key"; List <Provinsi> provinsi = DbQuery.GetProvinsi(); Dictionary <string, string> dCmbProvinsi = new Dictionary <string, string>(); dCmbProvinsi.Add("", "Pilih Provinsi"); foreach (var p in provinsi) { dCmbProvinsi.Add(p.kode, p.nama); } cmbProvinsi.DataSource = new BindingSource(dCmbProvinsi, null); cmbProvinsi.DisplayMember = "Value"; cmbProvinsi.ValueMember = "Key"; if (aksi == "update") { foreach (var s in spd) { txtKode.Text = s.kode; txtMaksud.Text = s.maksud; txtPenjabat.Text = s.penjabat; txtTJabatan.Text = s.t_jabatan; txtLama.Text = s.lama.ToString(); txtNoSuratTuga.Text = s.no_surat; txtAkun.Text = s.akun; cmbTb.SelectedIndex = cmbTb.FindStringExact(s.tb); cmbPegawai.SelectedValue = s.pegawai_id; cmbTrasportasi.SelectedValue = s.trasport_id; cmbTujuan.SelectedValue = s.t_tujuan_id; if (s.tgl_berangkat != "") { dtTglBerangkat.Value = DateTime.ParseExact(s.tgl_berangkat, "yyyy-MM-dd", CultureInfo.InvariantCulture); } if (s.tgl_kembali != "") { dtTglKembali.Value = DateTime.ParseExact(s.tgl_kembali, "yyyy-MM-dd", CultureInfo.InvariantCulture); } if (s.tgl_tugas != "") { dtTglSurat.Value = DateTime.ParseExact(s.tgl_tugas, "yyyy-MM-dd", CultureInfo.InvariantCulture); } Dictionary <int, string> dCmbKotaTujuan = new Dictionary <int, string>(); dCmbKotaTujuan.Add(s.t_tujuan_id, s.t_tujuan); cmbTujuan.DataSource = new BindingSource(dCmbKotaTujuan, null); cmbTujuan.DisplayMember = "Value"; cmbTujuan.ValueMember = "Key"; } foreach (var b in biaya) { lbTotalHarian.Text = " = Rp" + b.h_total.ToString("N1", CultureInfo.InvariantCulture); txtHarian.Text = b.harian.ToString(); txtHLama.Text = b.h_lama.ToString(); lblTotalPenginapan.Text = " = Rp" + b.p_total.ToString("N1", CultureInfo.InvariantCulture); txtPenginapan.Text = b.penginapan.ToString(); txtP_lama.Text = b.p_lama.ToString(); txtTransport.Text = b.transport_pp.ToString(); txtLTransport.Text = b.transport_loak.ToString(); txtDamri.Text = b.damri.ToString(); txtLain_lain.Text = b.lain_lain.ToString(); } if (pengikut.ElementAtOrDefault(0) != null) { gpPengikut1.Enabled = true; cbPengikut1.Checked = true; cmbPengikut1.SelectedValue = pengikut[0].pegawai; txtKetPengikut1.Text = pengikut[0].ket; } if (pengikut.ElementAtOrDefault(1) != null) { gpPengikut2.Enabled = true; cbPengikut2.Checked = true; cmbPengikut2.SelectedValue = pengikut[1].pegawai; txtKetPengikut2.Text = pengikut[1].ket; } if (pengikut.ElementAtOrDefault(2) != null) { gpPengikut3.Enabled = true; cbPengikut3.Checked = true; cmbPengikut3.SelectedValue = pengikut[2].pegawai; txtKetPengikut3.Text = pengikut[2].ket; } } }