public bool Guncelle(Kullanici knesne) { bool result = false; try { using (CskHelper h = new CskHelper())//bağlantıyı kuruyorum burda.. { SqlParameter[] p = { new SqlParameter("@id", knesne.Id), new SqlParameter("@KullaniciAdi", knesne.KullaniciAdi), new SqlParameter("@Ad", knesne.Ad), new SqlParameter("Soyad", knesne.Soyad), new SqlParameter("Sifre", knesne.Sifre) }; result = h.ExecuteCommand("Update Kullanici Set KullaniciAdi=@KullaniciAdi,Ad=@Ad,Soyad=@Soyad,Sifre=@Sifre", p) > 0; } } catch (Exception) { throw; } return(result); }
public bool Ekle(Kullanici kNesne) { bool result = false; try { using (CskHelper h = new CskHelper())//bağlantıyı kuruyorum burda.. { SqlParameter[] p = { new SqlParameter("@KullaniciAdi", kNesne.KullaniciAdi), new SqlParameter("@Ad", kNesne.Ad), new SqlParameter("@Soyad", kNesne.Soyad), new SqlParameter("@Sifre", kNesne.Sifre) }; result = h.ExecuteCommand("Insert into Kullanici values(@KullaniciAdi,@Ad,@Soyad,@Sifre)", p) > 0; } } catch (Exception) { throw; } return(result); }
public bool Guncelle(Musteri nesne)//Ekle metodu gibi ama Id eklenerek geliyor sadece.. { bool result = false; try { using (CskHelper h = new CskHelper()) { SqlParameter[] p = { new SqlParameter("@Id", nesne.Id), new SqlParameter("@Ad", nesne.Ad), new SqlParameter("@Soyad", nesne.Soyad), new SqlParameter("@Tc", nesne.Tc), new SqlParameter("@Telefon", nesne.Telefon), new SqlParameter("@Adres", nesne.Adres), new SqlParameter("@KayitTarihi", nesne.KayitTarihi), new SqlParameter("@GuncellenmeTarihi", nesne.GuncellenmeTarihi) }; result = h.ExecuteCommand("Update Musteri Set Ad=@Ad,Soyad=@Soyad,Tc=@Tc,Telefon=@Telefon,Adres=@Adres,KayitTarihi=@KayitTarihi,GuncellenmeTarihi=@GuncellenmeTarihi where Id=@Id", p) > 0; } } catch (Exception ex) { throw; } return(result); }
public bool Ekle(Musteri nesne) { bool result = false; try { using (CskHelper h = new CskHelper()) { SqlParameter[] p = { new SqlParameter("@Ad", nesne.Ad), new SqlParameter("@Soyad", nesne.Soyad), new SqlParameter("@Tc", nesne.Tc), new SqlParameter("@Telefon", nesne.Telefon), new SqlParameter("@Adres", nesne.Adres), new SqlParameter("@KaydiOlusturan", nesne.KaydiOlusturan), new SqlParameter("@GuncelleyenKisi", nesne.GuncelleyenKisi), new SqlParameter("@KayitTarihi", nesne.KayitTarihi), new SqlParameter("@GuncellenmeTarihi", nesne.GuncellenmeTarihi) }; result = h.ExecuteCommand("Insert into Musteri values(@Ad,@Soyad,@Tc,@Telefon,@Adres,@KaydiOlusturan,@GuncelleyenKisi,@KayitTarihi,@GuncellenmeTarihi)", p) > 0;// executecommand int döndüğü için sonucun 0'dan büyük olup olmadığı kontrol edilir. } } catch (Exception ex) { throw; } return(result); }
public bool Sil(int Id) { bool result = false; try { using (CskHelper h = new CskHelper()) { SqlParameter[] p = { new SqlParameter("@id", Id) }; result = h.ExecuteCommand("Delete from Musteri where id=@id", p) > 0; } } catch (Exception ex) { throw; } return(result); }