public static bool bagisciArama(Bagisci bagisci) { SqlConnection sqlbaglanti = openConnection(); try { SqlCommand veriOku = new SqlCommand("select * from bagisci where kimlikNo=@tcNo", sqlbaglanti); veriOku.Parameters.AddWithValue("@tcNo", bagisci.getTcKimlikNo()); SqlDataReader rdr = veriOku.ExecuteReader(); rdr.Read(); if (rdr.HasRows) { return(true); } else { return(false); } } catch (Exception) { throw; } finally { connectionClose(sqlbaglanti); } }
public static void bagisciGuncelle(Bagisci bagisci) { SqlConnection sqlbaglanti = openConnection(); SqlCommand veriOku = new SqlCommand("UPDATE bagisci SET adi=@adi,soyadi=@soyadi,kanGrubu=@kanGrubu," + "adresi=@adres,telefonNumarasi=@telefonNumarasi where kimlikNo=@kimlikNo", sqlbaglanti); veriOku.Parameters.AddWithValue("@kimlikNo", bagisci.getTcKimlikNo()); veriOku.Parameters.AddWithValue("@adi", bagisci.getAd()); veriOku.Parameters.AddWithValue("@soyadi", bagisci.getSoyad()); veriOku.Parameters.AddWithValue("@kanGrubu", bagisci.getKanGrubu()); veriOku.Parameters.AddWithValue("@adres", bagisci.getAdres()); veriOku.Parameters.AddWithValue("@telefonNumarasi", bagisci.getTelNo()); try { veriOku.ExecuteNonQuery(); } catch (Exception) { throw; } finally { connectionClose(sqlbaglanti); } }
public static void bagisciEkle(Bagisci bagisci) { SqlConnection sqlbaglanti = openConnection(); SqlCommand veriOku = new SqlCommand("INSERT INTO bagisci (kimlikNo,adi,soyadi,kanGrubu,adresi,telefonNumarasi) VALUES (@kimlikNo,@adi,@soyadi," + "@kanGrubu,@adres,@telefonNumarasi)", sqlbaglanti); veriOku.Parameters.AddWithValue("@kimlikNo", bagisci.getTcKimlikNo()); veriOku.Parameters.AddWithValue("@adi", bagisci.getAd()); veriOku.Parameters.AddWithValue("@soyadi", bagisci.getSoyad()); veriOku.Parameters.AddWithValue("@kanGrubu", bagisci.getKanGrubu()); veriOku.Parameters.AddWithValue("@adres", bagisci.getAdres()); veriOku.Parameters.AddWithValue("@telefonNumarasi", bagisci.getTelNo()); try { veriOku.ExecuteNonQuery(); } catch (Exception) { MessageBox.Show("alanları doğru giriniz lütfen!!!"); } finally { connectionClose(sqlbaglanti); } }
public static void bagisciSil(Bagisci bagisci) { SqlConnection sqlbaglanti = openConnection(); SqlCommand veriOku = new SqlCommand("DELETE FROM bagisci where kimlikNo=@tcNo", sqlbaglanti); veriOku.Parameters.AddWithValue("@tcNo", bagisci.getTcKimlikNo()); veriOku.ExecuteNonQuery(); connectionClose(sqlbaglanti); }