Exception in template (Designs\YellowBus-Mobile\ItemPublisher/Details/detailsTour.cshtml): System.ArgumentException: System name of the target item cannot be an empty string.
Parameter name: metadata
   at Dynamicweb.Content.Items.Queries.Repository..ctor(ItemType metadata)
   at Dynamicweb.Content.Items.Queries.StorageFactory.CreateRepository(ItemType metadata)
   at Dynamicweb.Content.Items.Queries.StorageManager.GetByPageId(String systemName, Int32 pageId, Boolean draft)
   at CompiledRazorTemplates.Dynamic.bcdaebabdacfed.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, String cacheName)
   at Dynamicweb.Rendering.Template.Output()
@using System @using System.Collections.Generic @functions { public const string BOOKING_REGION_QSTR = "region"; public const string BOOKING_REGION_IDENTIFIER_ALIAS = "BookingLinkIdentifier"; public const string BOOKING_REGION_LINK_ALIAS = "BookingLink"; // Added - Tiago S. - Get all 'City' Items for the given Area. // Get all the 'City' items in the current area. public static IEnumerable<Dynamicweb.Content.Items.Item> getCityItemsForArea(int areaId) { return getItemsForArea(areaId, "City"); } // Get all the 'CityYBMobile' items in the current area. public static IEnumerable<Dynamicweb.Content.Items.Item> getCityItemsForMobileArea(int areaId) { return getItemsForArea(areaId, "CityYBMobile"); } // Get all the pages in the current area whcih are of the desired type. public static IEnumerable<Dynamicweb.Content.Items.Item> getItemsForArea(int areaId, string itemType) { return Dynamicweb.Content.Page.GetPagesByAreaID(areaId) // Filter by Item type: 'City' .Where(x => x.ItemType == itemType) // transform into Items .Select<Dynamicweb.Content.Page, Dynamicweb.Content.Items.Item>( x => Dynamicweb.Content.Items.ItemManager.Storage.GetById(x.ItemType, x.ItemId) ); } // Traverses the parent pages to obtain the RegionIdentifier from a 'City' page ancestor. public static string getRegionIdentifier(Dynamicweb.Content.Page currPage) { var auxPage = currPage; do { if (auxPage.ItemType == "City") { return getRegionIdentifier(auxPage.ItemType, auxPage.ItemId); } } while ((auxPage = auxPage.Parent) != null); return String.Empty; } public static string getRegionIdentifier(Dynamicweb.Frontend.Page currPage) { return getRegionIdentifier(Dynamicweb.Content.Page.GetPageById(currPage.ID)); } public static string getRegionIdentifier(string itemType, string itemId) { var cityPageItem = Dynamicweb.Content.Items.ItemManager.Storage.GetById(itemType, itemId); return (string) cityPageItem[BOOKING_REGION_IDENTIFIER_ALIAS]; } public static string getRegionIdentifier(int pageId) { using (var dbCon = Dynamicweb.Database.CreateConnection()) { string pageItemId = String.Empty; do { // Check the parent using (var cmd = dbCon.CreateCommand()) { cmd.CommandText = "SELECT PageItemType, PageParentPageId, PageItemId FROM Page WHERE PageId = ''+@pageId+''"; cmd.Parameters.Add(new System.Data.SqlClient.SqlParameter() { ParameterName = "pageId", SqlDbType = System.Data.SqlDbType.Int, Value = pageId }); using (var reader = cmd.ExecuteReader()) { // No such oage found with the specified id. if (!reader.Read()) { break; } // the current page is of the desired type ('City'). if (reader.GetString(0) == "City") { pageItemId = reader.GetString(2); break; } // Parent page id. if (reader[1] == DBNull.Value) { pageId = -1; } else { pageId = reader.GetInt32(1); } } } } while (pageId >= 0); // 'City' page item was found. if (!String.IsNullOrEmpty(pageItemId)) { return getRegionIdentifier("City", pageItemId); } return null; } } } @{ var itemArea = Pageview.Area.Item; string str_buyPageID = (itemArea["BuyPageID"] != null) ? itemArea["BuyPageID"].ToString() : ""; string str_globalLang = GetGlobalValue("Global:Area.Lang"); string str_globalLanguage = GetGlobalValue("Global:Area.Lang") != "pt" ? GetGlobalValue("Global:Area.Lang").ToUpper() : ""; string str_zero = ""; string str_titleSchedule = ""; string str_timetableSchedule = ""; string str_frequencySchedule = ""; string str_nameTour = GetString("ItemPublisher:Item.Name"); string str_textTour = GetString("ItemPublisher:Item.Text.Value"); string str_title = ""; string str_mainImage = GetString("ItemPublisher:Item.MainImage"); var loopProductsImages = GetLoop("ItemPublisher:Item.Slideshow.ListOfFiles"); string str_imageGalery = GetString("ItemPublisher:Item.Slideshow"); var loop_zone = GetLoop("ItemPublisher:Item.TourZone.Options"); var loop_tour = GetLoop("ItemPublisher:Item.Offers"); var loop_tourCircuit = GetLoop("ItemPublisher:Item.Tour"); var loop_tourLanguages = GetLoop("ItemPublisher:Item.Languages.Options").Where(x => x.GetString("ItemPublisher:Item.Languages.Option.IsSelected") != "False").ToList(); var loop_tourSchedule = GetLoop("ItemPublisher:Item.Schedule"); switch (str_globalLanguage) { case "EN": loop_tourSchedule = GetLoop("ItemPublisher:Item.ScheduleEN"); break; case "ES": loop_tourSchedule = GetLoop("ItemPublisher:Item.ScheduleES"); break; case "FR": loop_tourSchedule = GetLoop("ItemPublisher:Item.ScheduleFR"); break; case "DE": loop_tourSchedule = GetLoop("ItemPublisher:Item.ScheduleDE"); break; case "RU": loop_tourSchedule = GetLoop("ItemPublisher:Item.ScheduleRU"); break; } string str_tourPlaces = GetString("ItemPublisher:Item.OtherSellingPlaces"); string desc = GetString("ItemPublisher:Item.Discount"); string str_adultPrice = GetString("ItemPublisher:Item.AdultsPrice"); string str_childrenPrice = GetString("ItemPublisher:Item.ChildrensPrice"); string str_bookingRouteId = GetString("ItemPublisher:Item.BookingRouteId"); bool bol_bookingDirect = GetBoolean("ItemPublisher:Item.BookingDirect"); string str_startWaypoint = ""; string str_zoneValue = GetString("ItemPublisher:Item.TourZone"); string str_zoneName = ""; foreach (LoopItem x in loop_zone) { if (str_zoneValue == x.GetString("ItemPublisher:Item.TourZone.Option.Value")) { str_zoneName = x.GetString("ItemPublisher:Item.TourZone.Option.Label"); if (str_zoneName.Contains("-")) { str_zoneName = str_zoneName.Substring(0, str_zoneName.IndexOf("-")); } } } string str_scheduleName = GetString("ItemPublisher:Item.Schedule.Name"); if (str_scheduleName.Contains("-")) { str_scheduleName = str_scheduleName.Substring(0, str_scheduleName.IndexOf("-")); } string str_languageIcon = GetBoolean("ItemPublisher:Item.HasGuide.Value") ? "languageGuide" : "language"; string str_packageId = System.Web.HttpContext.Current.Request.Params["packageId"] != null ? System.Web.HttpContext.Current.Request.Params["packageId"].ToString() : ""; string str_tourId = GetString("ItemPublisher:Item.Field.Id"); string str_linkPageDetail = GetString("ItemPublisher:Item.Page.Link"); if (GetGlobalValue("Global:Area.Lang") == "en") { str_adultPrice = str_adultPrice.Replace(",", "."); str_childrenPrice = str_childrenPrice.Replace(",", "."); } double dbl_adultsPrice = (!String.IsNullOrEmpty(str_adultPrice)) ? Convert.ToDouble(str_adultPrice) : Convert.ToDouble("0"); double num_priceNumber; double dbl_priceAfterDiscount = (dbl_adultsPrice - dbl_adultsPrice * (GetInteger("ItemPublisher:Item.Discount") / 100.00)); double dbl_childrensPriceAfterDiscount = (!String.IsNullOrEmpty(str_childrenPrice)) ? Convert.ToDouble(str_childrenPrice) : Convert.ToDouble("0"); string str_colorBanner = GetString("ItemPublisher:Item.TourColor"); if (str_colorBanner.Contains(",")) { str_colorBanner = str_colorBanner.Substring(0, str_colorBanner.IndexOf(",")); } int desktopAreaID = itemArea["YellowBusID"] != null ? Convert.ToInt32(itemArea["YellowBusID"].ToString()) : Pageview.Area.ID; var allPages = Dynamicweb.Content.Page.GetPagesByAreaID(desktopAreaID); var package = Dynamicweb.Content.Items.Item.GetItemById("TourPackage", str_packageId); // Added - Tiago S. - Booking Options // Get the list of booking options for this circuit. var bookingItems = GetLoop("ItemPublisher:Item.Booking").Where(x => x.GetBoolean("Item.Booking.Active")); // Added - Tiago S. - Get the 'Booking Region Url' from an ancestor 'City' type page. // Get the city Page Id. var cityPageId = (int)Dynamicweb.Database.ExecuteScalar( String.Format("SELECT PageParentPageID FROM Page WHERE PageItemId = {0} AND PageItemType like '%NewTour%'", GetInteger("ItemPublisher:Item.Field.Id"))); // Region identifier. string bookingRegionIdentifier = getRegionIdentifier(Dynamicweb.Content.Page.GetPageById(cityPageId)); var tourWeather = GetString("ItemPublisher:Item.WeatherSourceCode"); var cityParent = (int)Dynamicweb.Database.ExecuteScalar( String.Format("SELECT PageParentPageID FROM Page WHERE PageId={0}", cityPageId)); if (string.IsNullOrEmpty(tourWeather)) { var cityPage = Dynamicweb.Content.Items.Item.GetItemsByPageId(cityParent); var cityPageFirst = cityPage.First(); object cityPageValue = null; cityPageFirst.TryGetValue("WeatherSourceCode", ref cityPageValue); tourWeather = cityPageValue.ToString(); } } <div class="tourInfo"> <h1> @str_nameTour </h1> @if (!string.IsNullOrEmpty(tourWeather)) { <div class="weatherInfoWrapper"> @tourWeather </div> <div class="clear"></div> } @if(str_packageId == ""){ <div class="purchaseBgTour2"> <ul id="tourBanner"> @if (loopProductsImages.Any()) { foreach (LoopItem i in loopProductsImages) { string str_fileName = str_imageGalery + "/" + i.GetString("ItemPublisher:Item.Slideshow.FileName"); <li> <figure> <img src="/Admin/Public/GetImage.ashx?Image=@str_fileName&amp;Format=jpg&amp;Width=300&amp&amp;Crop=0" alt="Imagem 1"/> </figure> </li> } } else { <li> <figure> <img src="/Admin/Public/GetImage.ashx?Image=@str_mainImage&amp;Format=jpg&amp;Width=300&amp&amp;Crop=0" alt="Imagem 1"/> </figure> </li> } </ul> <br/> @* Ensure backwards compatibility - if there are no list items, we display the price information the old way. *@ @if (bookingItems == null || !bookingItems.Any()) { <span class="totValue"> @Translate("YBM_totalPrice")</span> <span class="priceValue"> @dbl_priceAfterDiscount.ToString("0.00")&euro; </span> <div class="rightContent"><span class="discountPrice"> @desc% </span> <span class="oldPrice"> @str_adultPrice &euro; </span> </div> <hr class="hrtourSlider"> } @if (!bol_bookingDirect) { <form id="tourTicketsForm" name="tourTicketsForm" action="/Default.aspx" class='tourTicketsForm@((String.IsNullOrEmpty(str_bookingRouteId)) ? " inactive" : "")'> <input type="hidden" name="Id" value="@str_buyPageID"/> <input type="hidden" name="locale" value="@str_globalLang"/> <input type="hidden" name="routeId" value="@str_bookingRouteId"/> @* Added - Tiago S. - take the specific region Identifier into account. *@ @* If a specific URL has been defined for this region, use it. *@ @if (!String.IsNullOrEmpty(bookingRegionIdentifier)) { <input type="hidden" name="@BOOKING_REGION_QSTR" value="@bookingRegionIdentifier" /> } @if (GetInteger("ItemPublisher:Item.ReleaseDays") != 0 || GetString("ItemPublisher:Item.TourBeginDate") != "" || GetString("ItemPublisher:Item.TourEndDate") != "") { <fieldset id="tourReleaseDays" class="TextInput mandatory"> <label for="releaseDays" class="h4"> @Translate("YB_chooseDate")</label> <input type="text" name="arrive" id="releaseDays" class="calendarIcon" title='@Translate("YB_chooseDate")'/> <span> @Translate("YB_reservationsDisclaimer") @(GetInteger("ItemPublisher:Item.ReleaseDays") * 24)h @Translate("YB_reservationsDisclaimer2") </span> </fieldset> } @if (GetBoolean("ItemPublisher:Item.TourWithLunch")) { string str_titleWithout = GetString("ItemPublisher:Item.Usage") == "lunch" ? Translate("YB_tourWithoutLunchPriceTitle") : Translate("YB_tourWithoutDaysPriceTitle"); <p class="h4"> @str_titleWithout </p> } <fieldset id="tourTicketPrice" class="mandatory"> <select class="tourTicketPrice" name="adults"> <option value="default">00</option> <option value="1" selected="selected">01</option> @for (int n = 2; n < 51; n++) { str_zero = n.ToString().Length == 2 ? "" : "0"; <option value="@n">@str_zero@n</option> } </select> <label> @Translate("YB_tourAdultsPriceLabel") x @dbl_priceAfterDiscount.ToString("0.00")&euro; </label> </fieldset> @if (dbl_childrensPriceAfterDiscount.ToString("0.00") != "0,00") { <fieldset id="childrensPriceHolder"> <select class="tourTicketChildrensPrice" name="children"> <option value="default" selected="selected">00</option> @for (int n = 1; n < 51; n++) { str_zero = n.ToString().Length == 2 ? "" : "0"; <option value="@n">@str_zero@n</option> } </select> <label class="childrens"> @Translate("YB_tourChildrensPriceLabel") x @dbl_childrensPriceAfterDiscount.ToString("0.00")&euro; <br/> (@Translate("YB_tourChildrensDelimitation"))</label> </fieldset> } @if (GetBoolean("ItemPublisher:Item.TourWithLunch") && GetString("ItemPublisher:Item.AdultsLunchPrice") != "") { string str_titleWith = GetString("ItemPublisher:Item.Usage") == "lunch" ? Translate("YB_tourWithLunchPriceTitle") : Translate("YB_tourWithDaysPriceTitle"); double dbl_adultsLunchPrice = GetGlobalValue("Global:Area.Lang") == "en" ? Convert.ToDouble(GetString("ItemPublisher:Item.AdultsLunchPrice").Replace(',', '.')) : GetDouble("ItemPublisher:Item.AdultsLunchPrice"); double dbl_lunchPriceAfterDiscount = Double.TryParse(GetString("ItemPublisher:Item.AdultsLunchPrice"), out num_priceNumber) ? (dbl_adultsLunchPrice - dbl_adultsLunchPrice * (GetInteger("ItemPublisher:Item.Discount") / 100.00)) : 0; <p class="h4" id="tourWithLunchTitle">@str_titleWith</p> <fieldset id="tourLunchTicketPrice"> <select class="tourLunchTicketPrice" name="adultsLunch"> <option value="default">00</option> @for (int n = 1; n < 51; n++) { str_zero = n.ToString().Length == 2 ? "" : "0"; <option value="@n">@str_zero@n</option> } </select> <label> @Translate("YB_tourAdultsPriceLabel") x @dbl_lunchPriceAfterDiscount.ToString("0.00")&euro;</label> </fieldset> if (GetString("ItemPublisher:Item.ChildrensLunchPrice") != "") { double dbl_childrensLunchPriceAfterDiscount = GetGlobalValue("Global:Area.Lang") == "en" ? Convert.ToDouble(GetString("ItemPublisher:Item.ChildrensLunchPrice").Replace(',', '.')) : GetDouble("ItemPublisher:Item.ChildrensLunchPrice"); <fieldset id="childrensLunchPriceHolder"> <select class="tourLunchTicketChildrensPrice" name="childrenLunch"> <option value="default" selected="selected">00</option> @for (int n = 1; n < 51; n++) { str_zero = n.ToString().Length == 2 ? "" : "0"; <option value="@n">@str_zero@n</option> } </select> <label class="childrens"> @Translate("YB_tourChildrensPriceLabel") x @dbl_childrensLunchPriceAfterDiscount.ToString("0.00")&euro; <br/> (@Translate("YB_tourChildrensDelimitation"))</label> </fieldset> } } <div class="formButtons"> @{ var script = GetString("ItemPublisher:Item.Script"); } @if (!GetBoolean("ItemPublisher:Item.Unavailable")) { if (!string.IsNullOrEmpty(script)) { @script } else { <input class="navbtResultados" type="submit" value='@Translate("YBM_buyNow")'/> } } else{ <input type="submit" class="navbtResultados" disabled value='@Translate("YB_Unavailable", "Indisponível")' /> } @if (GetString("ItemPublisher:Item.Disclaimer") != "") {<br/><span>@GetString("ItemPublisher:Item.Disclaimer")</span>}</div> </form> } else { @* Backwards Compatibility - list items override the default behaviour *@ if (bookingItems == null || !bookingItems.Any()) { <form action="/Default.aspx"> <input type="hidden" name="Id" value="@str_buyPageID"/> <input type="hidden" name="locale" value="@str_globalLang"/> <input type="hidden" name="book-direct" value="@str_bookingRouteId"/> @* Added - Tiago S. - take the specific region Identifier into account. *@ @* If a specific URL has been defined for this region, use it. *@ @if (!String.IsNullOrEmpty(bookingRegionIdentifier)) { <input type="hidden" name="@BOOKING_REGION_QSTR" value="@bookingRegionIdentifier" /> } <div class="formButtons"> @{ var script = GetString("ItemPublisher:Item.Script"); } @if (!GetBoolean("ItemPublisher:Item.Unavailable")) { if (!string.IsNullOrEmpty(script)) { @script } else { <input class="navbtResultados" type="submit" value='@Translate("YBM_buyNow")'/> } } else{ <input type="submit" class="navbtResultados" disabled value='@Translate("YB_Unavailable", "Indisponível")' /> } @if (GetString("ItemPublisher:Item.Disclaimer") != "") { <br/> <span>@GetString("ItemPublisher:Item.Disclaimer")</span> } </div> </form> } if (bookingItems != null) { @* Booking Button List *@ foreach (var item in bookingItems) { string btnText = item.GetString("ItemPublisher:Item.Booking.ButtonText"), bookingOptHeading = item.GetString("ItemPublisher:Item.Booking.Heading"), bookingOptPriceStr = item.GetString("ItemPublisher:Item.Booking.Price"), bookingRouteId = item.GetString("ItemPublisher:Item.Booking.BookingID"); if (!item.GetBoolean("ItemPublisher:Item.Booking.Active")) { continue; } // If no text is defined, use the default translate value. if (String.IsNullOrEmpty(btnText)) { btnText = Translate("YBM_buyNow"); } <div class="bookingOpt"> @* Booking Option Heading *@ @if (!String.IsNullOrEmpty(bookingOptHeading)) { <div class="bookingOptionHeading"> @bookingOptHeading </div> } @* Booking Option Price *@ @if (!String.IsNullOrEmpty(bookingOptPriceStr) && !String.IsNullOrWhiteSpace(bookingOptPriceStr)) { int bookingOptDiscount = item.GetInteger("ItemPublisher:Item.Booking.Discount"); double bookingOptPrice; double bookingOptPriceAfterDiscount = Double.TryParse(bookingOptPriceStr, out bookingOptPrice) ? (bookingOptPrice - bookingOptPrice * (bookingOptDiscount / 100.00)) : 0; <div class="bookingOptionPriceContainer"> <span class="totValue"> @Translate("YBM_totalPrice")</span> <span class="priceValue"> @bookingOptPriceAfterDiscount.ToString("0.00")&euro; </span> if (bookingOptDiscount != 0) { <div class="rightContent"> <span class="discountPrice"> @bookingOptDiscount% </span> <span class="oldPrice"> @bookingOptPrice &euro; </span> </div> } </div> } <form action="/Default.aspx"> <input type="hidden" name="Id" value="@str_buyPageID"/> <input type="hidden" name="locale" value="@str_globalLang"/> <input type="hidden" name="book-direct" value="@bookingRouteId"/> @* Added - Tiago S. - take the specific region Identifier into account. *@ @* If a specific URL has been defined for this region, use it. *@ @if (!String.IsNullOrEmpty(bookingRegionIdentifier)) { <input type="hidden" name="@BOOKING_REGION_QSTR" value="@bookingRegionIdentifier"/> } <div class="formButtons"> @{ var script = item.GetString("ItemPublisher:Item.Script"); } @if (!item.GetBoolean("ItemPublisher:Item.Unavailable")) { if (!string.IsNullOrEmpty(script)) { @script } else { <input type="submit" class="navbtResultados" value='@btnText'/> } } else{ <input type="submit" class="navbtResultados" disabled value='@Translate("YB_Unavailable", "Indisponível")' /> } @if (item.GetString("ItemPublisher:Item.Booking.Disclaimer") != "") { <br/><span>@item.GetString("ItemPublisher:Item.Booking.Disclaimer")</span> } </div> </form> </div> } } } </div> } else { <div> <ul id="tourBanner"> @if(loopProductsImages.Any()){ foreach (LoopItem i in loopProductsImages){ string str_fileName = str_imageGalery + "/" + i.GetString("ItemPublisher:Item.Slideshow.FileName"); <li> <figure> <img src="/Admin/Public/GetImage.ashx?Image=@str_fileName&amp;Format=jpg&amp;Width=300&amp&amp;Crop=0" alt="Imagem 1"/> </figure> </li> } } else { <li> <figure> <img src="/Admin/Public/GetImage.ashx?Image=@str_mainImage&amp;Format=jpg&amp;Width=300&amp&amp;Crop=0" alt="Imagem 1"/> </figure> </li> } </ul> </div> } <div class="textInfo"> <p> @str_textTour </p> <hr class="hrbottom"> @if(GetString("ItemPublisher:Item.Duration") != ""){ <p class="ticketDesc time"> <span>@Translate("YBM_tourDuration") </span> <span class="ticketsubDesc"> @GetString("ItemPublisher:Item.Duration")</span></p> } @if(str_zoneName != ""){ <p class="ticketDesc zone"> <span> @Translate("YBM_tourZone") </span> <span class="ticketsubDesc"> @str_zoneName </span> </p> } @foreach(LoopItem t in loop_tourCircuit) { if(str_startWaypoint != ""){ break; }else{ string str_waypoint = t.GetString("ItemPublisher:Item.Tour.Waypoint"); foreach(var w in t.GetLoop("ItemPublisher:Item.Tour.Waypoint.Options")){ if(str_waypoint == w.GetString("ItemPublisher:Item.Tour.Waypoint.Option.Value")){ str_startWaypoint = w.GetString("ItemPublisher:Item.Tour.Waypoint.Option.Label"); if(str_startWaypoint.Contains("-")){ int idx = str_startWaypoint.IndexOf("-"); str_startWaypoint = str_startWaypoint.Substring((idx + 1),(str_startWaypoint.Length - idx - 1)); //str_startWaypoint = str_startWaypoint.Substring(0, idx); str_startWaypoint = str_startWaypoint.Split('-')[0]; } break; } } } } @if(str_startWaypoint != ""){ <p class="ticketDesc point"> <span>@Translate("YBM_firstPoint")</span> <span class="ticketsubDesc"> @str_startWaypoint </span></p> } @if(GetString("ItemPublisher:Item.Information") != ""){ <p class="ticketDesc info"> <span>@Translate("YBM_tourInformation", "Informação") </span> <span class="ticketsubDesc"> @GetString("ItemPublisher:Item.Information")</span></p> } @if(loop_tourLanguages.Count > 0){ <div class="language"> <p class="ticketDesc @str_languageIcon"> <span> @Translate("YBM_tourLanguage") </span> </p> <ul class="languageList"> @foreach(LoopItem l in loop_tourLanguages){ string str_language = l.GetString("ItemPublisher:Item.Languages.Option.Label"); string str_imageLanguage = "/Files/"+ l.GetString("ItemPublisher:Item.Languages.Option.Image"); <li class="ticketLanguages"> <img src="@str_imageLanguage"> </li> } </ul> </div> } <div class="ticketItem"> @if(str_timetableSchedule!= " " ){ <p class="ticketDesc hour"> <span> @Translate("YBM_tourTimetable") </span> </p> <ul class="ulTimetable"> @foreach(LoopItem s in loop_tourSchedule){ str_titleSchedule = s.GetString("ItemPublisher:Item.Schedule"+ str_globalLanguage + ".Title"); str_timetableSchedule = s.GetString("ItemPublisher:Item.Schedule" + str_globalLanguage + ".Timetable"); str_frequencySchedule = s.GetString("ItemPublisher:Item.Schedule" + str_globalLanguage + ".Frequency"); <li> <div class="timetable"> <p class="descTimetable"> @str_titleSchedule</p> <p class="timetablesubDesc"> @str_timetableSchedule</p> <span class="timetablesubDesc"> @str_frequencySchedule </span> </div> </li> } </ul> } </div> <div class="ticketPlaces"> <p class="ticketDesc places"> <span>@Translate("YBM_tourOtherSellingPlaces")</span></p> <ul class="listsellPoints"> @str_tourPlaces.Replace(",","<li>")</ul> </div> @if(loop_tourCircuit.Count > 1){ int num_index = 0; <hr class="hrbottom"> <span class="titObs">@Translate("YBM_mapTour")</span> <div id="spineMap"> <div class="iconTour"> <span class="iconColor" data-color="@str_colorBanner"> <i class="fa fa-bus"> </i> </span> </div> <p class="titCircuit3"> @str_nameTour </p> <a> @Translate("YBM_viewMapaTour")</a> <i class="fa fa-angle-down spineButton"> </i> <ul class="listClose"> @foreach(LoopItem t in loop_tourCircuit.Where(x => x.GetString("ItemPublisher:Item.Tour.ExcludeFromTour") != "True" )) { num_index++; string str_waypoint = t.GetString("ItemPublisher:Item.Tour.Waypoint"); string str_intermediateSuffix = (str_globalLanguage != "PT") ? str_globalLanguage : ""; string[] str_intermediatePoints = t.GetString("ItemPublisher:Item.Tour.IntermediatePoints" + str_intermediateSuffix).Split(','); string str_noIntermediateClass = str_intermediatePoints[0] != "" ? "" : "noIntermediatePoints"; string str_index = num_index < 10 ? "0" : ""; str_index += num_index.ToString(); foreach(var w in t.GetLoop("ItemPublisher:Item.Tour.Waypoint.Options")){ if(str_waypoint == w.GetString("ItemPublisher:Item.Tour.Waypoint.Option.Value")){ str_startWaypoint = w.GetString("ItemPublisher:Item.Tour.Waypoint.Option.Label"); if(str_startWaypoint.Contains("-")){ str_startWaypoint = str_startWaypoint.Substring((str_startWaypoint.IndexOf("-") + 1),(str_startWaypoint.Length - str_startWaypoint.IndexOf("-") - 1)); } if(str_startWaypoint.Contains("-")){ str_startWaypoint = str_startWaypoint.Substring(0,str_startWaypoint.IndexOf("-")); } break; } } var str_waypointNameTranslated = t.GetString("ItemPublisher:Item.Tour.Name" + str_globalLanguage); var str_waypointName = string.IsNullOrEmpty(str_waypointNameTranslated) ? str_startWaypoint : str_waypointNameTranslated; <li class="busStopItem"> <span class="stopcircleBlue" data-color="@str_colorBanner"> @str_index @if(t.Index != loop_tourCircuit.Count){<span class="pxSpine" data-color="@str_colorBanner"></span>}</span> <span class="busStop titCircuit4">@str_waypointName</span> @if (str_intermediatePoints[0] != "") { <a href="#"><i class="fa fa-angle-double-down"></i></a> <ul class="intermediatePoints"> @for (int iP = 0; iP < str_intermediatePoints.Count(); iP++) { <li style="border-left-color:@str_colorBanner"><span style="background-color:@str_colorBanner">poi</span>@IntermediatePointsHelper(str_intermediatePoints[iP])</li> } </ul> } </li> } <ul> </div> } @{ string str_obsText = (!String.IsNullOrEmpty(str_packageId) ? package["PackageObservations"].ToString() : GetString("ItemPublisher:Item.ObservationsText")); } <hr class="hrbottom"> <div class="ticketContent"> <span class="titObs">@Translate("YBM_tourObs")</span> <p> @str_obsText</p> </div> <div id="offers"> @if(str_packageId != "") { str_linkPageDetail = itemArea["DetailPage"] != null ? itemArea["DetailPage"].ToString() : ""; if(package != null) { if(package["Offers"] != null) { string[] arr_pagesIds = package["Offers"].ToString().Split(','); if(arr_pagesIds.Length > 1){ for(int i = 0 ; i < arr_pagesIds.Length; i++) { string str_offeraddId = arr_pagesIds[i].ToString(); Dynamicweb.Content.Items.Item tempItem2 = Dynamicweb.Content.Items.Item.GetItemById("AddOffer", str_offeraddId); if(tempItem2 != null) { if(tempItem2["Offer"] != null) { int int_OfferPageId = getCurrentLangPageId(new{ int_pageId = Convert.ToInt32(tempItem2["Offer"].ToString()) },allPages); var page = Dynamicweb.Content.Page.GetPageById(int_OfferPageId); if(page != null) { if(page.ItemType != "" && page.ItemId != ""){ Dynamicweb.Content.Items.Item tempItem = Dynamicweb.Content.Items.Item.GetItemById(page.ItemType, page.ItemId); if(tempItem != null) { if(tempItem["Id"].ToString() != str_tourId) { string str_tourDetail = "/"+ str_linkPageDetail + "&amp;packageId=" + str_packageId + "&amp;itemId=" + page.ItemType + ":" + page.ItemId; <div class="toursBoxListCircuit3"> <div class="picBox"> <a href="@str_tourDetail"> <figure><img src='/Admin/Public/GetImage.ashx?Image=@tempItem["MainImage"]&amp;Format=jpg&amp;Width=107&amp;Height=80&amp;Crop=0'/></figure> </a> </div> <h2 class="descTit16"><a href="@str_tourDetail"> @tempItem["Name"]</a></h2> <p class="descCircuit3"> @Truncate(tempItem["Text"].ToString(), 50)</p> <a class="triangleWhite" href="@str_tourDetail"> </a> <a class="triangleLink" href="@str_tourDetail"> <i class="fa fa-plus"></i></a> <a class="plusWhiteCircle"> <span class="plusBlueCircle"> <i class="fa fa-plus fa-2x"></i> </span> </a> </div> } } } } } } } } } } } </div> <div class="navbtResultados"> <ul> <li> @if(str_packageId == ""){ <a href="javascript:history.back();">@Translate("YBM_close")</a> } else{ <a href="javascript:history.back();">@Translate("YBM_close")</a> } </li> </ul> </div> </div> @SnippetStart("jsVariables") var obj_tourDetails = { str_adultsPrice: '@GetString("ItemPublisher:Item.AdultsPrice")', str_adultsLunchPrice: '@GetString("ItemPublisher:Item.AdultsLunchPrice")', str_childrensPrice: '@GetString("ItemPublisher:Item.ChildrensPrice")', str_childrensLunchPrice: '@GetString("ItemPublisher:Item.ChildrensLunchPrice")', str_discount: '@GetInteger("ItemPublisher:Item.Discount")', str_tourBeginDate: '@FormatDate(GetString("ItemPublisher:Item.TourBeginDate"))', str_tourEndDate: '@FormatDate(GetString("ItemPublisher:Item.TourEndDate"))', str_releaseDays: '@GetInteger("ItemPublisher:Item.ReleaseDays")', str_participantsMin: '1', str_participantsMax: '@GetInteger("ItemPublisher:Item.ParticipantsMax")', str_participantsError: '@Translate("YB_participantsError","Erro Participante")', str_adultsErrorTitle: '@Translate("YB_adultsErrorTitle", "Erro Adultos Titulo")', str_adultsError: '@Translate("YB_adultsError","Erro Adulto")', str_futureDateError: '@Translate("YB_futureDate", "Erro data futuro")' } @SnippetEnd("jsVariables") @SnippetStart("jsOnLoad") onLoadProductImageList(); onLoadTourDetails(); @SnippetEnd("jsOnLoad") @helper Truncate(string str_input,int num_length) { if(str_input.Length <= num_length){ @str_input }else{ @str_input.Substring(0,num_length)<text>...</text> } } @helper FormatDate(string str_date) { if(!String.IsNullOrEmpty(str_date)){ DateTime dat_date = Convert.ToDateTime(str_date); DateTime dat_newDate = new DateTime(dat_date.Year, dat_date.Month, dat_date.Day); @dat_newDate.ToString("yyyy'/'MM'/'dd"); }else{ string str_empty = "0"; @str_empty } } @helper IntermediatePointsHelper(string str_input){ if(str_input.Length <= 30){ <p class="intermediatePointText">@str_input</p> } else { <p class="intermediatePointText doubleLineIntermediate">@str_input</p> } } @functions { public int getCurrentLangPageId(dynamic obj_options, Dynamicweb.Content.PageCollection allCurrentPages) { int int_output = obj_options.int_pageId; if (obj_options.int_pageId > 0) { var currentPage = Dynamicweb.Content.Page.GetPageById(obj_options.int_pageId); if (currentPage != null) { if (currentPage.IsMaster) { int int_masterPageID = obj_options.int_pageId; var outputPage = allCurrentPages.Where(x => x.MasterPageID == int_masterPageID || (x.IsMaster && x.ID == int_masterPageID)); if (outputPage.Count() > 0) { int_output = (outputPage.FirstOrDefault().ID != null) ? outputPage.FirstOrDefault().ID : 0; } } else { int_output = obj_options.int_pageId; } } } return int_output; } }