Exemple #1
0
        public TicketReservationPresentation ReserveTicketFor(string eventId, int noOfTkt)
        {
            TicketReservationPresentation reservationPresentation = new TicketReservationPresentation();

            DataContract.ReserveTicketRequest request = new DataContract.ReserveTicketRequest();
            request.EventId   = eventId;
            request.TicketQty = noOfTkt;
            try
            {
                var response = this._ticketService.ReserveTicket(request);
                if (response.Success)
                {
                    reservationPresentation.Description   = string.Format("Reservation succeeded");
                    reservationPresentation.EventId       = response.EventId;
                    reservationPresentation.ExpiryDate    = response.ExpirationTime;
                    reservationPresentation.ReservationId = response.ReservationNumber;
                    reservationPresentation.TicketWasSuccessfullyReserved = true;
                }
                else
                {
                    reservationPresentation.TicketWasSuccessfullyReserved = false;
                    reservationPresentation.Description = response.Message;
                }
            }
            catch (Exception ex)
            {
                reservationPresentation.TicketWasSuccessfullyReserved = false;
                reservationPresentation.Description = ex.Message;
            }
            return(reservationPresentation);
        }
Exemple #2
0
        /// <summary>
        /// 获取票务描述
        /// </summary>
        /// <param name="EventId"></param>
        /// <param name="NoOfTkts"></param>
        /// <returns></returns>
        public TicketReservationPresentation ReserveTicketsFor(string EventId, int NoOfTkts)
        {
            TicketReservationPresentation reservation = new TicketReservationPresentation();
            //订票响应
            ReserveTicketResponse response = new ReserveTicketResponse();
            //订票请求
            ReserveTicketRequest request = new ReserveTicketRequest();

            request.EventId        = EventId;
            request.TicketQuantity = NoOfTkts;

            response = _ticketService.ReserveTicket(request);

            if (response.Success)
            {
                reservation.TicketWasSuccessfullyReserved = true;
                reservation.ReservationId = response.ReservationNumber;
                reservation.ExpiryDate    = response.ExpirationDate;
                reservation.EventId       = response.EventId;
                reservation.Description   = String.Format("{0} ticket(s) reserved for {1}.<br/><small>This reservation will expire on {2} at {3}.</small>", response.NoOfTickets, response.EventName, response.ExpirationDate.ToLongDateString(), response.ExpirationDate.ToLongTimeString());
            }
            else
            {
                reservation.TicketWasSuccessfullyReserved = false;
                reservation.Description = response.Message;
            }

            return(reservation);
        }