private void PrepareSyosMap(SyosSeatCollection collection, bool displayConditions) { SelectionModeViews.SetActiveView(SyosModeView); for (int c = collection.PriceScale.Count-1; c >= 0; c--) { if (collection.PriceScale[c] < 0) continue; HtmlGenericControl newColorLi = new HtmlGenericControl("li"); newColorLi.Attributes.Add("class", "SyosPriceScaleX" + c.ToString()); newColorLi.InnerHtml = collection.PriceScale[c].ToString("C"); ColorLegend.Controls.AddAt(0, newColorLi); } SyosSeatOptions.Attributes["class"] = "ArrangedByJs SyosMap SyosMapId" + collection.ZoneMapId.ToString(); foreach (SyosSeatSection section in collection.Sections) { HtmlGenericControl newSectionDiv = new HtmlGenericControl("div"); newSectionDiv.Attributes["class"] = "SyosSection SyosSectionId" + section.Id.ToString(); HtmlGenericControl newSectionH = new HtmlGenericControl("h4"); newSectionH.InnerText = section.Name; newSectionDiv.Controls.Add(newSectionH); HtmlGenericControl newSectionDisDiv = new HtmlGenericControl("div"); newSectionDisDiv.Attributes["class"] = "SyosDisclaimers"; /*HtmlGenericControl newSectionDisH = new HtmlGenericControl("h5"); newSectionDisH.InnerText = "Conditions"; newSectionDisDiv.Controls.Add(newSectionDisH);*/ if (displayConditions && syosSeatingConditions.Keys.Contains(section.Id) && !String.IsNullOrWhiteSpace(syosSeatingConditions[section.Id])) { newSectionDisDiv.InnerHtml = syosSeatingConditions[section.Id]; } newSectionDiv.Controls.Add(newSectionDisDiv); HtmlGenericControl newSectionZonesDiv = new HtmlGenericControl("div"); newSectionZonesDiv.Attributes["class"] = "SyosZones"; HtmlGenericControl newSectionZonesH = new HtmlGenericControl("h5"); newSectionZonesH.InnerText = "Zones"; newSectionZonesDiv.Controls.Add(newSectionZonesH); foreach (SyosSeatZone zone in section.Zones) { HtmlGenericControl newZoneDiv = new HtmlGenericControl("div"); newZoneDiv.Attributes["class"] = "SyosZone SyosZoneId" + zone.Id.ToString() + " SyosPriceScaleX" + collection.PriceScale.IndexOf(zone.BestPriceType.Price).ToString(); HtmlGenericControl newZoneH = new HtmlGenericControl("h6"); newZoneH.InnerText = zone.Description + " (" + zone.BestPriceType.Price.ToString("C") + ")"; newZoneDiv.Controls.Add(newZoneH); HtmlGenericControl newGroupsDl = new HtmlGenericControl("dl"); foreach (SyosSeatGroup group in zone.SeatGroups) { HtmlGenericControl newGroupDt = new HtmlGenericControl("dt"); newGroupDt.InnerText = "Seat group " + group.Id.ToString(); newGroupsDl.Controls.Add(newGroupDt); foreach (SyosSeat seat in group.Seats) { string availClass; switch(seat.Status) { case SyosSeatStatus.Available: availClass = "SyosSeatAvail"; break; case SyosSeatStatus.InCart: availClass = "SyosSeatInCart"; break; default: availClass = "SyosSeatTaken"; break; } HtmlGenericControl newSeatDd = new HtmlGenericControl("dd"); newSeatDd.Attributes["class"] = "SyosSeat " + availClass + " " + "SyosSeatLocation" + seat.LocationId.ToString("D6"); string newSeatCheckBox; string newSeatLabel; switch (seat.Status) { case SyosSeatStatus.Available: newSeatCheckBox = "<input type=\"checkbox\" id=\"" + "SyosSeat" + seat.Id.ToString() + "\" name=\"SyosSeat_s_" + section.Id.ToString() + "_z_" + zone.Id.ToString() + "_p_" + zone.BestPriceType.Id.ToString() + "_s_" + seat.Id.ToString() + "\" />"; newSeatLabel = "<label for=\"" + seat.Id.ToString() + "\">" + "#" + seat.Number.ToString() + "</label>"; break; case SyosSeatStatus.InCart: newSeatCheckBox = "<input type=\"checkbox\" disabled=\"disabled\" />"; newSeatLabel = "<label>in your cart</label>"; break; default: newSeatCheckBox = "<input type=\"checkbox\" disabled=\"disabled\" />"; newSeatLabel = "<label>unavailable</label>"; break; } newSeatDd.InnerHtml = newSeatCheckBox + newSeatLabel; newGroupsDl.Controls.Add(newSeatDd); } } newZoneDiv.Controls.Add(newGroupsDl); newSectionZonesDiv.Controls.Add(newZoneDiv); } newSectionDiv.Controls.Add(newSectionZonesDiv); SyosSeatOptions.Controls.Add(newSectionDiv); } }
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; }
private void PrepareSyosMap(SyosSeatCollection collection) { PrepareSyosMap(collection, true); }