private void frm_gorevli_Load(object sender, EventArgs e) { SqlCommand c = new SqlCommand("select * from tb_kullanicilar", vt.bagla()); SqlDataReader dr = c.ExecuteReader(); while (dr.Read()) { Kullanici kl = new Kullanici(); kl.Id = Convert.ToInt16(dr["ID"]); kl.Adi = dr["adi"].ToString(); kl.Soyadi = dr["soyadi"].ToString(); kl.KullaniciAdi = dr["kullaniciAdi"].ToString(); tumKullanicilar.Add(kl); } vt.bagla().Close(); int top = 25; int left = 25; foreach (Kullanici item in tumKullanicilar) { CheckBox cb = new CheckBox(); cb.Text = item.KullaniciAdi; cb.Top = top; cb.Left = left; cb.Checked = projeSorumlusu(item.Id); panel1.Controls.Add(cb); top += 25; } }
private void projeYatar() { SqlCommand c = new SqlCommand("insert into tb_projeler (projeismi, musteri, bilgi) values (@p1, @p2, @p3)", vt.bagla()); c.Parameters.AddWithValue("@p1", _proje.Projeİsmi); c.Parameters.AddWithValue("@p2", _proje.Musteri); c.Parameters.AddWithValue("@p3", _proje.Bilgi); c.ExecuteNonQuery(); vt.bagla().Close(); c = new SqlCommand("select IDENT_CURRENT('tb_projeler')", vt.bagla()); SqlDataReader dr = c.ExecuteReader(); if (dr.Read()) { _proje.Id = Convert.ToInt32(dr[0]); } vt.bagla().Close(); c = new SqlCommand("insert into tb_projeSorumlu (projeId, kullaniciId) values (@p1, @p2)", vt.bagla()); c.Parameters.AddWithValue("@p1", _proje.Id); c.Parameters.AddWithValue("@p2", Kullanici._login.Id); c.ExecuteNonQuery(); vt.bagla().Close(); }
private void kayitOl(Kullanici _kullanici) { if (tekrarKayit(_kullanici.KullaniciAdi)) { SqlCommand c = new SqlCommand("insert into tb_kullanicilar (kullaniciAdi,adi,soyadi,parola) values (@p1, @p2, @p3, @p4)", vt.bagla()); c.Parameters.AddWithValue("@p1", _kullanici.KullaniciAdi); c.Parameters.AddWithValue("@p2", _kullanici.Adi); c.Parameters.AddWithValue("@p3", _kullanici.Soyadi); c.Parameters.AddWithValue("@p4", _kullanici.Parola); c.ExecuteNonQuery(); vt.bagla().Close(); } }
private bool projeSorumlusu(int id) { bool onay = false; SqlCommand c = new SqlCommand("select * from tb_projeSorumlu where projeId = @p1 and kullaniciId = @p2", vt.bagla()); c.Parameters.AddWithValue("@p1", _proje.Id); c.Parameters.AddWithValue("@p2", id); SqlDataReader dr = c.ExecuteReader(); if (dr.Read()) { onay = true; } return(onay); }
private void gorevEkle(Gorev gorevv, int projeId) { if (tekrarKayit(projeId, gorevv.Baslik)) { SqlCommand c = new SqlCommand("insert into tb_gorevler (projeId, baslik, gorevliId, aciklama) values (@p1, @p2, @p3, @p4)", vt.bagla()); c.Parameters.AddWithValue("@p1", projeId); c.Parameters.AddWithValue("@p2", gorevv.Baslik); c.Parameters.AddWithValue("@p3", gorevv.Gorevli); c.Parameters.AddWithValue("@p4", gorevv.Aciklama); c.ExecuteNonQuery(); vt.bagla().Close(); int gorevID = 0; c = new SqlCommand("select IDENT_CURRENT('tb_gorevler')", vt.bagla()); SqlDataReader dr = c.ExecuteReader(); if (dr.Read()) { gorevID = Convert.ToInt32(dr[0]); } vt.bagla().Close(); c = new SqlCommand("insert into tb_gorevHareket (gorevId, durumId, kullaniciId, tarih) values (@p1, @p2, @p3, @p4)", vt.bagla()); c.Parameters.AddWithValue("@p1", gorevID); c.Parameters.AddWithValue("@p2", 1); c.Parameters.AddWithValue("@p3", Kullanici._login.Id); c.Parameters.AddWithValue("@p4", DateTime.Now); c.ExecuteNonQuery(); vt.bagla().Close(); } }
public bool girisKontrol(string kullaniciAdi, string parola) { bool onay = false; VTBaglan vt = new VTBaglan(); Sifreleme sf = new Sifreleme(); SqlCommand c = new SqlCommand("select * from tb_kullanicilar where kullaniciAdi=@p1 and parola=@p2", vt.bagla()); c.Parameters.AddWithValue("@p1", kullaniciAdi); c.Parameters.AddWithValue("@p2", sf.RijndaelSifrele(parola)); SqlDataReader dr = c.ExecuteReader(); if (dr.Read()) { onay = true; giris(Convert.ToInt16(dr["ID"]), dr["adi"].ToString(), dr["soyadi"].ToString(), dr["kullaniciAdi"].ToString()); } vt.bagla().Close(); return(onay); }
private void frm_gorevHaareketleri_Load(object sender, EventArgs e) { VTBaglan vt = new VTBaglan(); SqlDataAdapter da = new SqlDataAdapter("select baslik as Baslik, adi+' '+soyadi as AdSoyad, tarih as Tarih, durumAdi from tb_gorevHareket inner join tb_gorevler on tb_gorevhareket.gorevId = tb_gorevler.ID inner join tb_kullanicilar on tb_kullanicilar.ID = tb_gorevler.gorevliId inner join tb_Durum on tb_Durum.ID = tb_gorevHareket.durumId where projeId = @p1", vt.bagla()); da.SelectCommand.Parameters.AddWithValue("@p1", _projeId); DataTable dt = new DataTable(); da.Fill(dt); dataGridView1.DataSource = dt; }
private void projelerim() { _projelerim.Clear(); SqlCommand c = new SqlCommand("select * from tb_projeler inner join tb_projeSorumlu on tb_projeler.ID = tb_projeSorumlu.projeID where kullaniciID = @p1", vt.bagla()); c.Parameters.AddWithValue("@p1", Kullanici._login.Id); SqlDataReader dr = c.ExecuteReader(); while (dr.Read()) { Proje p = new Proje(); p.Id = Convert.ToInt16(dr[0]); p.Projeİsmi = dr["projeismi"].ToString(); p.Musteri = dr["musteri"].ToString(); p.Bilgi = dr["bilgi"].ToString(); _projelerim.Add(p); } vt.bagla().Close(); cmb_projeler.Items.Clear(); foreach (Proje item in _projelerim) { cmb_projeler.Items.Add(item.Projeİsmi); } foreach (Proje pr in _projelerim) { c = new SqlCommand("select * from tb_gorevler where projeId = @p1", vt.bagla()); c.Parameters.AddWithValue("@p1", pr.Id); SqlDataReader dr2 = c.ExecuteReader(); while (dr2.Read()) { Gorev gr = new Gorev(); gr.Id = Convert.ToInt16(dr2["ID"]); gr.Baslik = dr2["baslik"].ToString(); gr.Gorevli = Convert.ToInt16(dr2["gorevliId"]); gr.Aciklama = dr2["aciklama"].ToString(); gr.Durum = Convert.ToInt16(dr2["durum"]); pr.Gorev.Add(gr); } vt.bagla().Close(); } foreach (Proje pr in _projelerim) { c = new SqlCommand("select * from tb_projeSorumlu inner join tb_kullanicilar on tb_projeSorumlu.kullaniciId = tb_kullanicilar.ID where projeId = @p1", vt.bagla()); c.Parameters.AddWithValue("@p1", pr.Id); SqlDataReader dr3 = c.ExecuteReader(); while (dr3.Read()) { Kullanici kl = new Kullanici(); kl.Id = Convert.ToInt16(dr3["kullaniciId"]); kl.Adi = dr3["adi"].ToString(); kl.Soyadi = dr3["soyadi"].ToString(); kl.KullaniciAdi = dr3["kullaniciAdi"].ToString(); pr.Sorumlu.Add(kl); } vt.bagla().Close(); } }