public void PersonelGorevGetir(ComboBox cb) { cb.Items.Clear(); SqlConnection con = new SqlConnection(gnl.conString); SqlCommand cmd = new SqlCommand("Select* from personelGorevleri", con); SqlDataReader dr = null; try { if (con.State == ConnectionState.Closed) { con.Open(); } dr = cmd.ExecuteReader(); while (dr.Read()) { cPersonelGorev c = new cPersonelGorev(); c._personelGorevId = Convert.ToInt32(dr["ID"].ToString()); c._tanim = dr["GOREV"].ToString(); cb.Items.Add(c); } } catch (SqlException ex) { string hata = ex.Message; throw; } dr.Close(); con.Close(); }
private void frmAyarlar_Load(object sender, EventArgs e) { cPersoneller cp = new cPersoneller(); cPersonelGorev cpg = new cPersonelGorev(); string gorev = cpg.PersonelGorevTanim(cGenel._gorevId); if (gorev == "Şef") { cpg.PersonelGorevGetir(cbGorevi); cp.personelBilgileriniGetirLv(lvPersoneller); btnSil.Enabled = false; btnBilgiDegistir.Enabled = true; lblBilgi.Text = "Mevki : ŞEF / Yetki Sınırsız / Kullanıcı :" + cp.personelBilgiGetirIsim(cGenel._personelId); panel1.Visible = false; } else { lblBilgi.Text = "Yetki Sınırlı / Kullanıcı :" + cp.personelBilgiGetirIsim(cGenel._personelId); panel2.Visible = false; panel3.Visible = false; } }
private void cbGorevi_SelectedIndexChanged(object sender, EventArgs e) { cPersonelGorev c = (cPersonelGorev)cbGorevi.SelectedItem; txtGorevId2.Text = Convert.ToString(c.PersonelGorevId); }