Ejemplo n.º 1
0
        /// <summary>
        /// Get a single StoreSetting from the StoreSetting table
        /// </summary>
        public static StoreSetting GetStoreSetting(string storeSettingName)
        {
            // Invalid Id
            if (storeSettingName == null)
            {
                return(null);
            }

            // Scan existing
            StoreSetting storeSetting = StoreSetting.Get(storeSettingName);

            if ((StoreSettings.Count > 0) && (StoreSettings.Keys.Contains(storeSetting.Id)))
            {
                StoreSetting.Refresh(StoreSettings[storeSetting.Id], storeSetting);
                return(StoreSettings[storeSetting.Id]);
            }

            // Not found, let's check the database
            if (storeSetting != null)
            {
                StoreSettings.Add(storeSetting.Id, storeSetting);
                return(storeSetting);
            }
            return(null);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Gets the managed StoreSetting, or creates a managed StoreSetting if
 /// one doesn't exist.
 /// </summary>
 private static StoreSetting GetUpdatedManagedStoreSetting(StoreSetting storeSetting)
 {
     if ((StoreSettings.Count == 0) || !StoreSettings.Keys.Contains(storeSetting.Id))
     {
         // Setting is not a managed instance yet
         StoreSettings.Add(storeSetting.Id, storeSetting);
     }
     else
     {
         // Refresh the managed StoreSetting with the current StoreSetting instance
         StoreSetting.Refresh(StoreSettings[storeSetting.Id], storeSetting);
     }
     return(StoreSettings[storeSetting.Id]);
 }