Beispiel #1
0
        public static bool hastaneeArama(Hastane hastane)
        {
            SqlConnection sqlbaglanti = openConnection();

            try
            {
                SqlCommand veriOku = new SqlCommand("select hastaneKodu from hastane where hastaneKodu=@hastaneKodu", sqlbaglanti);

                veriOku.Parameters.AddWithValue("@hastaneKodu", hastane.getHastaneKodu());



                SqlDataReader rdr = veriOku.ExecuteReader();
                rdr.Read();

                if (rdr.HasRows)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                connectionClose(sqlbaglanti);
            }
        }
Beispiel #2
0
        public static void hastaneSil(Hastane hastane)
        {
            SqlConnection sqlbaglanti = openConnection();

            SqlCommand veriOku = new SqlCommand("DELETE FROM hastane where hastaneKodu=@hastaneKodu", sqlbaglanti);

            veriOku.Parameters.AddWithValue("@hastaneKodu", hastane.getHastaneKodu());
            veriOku.ExecuteNonQuery();
            connectionClose(sqlbaglanti);
        }
Beispiel #3
0
        public static void hastaneEkle(Hastane hastane)
        {
            SqlConnection sqlbaglanti = openConnection();
            SqlCommand    veriOku     = new SqlCommand("INSERT INTO hastane (hastaneKodu,adi,adresi) VALUES (@hastaneKodu,@adi,@adresi)", sqlbaglanti);

            veriOku.Parameters.AddWithValue("@hastaneKodu", hastane.getHastaneKodu());
            veriOku.Parameters.AddWithValue("@adi", hastane.getAdi());
            veriOku.Parameters.AddWithValue("@adresi", hastane.getAdresi());

            try
            {
                veriOku.ExecuteNonQuery();
            }
            catch (Exception)
            {
            }
            finally
            {
                connectionClose(sqlbaglanti);
            }
        }
Beispiel #4
0
        public static void hastaneGuncelle(Hastane hastane)
        {
            SqlConnection sqlbaglanti = openConnection();
            SqlCommand    veriOku     = new SqlCommand("UPDATE hastane SET adi=@adi,adresi=@adres where hastaneKodu=@hastaneKodu", sqlbaglanti);

            veriOku.Parameters.AddWithValue("@hastaneKodu", hastane.getHastaneKodu());
            veriOku.Parameters.AddWithValue("@adi", hastane.getAdi());
            veriOku.Parameters.AddWithValue("@adres", hastane.getAdresi());



            try
            {
                veriOku.ExecuteNonQuery();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                connectionClose(sqlbaglanti);
            }
        }