Example #1
0
        internal void SehileriGetir(ComboBox cbSehirler)
        {
            SqlCommand comm = new SqlCommand("select SehirID,SehirAdi from Sehirler where Silindi=0", conn);

            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            SqlDataReader dr;

            try
            {
                dr = comm.ExecuteReader();
                while (dr.Read())
                {
                    Rezerv r = new Rezerv();
                    r._SehirID = Convert.ToInt32(dr[0]);
                    r._Sehir   = dr[1].ToString();
                    cbSehirler.Items.Add(r);
                }
            }
            catch (Exception ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
        }
Example #2
0
        internal bool RezervDurumuDegistir(Rezerv r)
        {
            bool       sonuc = false;
            SqlCommand comm  = new SqlCommand("insert into RezDurum (TipID,VarisTarihi,AyrilisTarihi,RezerveMi,RezervasyonID) values(@TipID,@GirisTarihi,@CikisTarihi,@RezervMi,@RezervasyonID)", conn);

            comm.Parameters.Add("@RezervasyonID", SqlDbType.Int).Value    = _RezervasyonID;
            comm.Parameters.Add("@TipID", SqlDbType.Int).Value            = _TipID;
            comm.Parameters.Add("@GirisTarihi", SqlDbType.DateTime).Value = Convert.ToDateTime(_GirisTarihi);
            comm.Parameters.Add("@CikisTarihi", SqlDbType.DateTime).Value = Convert.ToDateTime(_CikisTarihi);
            comm.Parameters.Add("@RezervMi", SqlDbType.Bit).Value         = true;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                sonuc = Convert.ToBoolean(comm.ExecuteNonQuery());
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
            return(sonuc);
        }
Example #3
0
        internal int MusteriKaydet(Rezerv r)
        {
            int        sonuc = 0;
            SqlCommand comm  = new SqlCommand("insert into Musteriler(MusteriAdi,MusteriSoyadi,EvTelefonu,CepTelefonu,Adres,SehirID,TcKimlikNo) values (@MusteriAd,@MusteriSoyad,@EvTelefonu,@CepTelefonu,@Adres,@SehirID,@TcKimlikNo); Select SCOPE_IDENTITY()", conn);

            comm.Parameters.Add("@MusteriAd", SqlDbType.VarChar).Value    = _MusteriAd;
            comm.Parameters.Add("@MusteriSoyad", SqlDbType.VarChar).Value = _MusteriSoyad;
            comm.Parameters.Add("@EvTelefonu", SqlDbType.VarChar).Value   = _EvTelefon;
            comm.Parameters.Add("@CepTelefonu", SqlDbType.VarChar).Value  = _CepTelefon;
            comm.Parameters.Add("@Adres", SqlDbType.VarChar).Value        = _Adres;
            comm.Parameters.Add("@SehirID", SqlDbType.Int).Value          = _SehirID;
            comm.Parameters.Add("@TcKimlikNo", SqlDbType.VarChar).Value   = _MusteriTc;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                sonuc = Convert.ToInt32(comm.ExecuteScalar());
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            return(sonuc);
        }
Example #4
0
        internal int rezervasyonKaydet(Rezerv r)
        {
            int        sonuc = 0;
            SqlCommand comm  = new SqlCommand("insert into Rezervasyon (GirisTarihi,CikisTarihi,MusteriID,OtelID,Adet,ToplamFiyat,TipID) values (@GirisTarihi,@CikisTarihi,@MusteriID,@OtelID,@Adet,@ToplamFiyat,@TipID); Select SCOPE_IDENTITY()", conn);

            comm.Parameters.Add("@GirisTarihi", SqlDbType.DateTime).Value = Convert.ToDateTime(_GirisTarihi);
            comm.Parameters.Add("@CikisTarihi", SqlDbType.DateTime).Value = Convert.ToDateTime(_CikisTarihi);
            comm.Parameters.Add("@MusteriID", SqlDbType.Int).Value        = _MusteriID;
            comm.Parameters.Add("@OtelID", SqlDbType.Int).Value           = _OtelID;
            comm.Parameters.Add("@Adet", SqlDbType.Int).Value             = _Adet;
            comm.Parameters.Add("@ToplamFiyat", SqlDbType.Money).Value    = _Fiyat;
            comm.Parameters.Add("@TipID", SqlDbType.Int).Value            = _TipID;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            try
            {
                sonuc = Convert.ToInt32(comm.ExecuteScalar());
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
            return(sonuc);
        }
Example #5
0
        internal bool MusteriKontrol(Rezerv r)
        {
            bool       varmi = false;
            SqlCommand comm  = new SqlCommand("select Count(*) from Musteriler where TcKimlikNo=@MusteriTc", conn);

            comm.Parameters.Add("@MusteriTc", SqlDbType.VarChar).Value = r.MusteriTc;
            if (conn.State == ConnectionState.Closed)
            {
                conn.Open();
            }
            int sayi = 0;

            try
            {
                sayi = Convert.ToInt32(comm.ExecuteScalar());
                if (sayi > 0)
                {
                    varmi = true;
                }
            }
            catch (SqlException ex)
            {
                string hata = ex.Message;
            }
            finally { conn.Close(); }
            return(varmi);
        }