/// <summary> /// Returns an object that represents the parsed expression. /// </summary> /// <param name="expression">The value of the declarative expression.</param> /// <param name="propertyType">The type of the property bound to by the expression.</param> /// <param name="context">Contextual information for the evaluation of the expression.</param> /// <returns>An Object that represents the parsed expression</returns> public override object ParseExpression(string expression, Type propertyType, ExpressionBuilderContext context) { LocaleStringResource lsr = new LocaleStringResource(); lsr.ResourceName = expression; //try //{ // lsr.LanguageID = NopContext.Current.WorkingLanguage.LanguageID; //} //catch (Exception exc) //{ //} return lsr; }
private static LocaleStringResource DBMapping(DBLocaleStringResource dbItem) { if (dbItem == null) { return(null); } LocaleStringResource item = new LocaleStringResource(); item.LocaleStringResourceID = dbItem.LocaleStringResourceID; item.LanguageID = dbItem.LanguageID; item.ResourceName = dbItem.ResourceName; item.ResourceValue = dbItem.ResourceValue; return(item); }
private static LocaleStringResourceDictionary DBMapping(DBLocaleStringResourceCollection dbCollection) { if (dbCollection == null) { return(null); } LocaleStringResourceDictionary dictionary = new LocaleStringResourceDictionary(); foreach (DBLocaleStringResource dbItem in dbCollection) { LocaleStringResource item = DBMapping(dbItem); dictionary.Add(item.ResourceName.ToLowerInvariant(), item); } return(dictionary); }
/// <summary> /// Inserts a locale string resource /// </summary> /// <param name="localeStringResource">Locale string resource</param> public void InsertLocaleStringResource(LocaleStringResource localeStringResource) { if (localeStringResource == null) { throw new ArgumentNullException("localeStringResource"); } localeStringResource.ResourceName = CommonHelper.EnsureNotNull(localeStringResource.ResourceName); localeStringResource.ResourceName = CommonHelper.EnsureMaximumLength(localeStringResource.ResourceName, 200); localeStringResource.ResourceValue = CommonHelper.EnsureNotNull(localeStringResource.ResourceValue); _context.LocaleStringResources.AddObject(localeStringResource); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(LOCALSTRINGRESOURCES_PATTERN_KEY); } }
public LocaleStringResource SaveInfo() { LocaleStringResource localeStringResource = this.LocalizationManager.GetLocaleStringResourceById(this.LocaleStringResourceId); if (localeStringResource != null) { localeStringResource.ResourceName = txtResourceName.Text; localeStringResource.ResourceValue = txtResourceValue.Text; this.LocalizationManager.UpdateLocaleStringResource(localeStringResource); } else { localeStringResource = new LocaleStringResource() { LanguageId = this.LanguageId, ResourceName = txtResourceName.Text, ResourceValue = txtResourceValue.Text }; this.LocalizationManager.InsertLocaleStringResource(localeStringResource); } return localeStringResource; }
/// <summary> /// Returns an object that represents the parsed expression. /// </summary> /// <param name="expression">The value of the declarative expression.</param> /// <param name="propertyType">The type of the property bound to by the expression.</param> /// <param name="context">Contextual information for the evaluation of the expression.</param> /// <returns>An Object that represents the parsed expression</returns> public override object ParseExpression(string expression, Type propertyType, ExpressionBuilderContext context) { var lsr = new LocaleStringResource(); lsr.ResourceName = expression; return lsr; }
/// <summary> /// Updates the locale string resource /// </summary> /// <param name="localeStringResource">Locale string resource</param> public void UpdateLocaleStringResource(LocaleStringResource localeStringResource) { if (localeStringResource == null) throw new ArgumentNullException("localeStringResource"); localeStringResource.ResourceName = CommonHelper.EnsureNotNull(localeStringResource.ResourceName); localeStringResource.ResourceName = CommonHelper.EnsureMaximumLength(localeStringResource.ResourceName, 200); localeStringResource.ResourceValue = CommonHelper.EnsureNotNull(localeStringResource.ResourceValue); if (!_context.IsAttached(localeStringResource)) _context.LocaleStringResources.Attach(localeStringResource); _context.SaveChanges(); if (this.CacheEnabled) { _cacheManager.RemoveByPattern(LOCALSTRINGRESOURCES_PATTERN_KEY); } }