protected void deleteTripButton_Click(object sender, EventArgs e) { TripClass trip = new TripClass(); int numSeleccionado = 0; trip.deleteTrip(numSeleccionado); }
//Constructor of copy public TripClass(TripClass trip) { tripName = trip.TripName; idTrip = trip.Idtrip; tripCity = trip.TripCity; tripCountry = trip.TripCountry; tripContinent = trip.TripContinent; tripDate = trip.TripDate; tripState = trip.TripState; tripObservations = trip.TripObservations; }
protected void SaveTrip_Click(object sender, EventArgs e) { TripClass trip = new TripClass(); trip.TripName = NameNewTrip.ToString(); // trip.TripDate = DateTextBox.ToString(); trip.TripCountry = CityList1.SelectedValue.ToString(); trip.TripContinent = ContinentList1.SelectedValue.ToString(); trip.TripObservations = ObservationTextBox.ToString(); DateTime date = DateTime.Now; String vide = "vide"; trip.addTrip(vide, date, vide, true, vide, vide, vide, 2); }
/*USED IN THE EDITION OF TRIP * * DETAILS :This function edit the information of a selected trip * RETURN :An object trip. * */ public TripClass printOneTrip(int numTrip) { TripClass trip = new TripClass(); TripCAD tripDB = new TripCAD(); trip = tripDB.printOneTripCAD(numTrip); return trip; }
/*USED IN THE EDITION OF TRIP * * DETAILS :This function edit the information of a selected trip * RETURN :An object trip. * */ public TripClass printOneTripCAD(int numTrip) { TripClass trip = new TripClass(); try { c.Open(); SqlCommand com = new SqlCommand("Select * from TripTable where idTrip = numTrip", c); SqlDataReader reader = com.ExecuteReader(); trip.TripName = reader["tripName"].ToString(); trip.TripCity = reader["tripCity"].ToString(); trip.TripCity = reader["tripCountry"].ToString(); trip.TripContinent = reader["tripContinent"].ToString(); trip.TripDate = (DateTime)reader["tripDate"]; trip.TripObservations = reader["tripObservations"].ToString(); trip.TripState = (bool)reader["tripState"]; } catch (SqlException exp) { throw new Exception(exp.Message, null); } finally { c.Close(); } return trip; }