Partners

Support

Partners
Error compiling template "Designs/USKidsGolf/TemplateRenderer/Partners.cshtml"
Line 445: 'Dynamicweb.Ecommerce.International.CountryText' does not contain a definition for 'GetRegionTexts'

1 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 2 @using Dynamicweb.Rendering 3 @using Dynamicweb.Content 4 @{ 5 Dynamicweb.Content.Items.Item itemArea = Pageview.Area.Item; 6 int generalSettingsPageId = GetPageIdByNavigationTag("generalsettings");// Int32.Parse(itemArea["GeneralSettings"].ToString()); 7 var page = Dynamicweb.Extensibility.ServiceLocator.Current.GetPageService().GetPage(generalSettingsPageId); 8 Dynamicweb.Content.Items.Item generalSettings = page.Item; 9 10 } 11 @{ string designName = GetString("Template:DesignBaseUrl").Replace("/Files/Templates/Designs/", "").Replace("/", "");}@functions{ 12 public static string GetImage(string sourceString, int imageWidth, int imageHeight, int imageWidthTablet = 0, int imageHeightTablet = 0, int imageWidthMobile = 0, int imageHeightMobile = 0, string imageFormat = "jpg", int imageCompression = 0, int imageCrop = 5, string background = "", string designName = "USKidsGolf") 13 { 14 Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); 15 string currDevice = currentPageview.Device.ToString(); 16 string alternativeImage = !String.IsNullOrEmpty(currentPageview.Area.Item["NoImage"].ToString()) ? currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/"+ designName + "/images/alternativeImage.jpg"; 17 string widthString = ""; 18 string heightString = ""; 19 string getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : ""; 20 string getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : ""; 21 string bgColor = !string.IsNullOrEmpty(background) ? "&amp;Background="+background : ""; 22 int getImageWidth = imageWidth != 0 ? imageWidth : 0; 23 int getImageHeight = imageHeight != 0 ? imageHeight : 0; 24 25 if (currDevice == Dynamicweb.Frontend.Devices.DeviceType.Tablet.ToString()) 26 { 27 getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; 28 getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; 29 } 30 else if (currDevice == Dynamicweb.Frontend.Devices.DeviceType.Mobile.ToString()) 31 { 32 getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; 33 getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; 34 } 35 36 if (getImageWidth != 0) 37 { 38 widthString = "&amp;Width=" + getImageWidth; 39 } 40 if (getImageHeight != 0) 41 { 42 heightString = "&amp;Height=" + getImageHeight; 43 } 44 45 string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; 46 return output; 47 } 48 } 49 @inherits RazorTemplateBase<RazorTemplateModel<Template>> 50 @using Dynamicweb.Rendering; 51 @using System; 52 @using System.Web; 53 @using System.Collections.Specialized; 54 55 @{ 56 string dealerGroups = generalSettings["DealerGroups"].ToString(); 57 string storesGroupID = !string.IsNullOrWhiteSpace(dealerGroups) ? "%" + dealerGroups + "%" : ""; 58 string accessDataSql = "SELECT AccessUserState, AccessUserCountry, AccessUserZip, AccessUserAddress, AccessUserName, AccessUserCity, AccessUserGeoLocationLat, AccessUserImage, AccessUserGeoLocationLng FROM accessUser WHERE AccessUserCountry is not NULL AND AccessUserCountry != '' AND AccessUserGeoLocationLat IS NOT NULL AND AccessUserGroups LIKE '" + storesGroupID + "'"; 59 string accessRegionsDataSql = "SELECT CountryTextName, CountryTextCode2, CountryTextRegionCode FROM EcomCountryText"; 60 string regionsString = "{"; 61 string country = ""; 62 string state = ""; 63 string countryLogged = !string.IsNullOrEmpty(HttpContext.Current.Request.Params["country"]) ? HttpContext.Current.Request.Params["country"] : country; 64 string stateLogged = !string.IsNullOrEmpty(HttpContext.Current.Request.Params["state"]) ? HttpContext.Current.Request.Params["state"] : state; 65 System.Data.DataRow[] dataSet = Dynamicweb.Data.Database.CreateDataSet(accessDataSql).Tables[0].Select(); 66 System.Data.DataRow[] dataRegionsSet = Dynamicweb.Data.Database.CreateDataSet(accessRegionsDataSql).Tables[0].Select(); 67 bool userIsLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); 68 System.Collections.Generic.List<String> countriesList = dataSet.Select(r => ((string)r["AccessUserCountry"].ToString()).Trim() ).Distinct().ToList(); 69 Dictionary<string, string> countriesNames = new Dictionary<string, string>(); 70 71 foreach(System.Data.DataRow r in dataRegionsSet.Where(x => string.IsNullOrWhiteSpace(x["CountryTextRegionCode"].ToString()))) 72 { 73 if(!countriesNames.ContainsKey(r["CountryTextCode2"].ToString())) { 74 countriesNames.Add(r["CountryTextCode2"].ToString(), r["CountryTextName"].ToString()); 75 } 76 } 77 78 if(countryLogged != country) 79 { 80 stateLogged = ""; 81 } 82 83 if (userIsLoggedIn) 84 { 85 var user = Pageview.User; 86 countryLogged = user.Country.ToString(); 87 stateLogged = user.State.ToString(); 88 } 89 90 foreach (string i in countriesList) 91 { 92 System.Collections.Generic.List<String> regions = dataSet.Where(r => (string)r["AccessUserCountry"] == i).Select(r => ((string)r["AccessUserState"]).Trim() ).Distinct().ToList(); 93 int countNum = 0; 94 string countryStrip = i; 95 96 if(regionsString != "{") { 97 regionsString += ","; 98 } 99 regionsString += "\""+countryStrip+"\":["; 100 foreach (string region in regions){ 101 var regionTextList = !string.IsNullOrEmpty(region) ? dataRegionsSet.First(r => r["CountryTextRegionCode"].ToString() == region.ToString()) : null; 102 string regionText = regionTextList != null ? regionTextList["CountryTextName"].ToString() : ""; 103 104 if(!string.IsNullOrWhiteSpace(regionText)) 105 { 106 if(countNum != 0) { 107 regionsString += ","; 108 } 109 regionsString += "\""+@regionText+"\""; 110 countNum++; 111 } 112 } 113 regionsString += "]"; 114 115 } 116 regionsString += "}"; 117 } 118 @helper CountrySelect(System.Collections.Generic.List<String> countriesList, Dictionary<string, string> countriesNames){ 119 <label class="text-left">@Translate("selectYourCountry", "Select your country:")</label> 120 <select name="country"> 121 <option selected="selected" value="">@Translate("all", "All")</option> 122 @RenderSnippet("US") 123 @foreach (string countryCode in countriesList.OrderBy(s => s)) 124 { 125 string countryStrip = countriesNames.ContainsKey(countryCode) ? countriesNames[countryCode] : countryCode; 126 if (countryCode == "US") 127 { 128 @SnippetStart("USA") 129 <option value="@countryCode">@countryStrip</option> 130 @SnippetEnd("USA") 131 } 132 else if (countryCode == "CA") 133 { 134 @SnippetStart("CAN") 135 <option value="@countryCode">@countryStrip</option> 136 @SnippetEnd("CAN") 137 } 138 <option value="@countryCode">@countryStrip</option> 139 } 140 </select> 141 } 142 143 @helper RegionSelect(){ 144 <label class="text-left">@Translate("selectYourRegion","Select your region:")</label> 145 <select data-width="100%" name="locality"> 146 <option value="">@Translate("all","All")</option> 147 </select> 148 } 149 150 <div class="col-xs-12 col-sm-3 partnersFilterContainer" id="findStoreFilter"> 151 <h2>@Translate("findYourLocalPartnet", "Find your local partner")</h2> 152 <fieldset class="col-xs-12 noPadding"> 153 @CountrySelect(countriesList, countriesNames) 154 </fieldset> 155 <fieldset class="col-xs-12 noPadding"> 156 @RegionSelect() 157 </fieldset> 158 </div> 159 160 <div class="list col-sm-9 col-xs-12"> 161 <div class="no-matches hidden">@Translate("noLocationsFound","No locations found")</div> 162 <ol class="partnersList" data-sort-order="desc"> 163 164 @foreach (System.Data.DataRow store in dataSet) 165 { 166 var regionTextList = dataRegionsSet.Where(r => r["CountryTextRegionCode"].ToString() == store["AccessUserState"].ToString() ).First(); 167 string regionText = regionTextList != null ? regionTextList["CountryTextName"].ToString() : ""; 168 string filter = store["AccessUserCountry"].ToString() + " " + regionText; 169 string image = "/Files" + store["AccessUserImage"].ToString(); 170 171 <li class="col-xs-12 col-sm-6 col-md-4" data-title="@store["AccessUserName"]" 172 data-filter-values="@filter" data-country="@store["AccessUserCountry"]" data-citycode="@store["AccessUserState"]" data-city="@regionText" data-sort-value="@store["AccessUserName"]"> 173 <div> 174 <figure> 175 <img class="img-responsive" src="@GetImage(image, 400, 0)" /> 176 </figure> 177 <h2>@store["AccessUserName"]</h2> 178 179 @store["AccessUserAddress"]<br/> 180 @store["AccessUserCity"] 181 @if(!string.IsNullOrEmpty(store["AccessUserState"].ToString())) { 182 @:, @Dynamicweb.Ecommerce.International.CountryText.GetRegionTexts(store["AccessUserCountry"].ToString()).First(c => c.RegionCode == store["AccessUserState"].ToString()).Name 183 } 184 @store["AccessUserZip"] 185 </div> 186 </li> 187 } 188 </ol> 189 190 </div> 191 192 @SnippetStart("jsOnLoad") 193 onLoadPartners('@regionsString', { 194 str_country : "@countryLogged", 195 str_state : "@stateLogged" 196 }); 197 @SnippetEnd("jsOnLoad") 198

LA NOSTRA MISSIONE

La missione della U.S. Kids Golf e' favorire il divertimento dei bambini insegnando loro "il gioco della vita" che e' il golf e incoraggiare l'interazione con la propria famiglia affinche' si costruiscano ricordi indelebili