Esempio n. 1
0
        private void PrepareBestSeatingSelection(SeatingZone[] seatOptions)
        {
            SelectionModeViews.SetActiveView(BestSeatingModeView);

            int seatChoiceMax = Int32.Parse(WebConfigurationManager.AppSettings[
                "nysf_Apps_Ost_MaxSeatQuantityChoicePerSection"]);
            StringBuilder seatQuantityOptions = new StringBuilder();
            seatQuantityOptions.AppendLine(
                "<option value=\"0\" selected=\"selected\">0</option>");
            for (int c = 1; c <= seatChoiceMax; c++)
            {
                seatQuantityOptions.AppendLine(
                    "<option value=\"" + c.ToString() + "\">" + c.ToString() + "</option>");
            }

            StringBuilder seatingTableRows = new StringBuilder();
            foreach (SeatingZone section in seatOptions)
            {
                seatingTableRows.AppendLine("<tr>");
                seatingTableRows.AppendLine("<td>" + section.Name + "</td>");
                seatingTableRows.AppendLine("<td>"
                    + section.PriceTypes[0].Price.ToString("C") + "</td>");
                seatingTableRows.AppendLine("<td>");
                seatingTableRows.AppendLine("<select name=\"seats_" + section.Id.ToString()
                    + "_" + section.PriceTypes[0].Id.ToString() + "\">");
                seatingTableRows.Append(seatQuantityOptions.ToString());
                seatingTableRows.AppendLine("</select>");
                seatingTableRows.AppendLine("</td>");
                seatingTableRows.AppendLine("</tr>");
            }

            SeatingRowsOutput.Text = seatingTableRows.ToString();
        }
Esempio n. 2
0
        public static SeatingZone[] GetSeatingZonesAndPrices(int perfId)
        {
            if (HttpContext.Current.Session[TessSessionKeySessionKey] == null)
                MaintainTessSession();
            DataSet results = unsecuredClient.GetPerformanceDetailWithDiscountingEx(
                SessionKey: HttpContext.Current.Session[TessSessionKeySessionKey].ToString(),
                iPerf_no: perfId,
                iModeOfSale: (short)HttpContext.Current.Session[ModeOfSaleSessionKey],
                sContentType: "");
            //DataSet results2=unsecuredClient.GetSeats(
            //    sSessionKey: HttpContext.Current.Session[TessSessionKeySessionKey].ToString(),
            //    iPackageNumber: 0,
            //    iPerformanceNumber:perfId,
            //    sZoneList: "",
            //    sSectionList: "",
            //    sScreenList: "",
            //    cSummaryOnly: 'N',
            //    cCalcPackageAlloc:'Y',
            //    sCheckPriceTypes: "",
            //    cReturnNonSeats: 'N');

            //ArrayList seats = new ArrayList();
            //ArrayList statusFiveSeats = new ArrayList();
            //foreach (DataRow row in results2.Tables["Seat"].Rows){
            //    string[] temp=new string[4];

            //        temp[0] = row["section"].ToString();
            //        temp[1] = row["seat_row"].ToString();
            //        temp[2] = row["seat_num"].ToString();
            //        temp[3] = row["seat_status"].ToString();
            //        if ((int)row["seat_status"] == 5)
            //            statusFiveSeats.Add(temp);
            //        else
            //            seats.Add(temp);

            //}
            DataRowCollection zoneRows = results.Tables["Price"].Rows;
            DataRowCollection priceTypeRows = results.Tables["PriceType"].Rows;
            DataRowCollection allPriceZoneComboRows = results.Tables["AllPrice"].Rows;

            List<SeatingZone> zones = new List<SeatingZone>();
            foreach (DataRow zoneRow in zoneRows)
            {
                int tempSeatCount = 0;
                if (zoneRow["avail_count"] != DBNull.Value)
                    tempSeatCount = Convert.ToInt32(zoneRow["avail_count"]);
                if (tempSeatCount > 0)
                {
                    int tempZoneId = Convert.ToInt32(zoneRow["zone_no"]);
                    string tempZoneName = zoneRow["description"].ToString();
                    List<PriceType> tempPriceTypes = new List<PriceType>();
                    foreach (DataRow priceTypeRow in priceTypeRows)
                    {
                        int tempPriceTypeId = Convert.ToInt32(priceTypeRow["price_type"]);
                        foreach (DataRow allPriceRow in allPriceZoneComboRows)
                        {
                            int allPriceZoneId = Convert.ToInt32(allPriceRow["zone_no"]);
                            int allPricePriceTypeId = Convert.ToInt32(allPriceRow["price_type"]);
                            if (tempZoneId == allPriceZoneId
                                && tempPriceTypeId == allPricePriceTypeId)
                            {
                                string tempPriceTypeName = priceTypeRow["description"].ToString();
                                double tempPrice = Convert.ToDouble(allPriceRow["price"]);
                                bool tempIsDefault =
                                    priceTypeRow["def_price_type"].ToString() == "Y";
                                bool tempIsPromo =
                                    priceTypeRow["promo"].ToString() == "Y";
                                PriceType tempPriceType = new PriceType(tempPriceTypeId,
                                    tempPriceTypeName, tempPrice, tempIsDefault, tempIsPromo);
                                tempPriceTypes.Add(tempPriceType);
                                break;
                            }
                        }
                    }
                    SeatingZone tempZone = new SeatingZone(tempZoneId, tempZoneName, tempSeatCount,
                        tempPriceTypes.ToArray());
                    zones.Add(tempZone);
                }
            }
            return zones.ToArray();
        }
Esempio n. 3
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;
        }