Пример #1
0
 public SyosSeatZone(int id, string description, PriceType[] priceTypes,
     SyosSeatGroup[] seatGroups)
 {
     Id = id;
     Description = description;
     PriceTypes = priceTypes;
     SeatGroups = seatGroups;
 }
Пример #2
0
        public static SyosSeatCollection GetSeatsForSyos(int perfId)
        {
            // Getting result sets from the API

            DataRowCollection seatRows;
            DataRowCollection sectionRows;
            DataRowCollection zoneRows;
            DataRowCollection zonePriceTypeRows;
            DataRowCollection priceTypeRows;

            DataSet results = unsecuredClient.GetSeats(
                sSessionKey: HttpContext.Current.Session[TessSessionKeySessionKey].ToString(),
                iPackageNumber: 0,
                iPerformanceNumber: perfId,
                sZoneList: "",
                sSectionList: "",
                sScreenList: "",
                cSummaryOnly: 'N',
                cCalcPackageAlloc: 'N',
                sCheckPriceTypes: "",
                cReturnNonSeats: 'N');
            seatRows = results.Tables["Seat"].Rows;
            sectionRows = results.Tables["Section"].Rows;
            results = unsecuredClient.GetPerformanceDetailWithDiscountingSYOSDataSet(
                SessionKey: HttpContext.Current.Session[TessSessionKeySessionKey].ToString(),
                iPerf_no: perfId,
                iModeOfSale: (short)HttpContext.Current.Session[ModeOfSaleSessionKey],
                sContentType: "");
            zoneRows = results.Tables["Section"].Rows;
            zonePriceTypeRows = results.Tables["SectionPriceTypes"].Rows;
            priceTypeRows = results.Tables["PriceTypes"].Rows;

            // Parsing results sets

            List<SyosSeatSection> sectionsList = new List<SyosSeatSection>();
            foreach (DataRow sectionRow in sectionRows)
            {
                int newSectionId = Convert.ToInt32(sectionRow["section"]);
                string newSectionName = sectionRow["section_desc"].ToString();

                List<SyosSeatZone> zonesList = new List<SyosSeatZone>();
                foreach (DataRow zoneRow in zoneRows)
                {
                    int newZoneId = Convert.ToInt32(zoneRow["Zone"]);
                    string newZoneName = zoneRow["Description"].ToString();

                    Dictionary<int, List<SyosSeat>> seatGroupList
                        = new Dictionary<int, List<SyosSeat>>();
                    foreach (DataRow seatRow in seatRows)
                    {
                        if (Convert.ToInt32(seatRow["zone_no"]) == newZoneId
                            && Convert.ToInt32(seatRow["section"]) == newSectionId
                            && (seatRow["hc_no"] == DBNull.Value
                            || !invisibleHoldCodes.Contains(Convert.ToInt32(seatRow["hc_no"]))))
                        {
                            SyosSeatStatus newStatus;
                            if (seatRow["hc_no"] != DBNull.Value)
                                newStatus = SyosSeatStatus.Unavailable;
                            else
                            {
                                bool seatFound = false;
                                if (HttpContext.Current.Session[SyosReservedSeatsSessionKey]
                                    != null)
                                {
                                    Dictionary<int, List<int>> syosReservedSeats =
                                        (Dictionary<int, List<int>>)
                                        HttpContext.Current.Session[SyosReservedSeatsSessionKey];
                                    if (syosReservedSeats.ContainsKey(perfId))
                                    {
                                        List<int> seats = syosReservedSeats[perfId];
                                        seatFound = seats.Contains(
                                            Convert.ToInt32(seatRow["seat_no"]));
                                    }
                                }
                                if (seatFound)
                                {
                                    newStatus = SyosSeatStatus.InCart;
                                }
                                else if (Convert.ToInt32(seatRow["seat_status"]) == 0)
                                {
                                    newStatus = SyosSeatStatus.Available;
                                }
                                else
                                {
                                    newStatus = SyosSeatStatus.Unavailable;
                                }
                            }
                            SyosSeat newSeat = new SyosSeat(
                                id: Convert.ToInt32(seatRow["seat_no"]),
                                number: Convert.ToInt32(seatRow["seat_num"]),
                                xposition: Convert.ToInt32(seatRow["xpos"]),
                                yposition: Convert.ToInt32(seatRow["ypos"]),
                                status: newStatus);
                            int groupId = Convert.ToInt32(seatRow["seat_row"]);
                            if (seatGroupList.ContainsKey(groupId))
                            {
                                seatGroupList[groupId].Add(newSeat);
                            }
                            else
                            {
                                List<SyosSeat> seatsList = new List<SyosSeat>();
                                seatsList.Add(newSeat);
                                seatGroupList.Add(groupId, seatsList);
                            }
                        }
                    }

                    if (seatGroupList.Count == 0)
                        continue;

                    List<PriceType> priceTypesList = new List<PriceType>();
                    foreach (DataRow zonePriceTypeRow in zonePriceTypeRows)
                    {
                        if (Convert.ToInt32(zonePriceTypeRow["Zone"]) == newZoneId)
                        {
                            int newPriceTypeId = Convert.ToInt32(zonePriceTypeRow["Id"]);
                            string newPriceTypeName = null;
                            bool newIsPromo = false;
                            foreach (DataRow priceTypeRow in priceTypeRows)
                            {
                                if (Convert.ToInt32(priceTypeRow["Id"]) == newPriceTypeId)
                                {
                                    newPriceTypeName = priceTypeRow["Description"].ToString();
                                    newIsPromo = Convert.ToBoolean(priceTypeRow["Promotion"]);
                                    break;
                                }
                            }
                            PriceType newPriceType = new PriceType(
                                id: newPriceTypeId,
                                name: newPriceTypeName,
                                price: Convert.ToInt32(zonePriceTypeRow["Price"]),
                                isDefault: false,
                                isPromo: newIsPromo);
                            priceTypesList.Add(newPriceType);
                        }
                    }

                    SyosSeatGroup[] seatGroups = new SyosSeatGroup[seatGroupList.Count];
                    int insertIndex = 0;
                    foreach (int groupId in seatGroupList.Keys)
                    {
                        SyosSeatGroup newSeatGroup = new SyosSeatGroup(
                            id: groupId,
                            seats: seatGroupList[groupId].ToArray());
                        seatGroups[insertIndex] = newSeatGroup;
                        insertIndex++;
                    }

                    SyosSeatZone newZone = new SyosSeatZone(
                        id: newZoneId,
                        description: newZoneName,
                        priceTypes: priceTypesList.ToArray(),
                        seatGroups: seatGroups);

                    zonesList.Add(newZone);
                }

                if (zonesList.Count == 0)
                    continue;

                SyosSeatSection newSection = new SyosSeatSection(
                    id: newSectionId,
                    name: newSectionName,
                    zones: zonesList.ToArray());

                sectionsList.Add(newSection);
            }

            if (sectionsList.Count == 0)
                return null;

            SyosSeatCollection newCollection = new SyosSeatCollection(sectionsList.ToArray(),
                Convert.ToInt32(results.Tables["Performance"].Rows[0]["ZoneMap"]));

            return newCollection;
        }
Пример #3
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();
        }