private void button2_Click(object sender, RoutedEventArgs e) { using (AttractionServiceClient asc = new AttractionServiceClient()) { AttractieServiceOnline.Person pers = asc.getPerson(CommonMethods.loginUser.name, CommonMethods.loginUser.lastname); if (pers == null) pers = asc.registerPerson(CommonMethods.loginUser.name, CommonMethods.loginUser.lastname, CommonMethods.loginUser.telefoon, CommonMethods.loginUser.email, "??", "", CommonMethods.loginUser.woonplaats, CommonMethods.loginUser.postcode); if (pers == null) { textBlock1.Text = "Fout bij het aanmaken van persoon bij de service provider."; textBlock1.Foreground = Brushes.Red; return; } AttractieServiceOnline.Person person = asc.bookTickets(plannedTickets, CommonMethods.loginUser.name, CommonMethods.loginUser.lastname); if (person == null) { textBlock1.Text = "Fout bij het boeken van de tickets."; textBlock1.Foreground = Brushes.Red; return; } OracleConnection oc = CommonMethods.GetConnection(); oc.Open(); OracleCommand ocmd = oc.CreateCommand(); ocmd.CommandText = String.Format("DELETE FROM BOOKING WHERE END_PERSOON = '{0}'", CommonMethods.loginUser.id); foreach (AttractieServiceOnline.Booking b in person.Booking) { ocmd.CommandText = String.Format("INSERT INTO BOOKING (IDENTIFIER, TYPE, END_PERSOON) VALUES ('{0}', '{1}', '{2}')", b.Id, "attraction", CommonMethods.loginUser.id); ocmd.ExecuteNonQuery(); } oc.Close(); CommonMethods.GetFrame(this).Navigate(new ResultPage()); } }
public BookingAttractionInfo(ClientBooking b) { InitializeComponent(); this.cb = b; using (AttractionServiceClient asc = new AttractionServiceClient()) { AttractieServiceOnline.Person person = asc.getPerson(CommonMethods.loginUser.name, CommonMethods.loginUser.lastname); foreach (AttractieServiceOnline.Booking book in person.Booking) { if (book.Id == Int32.Parse(cb.bookingidentifier)) { tb_Attractie.Text = book.Ticket.Name; tb_Ticket.Text = book.Ticket.Attraction.Name; tb_AttractionDescription.Text = book.Ticket.Attraction.Description; } } } }