public static int PersonelSil(Entity_Personel p) { SqlCommand komut3 = new SqlCommand("Delete from Tbl_Bilgi where ID=@p1", baglanti.bgl); komut3.Parameters.AddWithValue("@p1", p.Id); return(komut3.ExecuteNonQuery()); }
public static List <Entity_Personel> PersonelListesi() { List <Entity_Personel> degerler = new List <Entity_Personel>(); SqlCommand komut = new SqlCommand("Select * from Tbl_Bilgi", baglanti.bgl); if (komut.Connection.State != ConnectionState.Open) { komut.Connection.Open(); } SqlDataReader dr = komut.ExecuteReader(); while (dr.Read()) { Entity_Personel ent = new Entity_Personel(); ent.Id = int.Parse(dr["ID"].ToString()); ent.Ad = dr["AD"].ToString(); ent.Soyad = dr["SOYAD"].ToString(); ent.Gorev = dr["GOREV"].ToString(); ent.Sehir = dr["SEHİR"].ToString(); ent.Maas = short.Parse(dr["MAAS"].ToString()); degerler.Add(ent); } dr.Close(); return(degerler); }
private void BtnSil_Click(object sender, EventArgs e) { Entity_Personel ent = new Entity_Personel(); ent.Id = int.Parse(TxtID.Text); Logic_Layer.Logic_Layer.LLPersonelSil(ent); MessageBox.Show("Personel Silindi"); }
public static int LLPersonelEkle(Entity_Personel p) { if (p.Ad != "" && p.Soyad != "" && p.Maas >= 3500 && p.Ad.Length >= 3) { return(DAL_Personel.PersonelEkle(p)); } else { return(-1); } }
public static int PersonelGüncelle(Entity_Personel p) { SqlCommand komut4 = new SqlCommand("Update Tbl_Bilgi set AD=@p1, SOYAD=@p2, SEHİR=@p3, GOREV=@p4, MAAS=@p5 where ID=@p6", baglanti.bgl); komut4.Parameters.AddWithValue("@p1", p.Ad); komut4.Parameters.AddWithValue("@p2", p.Soyad); komut4.Parameters.AddWithValue("@p3", p.Sehir); komut4.Parameters.AddWithValue("@p4", p.Gorev); komut4.Parameters.AddWithValue("@p5", p.Maas); komut4.Parameters.AddWithValue("@p6", p.Id); return(komut4.ExecuteNonQuery()); }
private void BtnKaydet_Click(object sender, EventArgs e) { Entity_Personel ent = new Entity_Personel(); ent.Ad = TxtAD.Text; ent.Soyad = TxtSOYAD.Text; ent.Sehir = TxtSEHİR.Text; ent.Gorev = TxtGOREV.Text; ent.Maas = int.Parse(TxtMAAS.Text); Logic_Layer.Logic_Layer.LLPersonelEkle(ent); MessageBox.Show("Personel Eklendi"); }
public static int PersonelEkle(Entity_Personel p) { SqlCommand komut2 = new SqlCommand("insert into Tbl_Bilgi (AD, SOYAD, SEHİR, MAAS, GOREV) values (@p1, @p2, @p3, @p4, @p5)", baglanti.bgl); if (komut2.Connection.State != ConnectionState.Open) { komut2.Connection.Open(); } komut2.Parameters.AddWithValue("@p1", p.Ad); komut2.Parameters.AddWithValue("@p2", p.Soyad); komut2.Parameters.AddWithValue("@p3", p.Sehir); komut2.Parameters.AddWithValue("@p4", p.Maas); komut2.Parameters.AddWithValue("@p5", p.Gorev); return(komut2.ExecuteNonQuery()); }
public static int LLPersonelGüncelle(Entity_Personel p) { return(DAL_Personel.PersonelGüncelle(p)); }
public static int LLPersonelSil(Entity_Personel p) { return(DAL_Personel.PersonelSil(p)); }