private void LoadEcr3Tickets(List <OrderLine> orderLines)
        {
            //get all Ecr barcodes
            var barcodes = ImageDbService.GetOrderEcrBarcodes(_order.OrderNumber);

            //make sure we have some barcodes
            if (barcodes == null || barcodes.Count < 1)
            {
                Log("Barcodes failed to retrieve for ordernumber: " + _order.OrderNumber);
                return;
            }

            //group orderlines by barcode images
            foreach (var barcode in barcodes.ToList())
            {
                //get corresponding orderlines  *** when u save ticket id in barcodes, get our ticketid from ecr productuid
                var tempOrderLines = orderLines.Where(x => x.TicketId != null && x.TicketId.Value.ToString().Equals(barcode.TicketId, StringComparison.CurrentCultureIgnoreCase));

                if (!tempOrderLines.Any())
                {
                    continue;
                }

                var ticket = TicketService.GetTicketById(barcode.TicketId);

                var topOrderLine = tempOrderLines.FirstOrDefault();

                if (topOrderLine == null)
                {
                    continue;
                }

                var microsite = SiteService.GetMicroSiteById(topOrderLine.MicrositeId);

                var imageData = ImageDbService.GetImageMetaData(barcode.ImageId);

                LoadEcr3Ticket(tempOrderLines.ToList(), ticket, microsite, imageData);

                //var attractionMetaData = ticket.ImageMetaDataId != null
                //    ? ImageDbService.GetMetaData(ticket.ImageMetaDataId.Value.ToString())
                //    : null;

                //    MainList.Add(
                //            new VoucherTicket
                //            {
                //                UseQrCode = true,
                //                OrderLines = tempOrderLines.ToList(),
                //                Ticket = ticket,
                //                AttractionImageData = attractionMetaData,
                //                ImageData = ImageDbService.GetImageMetaData(barcode.ImageId),
                //                ValidTicketName = validTicketName
                //            }
                //        );
            }

            //PopulateVoucherTickets();
        }
Exemplo n.º 2
0
        private void LoadEcr3Tickets(List <OrderLine> orderLines)
        {
            _attractionCount = orderLines.Count(a =>
                                                a.TicketTorA.Equals("attraction", StringComparison.CurrentCultureIgnoreCase));

            //get all Ecr barcodes
            var barcodes = ImageDbService.GetOrderEcrBarcodes(_order.OrderNumber);

            //make sure we have some barcodes
            if (barcodes == null || barcodes.Count < 1)
            {
                Log("Barcodes failed to retrieve for ordernumber: " + _order.OrderNumber);
                return;
            }

            //group orderlines by barcode images
            foreach (var barcode in barcodes.ToList())
            {
                //get corresponding orderlines  *** when u save ticket id in barcodes, get our ticketid from ecr productuid
                var tempOrderLines = orderLines.Where(x => x.TicketId != null && x.TicketId.Value.ToString().Equals(barcode.TicketId, StringComparison.CurrentCultureIgnoreCase));

                if (!tempOrderLines.Any())
                {
                    continue;
                }

                var ticket = TicketService.GetTicketById(barcode.TicketId);

                var topOrderLine = tempOrderLines.FirstOrDefault();

                if (topOrderLine == null)
                {
                    continue;
                }

                var microsite = SiteService.GetMicroSiteById(topOrderLine.MicrositeId);

                var validTicketName = ticket.Name.ToLower().Contains(microsite.Name.ToLower())
                    ? ticket.Name
                    : string.Concat(microsite.Name, " ", ticket.Name);

                var voucherTicket =
                    new VoucherTicket
                {
                    UseQrCode       = true,
                    OrderLines      = tempOrderLines.ToList(),
                    Ticket          = ticket,
                    ImageData       = ImageDbService.GetImageMetaData(barcode.ImageId),
                    ValidTicketName = validTicketName
                };

                //only load ticket image if we have an attraction
                if (ticket.IsAttraction)
                {
                    voucherTicket.AttractionImageData = ticket.ImageMetaDataId != null
                       ? ImageDbService.GetMetaData(ticket.ImageMetaDataId.Value.ToString())
                       : null;
                }
            }

            //PopulateVoucherTickets();
        }