public TicketPresentation PurchaseTicketWithReservation(string eventId, string reservationId) { TicketPresentation ticketPresentation = new TicketPresentation(); DataContract.PurchaseTicketRequest request = new DataContract.PurchaseTicketRequest(); request.EventId = eventId; request.ReservationId = reservationId; request.CorrelationId = reservationId; try { var response = this._ticketService.PurchaseTicket(request); if (response.Success) { ticketPresentation.Description = string.Format("Reservation succeeded"); ticketPresentation.EventId = response.EventId; ticketPresentation.TicketId = response.TicketId; ticketPresentation.WasAbleToPurchaseTicket = true; } else { ticketPresentation.WasAbleToPurchaseTicket = false; ticketPresentation.Description = response.Message; } } catch (Exception ex) { ticketPresentation.WasAbleToPurchaseTicket = false; ticketPresentation.Description = ex.Message; } return(ticketPresentation); }
/// <summary> /// 购买已经预定的票 /// </summary> /// <param name="EventId"></param> /// <param name="ReservationId"></param> /// <returns></returns> public TicketPresentation PurchaseReservedTicket(string EventId, string ReservationId) { TicketPresentation ticket = new TicketPresentation(); PurchaseTicketResponse response = new PurchaseTicketResponse(); PurchaseTicketRequest request = new PurchaseTicketRequest(); request.ReservationId = ReservationId; request.EventId = EventId; request.CorrelationId = ReservationId; // In this instance we can use the ReservationId response = _ticketService.PurchaseTicket(request); if (response.Success) { ticket.Description = String.Format("{0} ticket(s) purchased for {1}.<br/><small>Your e-ticket id is {2}.</small>", response.NoOfTickets, response.EventName, response.TicketId); ticket.EventId = response.EventId; ticket.TicketId = response.TicketId; ticket.WasAbleToPurchaseTicket = true; } else { ticket.WasAbleToPurchaseTicket = false; ticket.Description = response.Message; } return(ticket); }