public List <HilfeSucheModel> Suche(EmsgLanguage language, string filter) { var result = new List <HilfeSucheModel>(); if (string.IsNullOrWhiteSpace(filter)) { return(helpInhalten.Value[language].Select(h => new HilfeSucheModel { InhaltLink = GetInhaltLink(language, h.Key), InhaltText = h.Value, MatchCountText = GetMatchCountText() }).ToList()); } ; var filterRegex = new Regex(Regex.Escape(filter), RegexOptions.IgnoreCase); foreach (var helpFile in helpTexts.Value[language]) { var match = filterRegex.Matches(helpFile.Value); if (match.Count > 0) { result.Add(new HilfeSucheModel() { InhaltLink = GetInhaltLink(language, helpFile.Key), MatchCount = match.Count, MatchCountText = GetMatchCountText(match.Count), InhaltText = helpInhalten.Value[language][helpFile.Key] }); } } return(result); }
public static CultureInfo ToCultureInfo(this EmsgLanguage emsgLanguage) { //alway use the de-ch formatting according TFS8338: Bitte in allen drei Sprachen die Zahlen mit de-ch formatieren! CultureInfo deChCulture = CultureInfo.CreateSpecificCulture("de-ch"); CultureInfo resultCulture; switch (emsgLanguage) { case EmsgLanguage.Ch: resultCulture = deChCulture; break; case EmsgLanguage.Fr: resultCulture = CultureInfo.CreateSpecificCulture("fr-ch"); resultCulture.NumberFormat = deChCulture.NumberFormat; break; case EmsgLanguage.It: resultCulture = CultureInfo.CreateSpecificCulture("it-ch"); resultCulture.NumberFormat = deChCulture.NumberFormat; break; default: throw new ArgumentOutOfRangeException("emsgLanguage"); } return(resultCulture); }
public static MvcHtmlString FlagButton(this HtmlHelper helper, EmsgLanguage emsgLanguage, bool isSelected = false) { //string onClickAction = string.Format("javascript:window.location='{0}'", helper.ToUrlHelper().Action("SetLanguage", "Header", new {emsgLanguage})); //return ImageButton(helper, helper.ToUrlHelper().Content(string.Format("~/Content/flags/{0}.png", emsgLanguage)), ButtonLocalization.ResourceManager.GetString(emsgLanguage.ToString()), onClickAction, false, isSelected ? "t-emsg-selected-image-button" : null); string onClickAction = string.Format("javascript:window.location='{0}'", helper.ToUrlHelper().Action("SetLanguage", "Header", new { emsgLanguage })); return(Button(helper, ButtonLocalization.ResourceManager.GetString(emsgLanguage.ToString()), onClickAction, isSelected ? "t-emsg-selected-image-button" : null)); }
public ActionResult SetLanguage(EmsgLanguage emsgLanguage, bool?lastMethodPost) { cookieService.EmsgLanguage = emsgLanguage; var urlReferrer = ControllerContext.HttpContext.Request.UrlReferrer; if (urlReferrer != null && !(lastMethodPost ?? false)) { return(Redirect(urlReferrer.ToString())); } return(RedirectToAction("Index", "Home", new { area = "" })); }
private string GetContentPageName(EmsgLanguage language) { return(HelpFileMappingStore.GetContentsPath(language.ToCultureInfo().TwoLetterISOLanguageName)); }
private static string GetInhaltLink(EmsgLanguage language, string helpFile) { return(new UrlHelper(HttpContext.Current.Request.RequestContext).Action("HilfeSucheResult", "HilfeSuche", new { helpFilePath = helpFile, culture = GetTwoLetterLanguageName(language) })); }
private static string GetTwoLetterLanguageName(EmsgLanguage language) { return(language.ToCultureInfo().TwoLetterISOLanguageName); }