Partners | Forney Industries

Support

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean euismod bibendum laoreet. Proin gravida dolor sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar tempor. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nam fermentum, nulla luctus pharetra vulputate, felis tellus mollis orci, sed rhoncus sapien nunc eget odio.

 

 

Exception in template (Designs\Forney\TemplateRenderer/partners.cshtml): System.InvalidOperationException: Sequence contains no matching element
   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source, Func`2 predicate)
   at CompiledRazorTemplates.Dynamic.abfdaeeedead.Execute()
   at RazorEngine.Templating.TemplateBase.RazorEngine.Templating.ITemplate.Run(ExecuteContext context)
   at RazorEngine.Templating.TemplateService.Run(ITemplate template, DynamicViewBag viewBag)
   at RazorEngine.Templating.TemplateService.Parse(String razorTemplate, Object model, DynamicViewBag viewBag, String cacheName)
   at RazorEngine.Razor.Parse[T](String razorTemplate, T model, DynamicViewBag viewBag, String cacheName)
   at Dynamicweb.Rendering.Template.RenderRazorTemplate()
@inherits RazorTemplateBase<RazorTemplateModel<Template>> @using System.Linq @using Dynamicweb.Rendering; @{ Dynamicweb.Content.Items.Item itemArea = Pageview.Area.Item; int generalSettingsPage = Int32.Parse(itemArea["GeneralSettings"].ToString()); Dynamicweb.Content.Items.Item generalSettings = Dynamicweb.Content.Items.Item.GetItemById(Dynamicweb.Services.Pages.GetPage(generalSettingsPage).ItemType, Dynamicweb.Services.Pages.GetPage(generalSettingsPage).ItemId); } @{ string designName = GetString("Template:DesignBaseUrl").Replace("/Files/Templates/Designs/", "").Replace("/", ""); }@functions{ 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 = "Forney") { Dynamicweb.Frontend.PageView currentPageview = Dynamicweb.Frontend.PageView.Current(); string currDevice = currentPageview.Device.ToString(), alternativeImage = currentPageview.Area.Item["NoImage"] != null ? currentPageview.Area.Item["NoImage"].ToString() : "/Files/Templates/Designs/"+ designName + "/images/alternativeImage.jpg", widthString = "", heightString = "", getImageFormat = imageFormat != "jpg" ? "&amp;Format=" + imageFormat : "", getImageCompression = imageCompression != 0 ? "&amp;Compression=" + imageCompression : "", bgColor = !string.IsNullOrEmpty(background) ? "&amp;backgroud="+background : ""; int getImageWidth = imageWidth != 0 ? imageWidth : 0, getImageHeight = imageHeight != 0 ? imageHeight : 0; if (currDevice == Dynamicweb.Frontend.Devices.DeviceType.Tablet.ToString()) { getImageWidth = imageWidthTablet != 0 ? imageWidthTablet : getImageWidth; getImageHeight = imageHeightTablet != 0 ? imageHeightTablet : getImageHeight; } else if (currDevice == Dynamicweb.Frontend.Devices.DeviceType.Mobile.ToString()) { getImageWidth = imageWidthMobile != 0 ? imageWidthMobile : getImageWidth; getImageHeight = imageHeightMobile != 0 ? imageHeightMobile : getImageHeight; } if (getImageWidth != 0) { widthString = "&amp;Width=" + getImageWidth; } if (getImageHeight != 0) { heightString = "&amp;Height=" + getImageHeight; } string output = "/Admin/Public/GetImage.ashx?Image=" + sourceString + widthString + heightString + "&amp;altFmImage_path=" + alternativeImage + getImageFormat + getImageCompression + "&amp;Crop=" + imageCrop + bgColor; return output; } public string GetYouTubeCode(string videoUrl) { int mInd1 = videoUrl.IndexOf("/v/"); //Suppose your youtube video url is looking like this: http://www.youtube.com/v/qPULu1Js3oA?version=3&feature=player_detailpage int mInd2 = videoUrl.IndexOf("?v="); //Suppose your youtube video url is looking like this: https://www.youtube.com/watch?v=IQe3UABPKto int mInd3 = videoUrl.IndexOf(".be/"); //Suppose your youtube video url is looking like this: https://youtu.be/jlUBcKcHgRw string videoCode = ""; int ind = 11; // Correction to alway look for 11 characters VIDEO _ID if (mInd1 != -1) { videoCode = videoUrl.Substring(mInd1 + 3); videoCode = videoCode.Substring(0, ind == -1 ? videoCode.Length : ind); } if (mInd2 != -1) { videoCode = videoUrl.Substring(mInd2 + 3); videoCode = videoCode.Substring(0, ind == -1 ? videoCode.Length : ind); } if (mInd3 != -1) { videoCode = videoUrl.Substring(mInd3 + 4); videoCode = videoCode.Substring(0, ind == -1 ? videoCode.Length : ind); } return videoCode; } public string GetYouTubeImage(string videoUrl, string version) { //Video Default jpg : default //Video Medium Quality jpg : mqdefault //Video High Quality jpg : hqdefault //Other Screen Thumbnail jpg : // 1 // 2 // 3 string thumbnailVersion = "default"; switch(version) { case "default": // Use the text block below to separate html elements from code thumbnailVersion = "default"; break; // Always break each case case "mqdefault": thumbnailVersion = "mqdefault"; break; case "hqdefault": thumbnailVersion = "hqdefault"; break; default: thumbnailVersion = "default"; break; } string strVideoCode = GetYouTubeCode(videoUrl); if (!string.IsNullOrEmpty(strVideoCode)) { return "https://img.youtube.com/vi/" + strVideoCode + "/"+thumbnailVersion+".jpg"; } else return ""; } } @inherits RazorTemplateBase<RazorTemplateModel<Template>> @using Dynamicweb.Rendering; @using System; @using System.Web; @using System.Collections.Specialized; @{ string dealerGroups = generalSettings["DealerGroups"].ToString(), storesGroupID = !string.IsNullOrWhiteSpace(dealerGroups) ? "%" + dealerGroups + "%" : "", 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 + "'", accessRegionsDataSql = "SELECT CountryTextName, CountryTextCode2, CountryTextRegionCode FROM EcomCountryText", regionsString = "{", country = "", state = "", countryLogged = !string.IsNullOrEmpty(HttpContext.Current.Request.Params["country"]) ? HttpContext.Current.Request.Params["country"] : country, stateLogged = !string.IsNullOrEmpty(HttpContext.Current.Request.Params["state"]) ? HttpContext.Current.Request.Params["state"] : state; System.Data.DataRow[] dataSet = Dynamicweb.Data.Database.CreateDataSet(accessDataSql).Tables[0].Select(), dataRegionsSet = Dynamicweb.Data.Database.CreateDataSet(accessRegionsDataSql).Tables[0].Select(); bool userIsLoggedIn = Dynamicweb.Security.UserManagement.User.IsExtranetUserLoggedIn(); System.Collections.Generic.List<String> countriesList = dataSet.Select(r => ((string)r["AccessUserCountry"].ToString()).Trim() ).Distinct().ToList(); Dictionary<string, string> countriesNames = new Dictionary<string, string>(); foreach(System.Data.DataRow r in dataRegionsSet.Where(x => string.IsNullOrWhiteSpace(x["CountryTextRegionCode"].ToString()))) { if(!countriesNames.ContainsKey(r["CountryTextCode2"].ToString())) { countriesNames.Add(r["CountryTextCode2"].ToString(), r["CountryTextName"].ToString()); } } if(countryLogged != country) { stateLogged = ""; } if (userIsLoggedIn) { var user = Pageview.User; countryLogged = user.Country.ToString(); stateLogged = user.State.ToString(); } foreach (string i in countriesList) { System.Collections.Generic.List<String> regions = dataSet.Where(r => (string)r["AccessUserCountry"] == i).Select(r => ((string)r["AccessUserState"]).Trim() ).Distinct().ToList(); int countNum = 0; string countryStrip = i; if(regionsString != "{") { regionsString += ","; } regionsString += "\""+countryStrip+"\":["; foreach (string region in regions){ var regionTextList = !string.IsNullOrEmpty(region) ? dataRegionsSet.First(r => r["CountryTextRegionCode"].ToString() == region.ToString()) : null; string regionText = regionTextList != null ? regionTextList["CountryTextName"].ToString() : ""; if(!string.IsNullOrWhiteSpace(regionText)) { if(countNum != 0) { regionsString += ","; } regionsString += "\""+@regionText+"\""; countNum++; } } regionsString += "]"; } regionsString += "}"; } @helper CountrySelect(System.Collections.Generic.List<String> countriesList, Dictionary<string, string> countriesNames){ <label class="text-left">@Translate("selectYourCountry", "Select your country:")</label> <select name="country"> <option selected="selected" value="">@Translate("all", "All")</option> @RenderSnippet("US") @foreach (string countryCode in countriesList.OrderBy(s => s)) { string countryStrip = countriesNames.ContainsKey(countryCode) ? countriesNames[countryCode] : countryCode; if (countryCode == "US") { @SnippetStart("USA") <option value="@countryCode">@countryStrip</option> @SnippetEnd("USA") } else if (countryCode == "CA") { @SnippetStart("CAN") <option value="@countryCode">@countryStrip</option> @SnippetEnd("CAN") } <option value="@countryCode">@countryStrip</option> } </select> } @helper RegionSelect(){ <label class="text-left">@Translate("selectYourRegion","Select your region:")</label> <select data-width="100%" name="locality"> <option value="">@Translate("all","All")</option> </select> } <div class="col-xs-12 col-sm-3 partnersFilterContainer" id="findStoreFilter"> <h2>@Translate("findYourLocalPartnet", "Find your local partner")</h2> <fieldset class="col-xs-12 noPadding"> @CountrySelect(countriesList, countriesNames) </fieldset> <fieldset class="col-xs-12 noPadding"> @RegionSelect() </fieldset> </div> <div class="list col-sm-9 col-xs-12"> <div class="no-matches hidden">@Translate("noLocationsFound","No locations found")</div> <ol class="partnersList" data-sort-order="desc"> @foreach (System.Data.DataRow store in dataSet) { var regionTextList = dataRegionsSet.Where(r => r["CountryTextRegionCode"].ToString() == store["AccessUserState"].ToString() ).First(); string regionText = regionTextList != null ? regionTextList["CountryTextName"].ToString() : ""; string filter = store["AccessUserCountry"].ToString() + " " + regionText; string image = "/Files" + store["AccessUserImage"].ToString(); <li class="col-xs-12 col-sm-6 col-md-4" data-title="@store["AccessUserName"]" data-filter-values="@filter" data-country="@store["AccessUserCountry"]" data-citycode="@store["AccessUserState"]" data-city="@regionText" data-sort-value="@store["AccessUserName"]"> <div> <figure> <img class="img-responsive" src="@GetImage(image, 400, 0)" /> </figure> <h2>@store["AccessUserName"]</h2> @store["AccessUserAddress"]<br/> @store["AccessUserCity"] @if(!string.IsNullOrEmpty(store["AccessUserState"].ToString())) { @:, @Dynamicweb.Ecommerce.International.Country.GetRegions(store["AccessUserCountry"].ToString()).First(c => c.RegionCode == store["AccessUserState"].ToString()).Name } @store["AccessUserZip"] </div> </li> } </ol> </div> @SnippetStart("jsOnLoad") onLoadPartners('@regionsString', { str_country : "@countryLogged", str_state : "@stateLogged" }); @SnippetEnd("jsOnLoad")
2057 Vermont Drive,
Fort Collins, CO 80525 Email: customerservice@forneyind.com Phone: 1-800-521-6038