public bool AracEkle(Araclar a) { bool Sonuc = false; SqlCommand comm = new SqlCommand("insert into Araclar (HavalimaniID,FirmaID,ModelID,Fiyat,KiradaMi) values(@HavalimaniID,@FirmaID,@ModelID,@Fiyat,@KiradaMi)", conn); comm.Parameters.Add("@HavalimaniID", SqlDbType.Int).Value = a._havalimaniID; comm.Parameters.Add("@FirmaID", SqlDbType.Int).Value = a._firmaID; comm.Parameters.Add("@ModelID", SqlDbType.Int).Value = a._modelID; comm.Parameters.Add("@Fiyat", SqlDbType.Money).Value = a._fiyat; comm.Parameters.Add("@KiradaMi", SqlDbType.Bit).Value = a._kiradaMi; 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); }
public bool AracGuncelle(Araclar a) { bool Sonuc = false; SqlCommand comm = new SqlCommand("update Araclar set HavalimaniID=@HavalimaniID,FirmaID=@FirmaID,ModelID=@ModelID,Fiyat=@Fiyat where PlakaID=@PlakaID", conn); comm.Parameters.Add("@HavalimaniID", SqlDbType.Int).Value = a._havalimaniID; comm.Parameters.Add("@ModelID", SqlDbType.Int).Value = a._modelID; comm.Parameters.Add("@FirmaID", SqlDbType.Int).Value = a._firmaID; comm.Parameters.Add("@Fiyat", SqlDbType.Money).Value = a._fiyat; comm.Parameters.Add("@PlakaID", SqlDbType.Int).Value = a.PlakaID; 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); }