Esempio n. 1
0
        public void buildCart(Cart cart)
        {
            if (cart != null && cart.HasItems)
            {
                string html = "";
                orderSummaryDiv.Style["Height"] = (300 + (cart.SeatGroups.Count - 1) * 170).ToString() + "px";
                foreach (CartSeatGroupItem item in cart.SeatGroups)
                {
                    string seatingChartHref = null;
                    seatingChartHref = GetSeatingChartHref(item.Performance.VenueId);

                    html += "<ul>";
                    html += ("<li class=\"perfNameRow\">" + item.Performance.Name + "</li>");
                    html += ("<li><span class=\"orderSumLeftCol\">Date/time: </span><span class=\"orderSumRightCol\">" + item.Performance.StartTime.ToString("MMM d, h:mm tt") + "</span></li>");
                    html += ("<li><span class=\"orderSumLeftCol\">Venue: </span><span class=\"orderSumRightCol\">" + item.Performance.VenueName + "</span></li>");
                    html += ("<li><span class=\"orderSumLeftCol\">Seat" + ((item.SeatCount > 1) ? "s" : "") + ":</span><span class=\"orderSumRightCol\">" + getSeatString(item) + "</span></li>");
                    html += ("<li><span class=\"orderSumLeftCol\">Quantity/Unit Price: </span><span class=\"orderSumRightCol\">" + item.SeatCount.ToString() + "@ " + (item.SubTotal / item.SeatCount).ToString("C") + "</span></li>");
                    html += ("<li><span class=\"orderSumLeftCol\">Price: </span><span class=\"orderSumRightCol\">" + item.SubTotal.ToString("C") + "</span></li>");
                    if (!String.IsNullOrEmpty(seatingChartHref))
                        html += ("<li class=\"alignRight\">" + "<a href=\"" + seatingChartHref + "\" target=\"_blank\" title=\""
                            + item.Performance.VenueName + " seating chart\">Seating "
                            + "chart</a>" + "</li>");
                    html += ("<li class=\"alignRight\"><input type=\"submit\"  class=\"submitLink\" name=\"remove_"
                         + item.Performance.Id.ToString() + "_" + item.Id.ToString() + "\" value=\"Remove\" /></li>");
                    html += "</ul>";

                    html += "<br/>";

                }
                summaryDiv.InnerHtml = html;
                subTotalDiv.InnerHtml = "Subtotal: " + cart.SubTotal.ToString("C") + "<br/>";
                foreach (CartFee fee in cart.FeeSumPerType)
                {
                    subTotalDiv.InnerHtml += (fee.Description + ": ");
                    subTotalDiv.InnerHtml += fee.Amount.ToString("C") + "<br/>"; ;
                }
                summaryFooter.InnerHtml = "Grand Total:" + cart.Total.ToString("C");
            }
            else
            {
                summaryDiv.InnerHtml = "Cart is empty";
                orderSummaryDiv.Style["Height"] = "50px";
                summaryFooter.InnerHtml = "";
            }
        }
