Exemplo n.º 1
0
        private void GetTickets(List <TicketPriceQty> tickets, int UserID)
        {
            StringBuilder sb = new StringBuilder();

            ServiceReference1.MiidWebServiceSoapClient client = new ServiceReference1.MiidWebServiceSoapClient();
            bool IsBoxOffice = true;


            foreach (var ticket in tickets)
            {
                int x = 0;
                while (x < ticket.Qty)
                {
                    sb.Append(String.Format("{0};", ticket.TicketClassID));
                    x++;
                }
            }
            //Send a string of ticketclassIDs of the exact qty required
            try
            {
                PurchasedTickets = TicketClassRepository.DeserialiseTicketString(client.PurchaseBoxOfficeTickets(sb.ToString(), UserID));
            }
            catch (Exception e)
            {
                // lblError
            }
        }
Exemplo n.º 2
0
        private void GetTickets(List <TicketPriceQty> tickets, int UserID)
        {
            List <TicketClassTuple> FailedResult = new List <TicketClassTuple>();

            try
            {
                StringBuilder sb = new StringBuilder();
                ServiceReference1.MiidWebServiceSoapClient client = new ServiceReference1.MiidWebServiceSoapClient();
                bool IsBoxOffice = true;


                foreach (var ticket in tickets)
                {
                    int x = 0;
                    while (x < ticket.Qty)
                    {
                        sb.Append(String.Format("{0};", ticket.TicketClassID));
                        x++;
                    }
                }
                //Send a string of ticketclassIDs of the exact qty required
                try
                {
                    string purchaseResult = client.PurchaseBoxOfficeTickets(sb.ToString(), UserID, Global.PosID);

                    if (purchaseResult.ToLower().Contains("error"))
                    {
                        lblError.Visible = true;


                        string        error = purchaseResult.Split('|')[0];
                        StringBuilder sv    = new StringBuilder();


                        FailedResult = JsonConvert.DeserializeObject <List <TicketClassTuple> >(purchaseResult.Split('|')[1]);
                        foreach (var f in FailedResult)
                        {
                            sv.Append(String.Format("{0} - ({1}) ,", f.TicketClassName, f.Count));
                        }

                        lblError.Text = "Entire Purchase cancelled. Not enough tickets available \n at time of purchase for these types: " + sv.ToString();
                    }
                    else
                    {
                        PurchasedTickets = TicketClassRepository.DeserialiseTicketString(purchaseResult);
                    }
                }
                catch (Exception e)
                {
                    lblError.Visible = true;
                    lblError.Text    = "Web service offline: " + e.Message;
                }
            }
            catch (Exception ex)
            {
                lblError.Visible = true;
                lblError.Text    = "Web service offline: " + ex.Message;
            }
        }