private void LoadAttractionsForEcr1(List <OrderLine> attractionOrderLines) { // group these orderlines by ticketid var ticketGroups = from detail in attractionOrderLines group detail by detail.TicketId into ticketGroup orderby ticketGroup.Key select ticketGroup; //loog through all ticket groups and make vouchers foreach (var ticketgroup in ticketGroups) { var ticketId = ticketgroup.Key.Value.ToString(); var ticketOrderlines = attractionOrderLines.Where(x => x.TicketId.Value.ToString().Equals(ticketId, StringComparison.CurrentCultureIgnoreCase) ); //since they all have the same ticket lest get the first one to work with var topOrderLine = ticketOrderlines.FirstOrDefault(); //get corresponding site data var orderLineData = _orderlineData.FirstOrDefault(x => x.OrderLineId.Equals(topOrderLine.Id.ToString(), StringComparison.CurrentCultureIgnoreCase)); //only generate qr code if site supports qr code if (orderLineData.UseQrCode) { //make the qr image var filePath = MakeAttractionQrCode(_order, ticketOrderlines.ToList(), ticketId); //*** use file path and create the Voucher. var ticket = TicketService.GetTicketById(ticketId); var validTicketName = ticket.Name.ToLower().Contains(orderLineData.MicrositeName) ? ticket.Name : string.Concat(orderLineData.MicrositeName, " ", ticket.Name); var attractionMetaData = ticket.ImageMetaDataId != null ? ImageDbService.GetMetaData(ticket.ImageMetaDataId.Value.ToString()) : null; MainList.Add( new VoucherTicket { UseQrCode = true, OrderLines = ticketOrderlines.ToList(), Ticket = ticket, AttractionImageData = attractionMetaData, ValidTicketName = validTicketName, QrCodeImageUrl = filePath } ); } } }
public VoucherTicket LoadVoucherTicketWithQrcode(Order order, List <OrderLine> orderLines, Ticket ticket, MicroSite microsite) { var validTicketName = ticket.Name.ToLower().Contains(microsite.Name.ToLower()) ? ticket.Name : string.Concat(microsite.Name, " ", ticket.Name); var attractionMetaData = ticket.ImageMetaDataId != null ? ImageDbService.GetMetaData(ticket.ImageMetaDataId.Value.ToString()) : null; var qrCodeImageData = GetOrderImageMetaData(order); return (new VoucherTicket { UseQrCode = true, OrderLines = orderLines, Ticket = ticket, AttractionImageData = attractionMetaData, ImageData = qrCodeImageData, ValidTicketName = validTicketName }); }
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(); }