Esempio n. 2
0
 // TODO: consider: is there ever a time to set exceptionOnSessionError to false?
 /// <summary>
 ///     Gets the cart for the current session, or returns null for an expired cart.
 /// </summary>
 /// <param name="exceptionOnSessionError">
 ///     Whether the method should throw an exception when lacking an authenticated session.
 /// </param>
 public static Cart GetCart(bool exceptionOnSessionError)
 {
     DataSet cartResults = null;
     if (!MaintainedSessionExists())
     {
         if (exceptionOnSessionError)
             // TODO: Check if it's safe to call MaintainTessSession() automatically
             throw new ApplicationException("GetCart() was called out of sequence. A "
                 + "maintained Tessitura session is required. Try calling "
                 + "MaintainTessSession() first.");
     }
     else
     {
         try
         {
             cartResults = unsecuredClient.GetCart(
                 HttpContext.Current.Session[TessSessionKeySessionKey].ToString());
         }
         catch (Exception exception)
         {
             if (exception.Message.Contains("TESSITURA_ACCESS_DENIED_EXCEPTION"))
             {
                 Logout();
                 //HttpContext.Current.Response.Redirect("/");
             }
             else if (!exception.Message.Contains("TESSITURA_SEAT_LOCKING_EXCEPTION"))
                 throw exception;
         }
     }
     //            if (cartResults != null && cartResults.Tables["Order"] != null
     //                && cartResults.Tables["LineItem"] != null)
     if (cartResults != null && cartResults.Tables["Order"].Rows.Count > 0)
     {
         Cart cart = new Cart();
         cart.Id = Convert.ToInt32(cartResults.Tables["Order"].Rows[0]["order_no"]);
         cart.SeatGroups = new List<CartSeatGroupItem>();
         DataRowCollection lineItemResults = cartResults.Tables["LineItem"].Rows;
         foreach (DataRow lineItemResult in lineItemResults)
         {
             CartSeatGroupItem seatGroup = new CartSeatGroupItem();
             seatGroup.Id = Convert.ToInt32(lineItemResult["li_seq_no"]);
             seatGroup.Performance = GetPerformance(Convert.ToInt32(lineItemResult["perf_no"]));
             seatGroup.SeatingZoneId = Convert.ToInt32(lineItemResult["zone_no"]);
             seatGroup.SeatingZoneName = null;
             seatGroup.SeatsPerPriceTypes = new List<CartPriceTypeSeats>();
             DataRowCollection subLineItemResults = cartResults.Tables["SubLineItem"].Rows;
             foreach (DataRow subLineItemResult in subLineItemResults)
             {
                 if (subLineItemResult["li_seq_no"].ToString()== lineItemResult["li_seq_no"].ToString())
                 {
                     if (seatGroup.SeatingZoneName == null)
                     {
                         seatGroup.SeatingZoneName =
                             subLineItemResult["zone_desc"].ToString();
                     }
                     int foundIndex = -1;
                     for (int c = 0; c < seatGroup.SeatsPerPriceTypes.Count; c++)
                     {
                         if (seatGroup.SeatsPerPriceTypes[c].PriceTypeId
                             == Convert.ToInt32(subLineItemResult["price_type"]))
                         {
                             foundIndex = c;
                             break;
                         }
                     }
                     CartPriceTypeSeats priceTypeSeats = new CartPriceTypeSeats();
                     priceTypeSeats.PriceTypeId =Convert.ToInt32(subLineItemResult["price_type"]);
                     foreach (DataRow priceTypeResult in cartResults.Tables["PriceType"].Rows)
                     {
                         if (Convert.ToInt32(priceTypeResult["price_type"])== priceTypeSeats.PriceTypeId)
                         {
                             priceTypeSeats.PriceTypeName =priceTypeResult["description"].ToString();
                             priceTypeSeats.PriceTypeIsDefault =Convert.ToChar(priceTypeResult["def_price_type"])== 'Y';
                             break;
                         }
                     }
                     priceTypeSeats.PricePerSeat = Convert.ToDouble(subLineItemResult["due_amt"]);
                     priceTypeSeats.SeatCount = 1;
                     priceTypeSeats.Seats = new List<CartSeat>();
                     CartSeat newSeat = new CartSeat();
                     newSeat.RowIdentifier = subLineItemResult["seat_row"].ToString();
                     newSeat.SeatNumInRow = Convert.ToInt32(subLineItemResult["seat_num"]);
                     newSeat.Id = Convert.ToInt32(subLineItemResult["seat_no"]);
                     newSeat.Fees = new List<CartFee>();
                     foreach (DataRow feeResult in cartResults.Tables["SubLineItemFee"].Rows)
                     {
                         if (Convert.ToInt32(subLineItemResult["sli_no"])
                             == Convert.ToInt32(feeResult["sli_no"]))
                         {
                             newSeat.Fees.Add(new CartFee
                             {
                                 Amount = Convert.ToDouble(feeResult["fee_amt"]),
                                 Description = feeResult["category_desc"].ToString()
                             });
                         }
                     }
                     priceTypeSeats.Seats.Add(newSeat);
                     if (foundIndex == -1)
                     {
                         seatGroup.SeatsPerPriceTypes.Add(priceTypeSeats);
                     }
                     else
                     {
                         seatGroup.SeatsPerPriceTypes[foundIndex].Absorb(priceTypeSeats);
                     }
                 }
             }
             cart.SeatGroups.Add(seatGroup);
         }
         return cart;
     }
     else
     {
         return null;
     }
 }
