// BaseData class will be parent of BookData public void InsertReservation(SiCAP_GrupoCARARA.App_Domain.Reservation reservation) { SqlConnection connection = ManageDatabaseConnection("Open"); try { using(SqlCommand sqlCommand = new SqlCommand("insert_reservation", connection)) { sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.Add("@Date", SqlDbType.Date).Value = reservation.Date; sqlCommand.Parameters.Add("@IdTimeForReservation", SqlDbType.Int).Value = reservation.IdTimeForReservation; sqlCommand.Parameters.Add("@IdUser", SqlDbType.Int).Value = reservation.IdUser; sqlCommand.Parameters.Add("@IdParkingSpace", SqlDbType.Int).Value = reservation.IdParkingSpace; sqlCommand.Parameters.Add("@IdVehicle", SqlDbType.Int).Value = reservation.IdVehicle; sqlCommand.Parameters.Add("@HasBeenCanceled", SqlDbType.Bit).Value = reservation.HasBeenCanceled; //connection.Open(); sqlCommand.ExecuteNonQuery(); connection = ManageDatabaseConnection("Close"); } } catch (SqlException sqlException) { throw sqlException; } }
public void InsertReservation(SiCAP_GrupoCARARA.App_Domain.Reservation reservation) { reservationData.InsertReservation(reservation); }