Example #1
0
 public void ekle(Rezervasyon rezervasyon)
 {
     try
     {
         sqlConnection.Open();
         cmd = new SqlCommand("insert into Rezervasyon (masaID,ad,soyAd,telefon,tarih) values(@masaID,@ad,@soyAd,@telefon,@tarih)", sqlConnection);
         cmd.Parameters.AddWithValue("@ad", rezervasyon.ad);
         cmd.Parameters.AddWithValue("@soyAd", rezervasyon.soyAd);
         cmd.Parameters.AddWithValue("@telefon", rezervasyon.telefon);
         cmd.Parameters.AddWithValue("@masaID", rezervasyon.masaID);
         cmd.Parameters.AddWithValue("@tarih", DateTime.Now.ToUniversalTime().AddHours(3));
         cmd.ExecuteNonQuery();
         sqlConnection.Close();
     }
     catch (Exception)
     {
         if (sqlConnection.State == System.Data.ConnectionState.Open)
         {
             sqlConnection.Close();
         }
     }
 }