Esempio n. 3
0
 private void FillListFromSummaryCart(BulletedList list, Cart summaryCart)
 {
     foreach (CartSeatGroupItem seatGroup in summaryCart.SeatGroups)
     {
         if (seatGroup.SeatsPerPriceTypes.Count == 1)
         {
             list.Items.Add(seatGroup.SeatingZoneName + ", "
                 + seatGroup.SeatsPerPriceTypes[0].SeatCount.ToString() + " seat"
                 + (seatGroup.SeatsPerPriceTypes[0].SeatCount > 1 ? "s" : ""));
         }
         else
         {
             foreach (CartPriceTypeSeats seatsPerPriceType in seatGroup.SeatsPerPriceTypes)
             {
                 list.Items.Add(seatGroup.SeatingZoneName + ", "
                     + seatsPerPriceType.SeatCount.ToString() + " seat"
                     + (seatsPerPriceType.SeatCount > 1 ? "s" : "")
                     + " (" + seatsPerPriceType.PriceTypeName + ")");
             }
         }
     }
 }
Esempio n. 4
0
        public static Cart BuildSummaryCart(Reservation reservation, SeatingZone[] seatingInfo)
        {
            Cart cart = new Cart();
            List<CartSeatGroupItem> seatGroups = cart.SeatGroups = new List<CartSeatGroupItem>();

            foreach (ReservationSeatingZone seatingZone in reservation.Sections)
            {
                CartSeatGroupItem newItem = new CartSeatGroupItem();
                newItem.Performance = WebClient.GetPerformance(reservation.PerfId);
                string description = null;
                foreach (SeatingZone zone in seatingInfo)
                {
                    if (zone.Id == seatingZone.SectionId)
                    {
                        description = zone.Name;
                        break;
                    }
                }
                newItem.SeatingZoneName = description;
                newItem.SeatingZoneId = seatingZone.SectionId;
                newItem.SeatsPerPriceTypes = new List<CartPriceTypeSeats>();
                foreach (PriceTypeSeatsPair seatsPerPriceType in seatingZone.PriceTypesSeats)
                {
                    double pricePerSeat = 0;
                    string priceTypeName = null;
                    bool found = false;
                    foreach (SeatingZone zone in seatingInfo)
                    {
                        if (zone.Id == seatingZone.SectionId)
                        {
                            foreach (PriceType priceType in zone.PriceTypes)
                            {
                                if (priceType.Id == seatsPerPriceType.PriceTypeId)
                                {
                                    pricePerSeat = priceType.Price;
                                    priceTypeName = priceType.Name;
                                    found = true;
                                    break;
                                }
                            }
                            if (found)
                                break;
                        }
                    }
                    newItem.SeatsPerPriceTypes.Add(
                        new CartPriceTypeSeats
                        {
                            SeatCount = seatsPerPriceType.SeatCount,
                            PricePerSeat = pricePerSeat,
                            PriceTypeName = priceTypeName
                        });
                }
                seatGroups.Add(newItem);
            }
            return cart;
        }
 private void buildCart(Cart cart)
 {
     cartWidget.buildCart(cart);
     amountLiteral.Text = cart.Total.ToString("C");
     UpdatePanel1.Update();
     UpdatePanel2.Update();
 }