Exemple #1
0
        /// <summary>
        /// Sets value to settings table
        /// </summary>
        /// <param name="name"></param>
        /// <param name="value"></param>
        public static void Set(string name, object value)
        {
            //  Structures and IClonable classes can only be added and automatically cloned to the settings table
            //  Any other types added to settings table will not be multiplied during new setting creation
            var ht = (SettingsKeys.Contains(name)) ? Default.ActiveTable : Default.DataTable;

            ht[name] = value;
        }
 public void SaveSetting(Guid id, SettingsKeys sk, string value)
 {
     AppSettings setting = new AppSettings(id)
     {
         Key = sk,
         Value = value
     };
     _settingsRepository.Save(setting);
 }
Exemple #3
0
        public static string UpComingReminderID()
        {
            string UpComingReminderKey = SettingsKeys.UpComingReminderKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var setting = db.Settings.Where(x => x.Key == UpComingReminderKey).FirstOrDefault();
                return(setting.Values);
            }
        }
Exemple #4
0
        public static string SendAnniversaryID()
        {
            string SendAnniversaryKey = SettingsKeys.SendAnniversaryKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var setting = db.Settings.Where(x => x.Key == SendAnniversaryKey).FirstOrDefault();
                return(setting.Values);
            }
        }
Exemple #5
0
        public static string portnumber()
        {
            string portnumberKey = SettingsKeys.portnumberKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var setting = db.Settings.Where(x => x.Key == portnumberKey).FirstOrDefault();
                return(setting.Description);
            }
        }
Exemple #6
0
        public static string smtpaddress()
        {
            string smtpaddressKey = SettingsKeys.smtpaddressKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var setting = db.Settings.Where(x => x.Key == smtpaddressKey).FirstOrDefault();
                return(setting.Values);
            }
        }
Exemple #7
0
        public static string PasswordSender()
        {
            string PasswordSenderKey = SettingsKeys.PasswordSenderKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var setting = db.Settings.Where(x => x.Key == PasswordSenderKey).FirstOrDefault();
                return(setting.Values);
            }
        }
Exemple #8
0
        public static string EmailAdmin()
        {
            string EmailAdminKey = SettingsKeys.EmailAdminKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var setting = db.Settings.Where(x => x.Key == EmailAdminKey).FirstOrDefault();
                return(setting.Description);
            }
        }
Exemple #9
0
        public static string AnniversaryEmailText()
        {
            string AnniversaryEmailTextKey = SettingsKeys.AnniversaryEmailTextKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var setting = db.Settings.Where(x => x.Key == AnniversaryEmailTextKey).FirstOrDefault();
                return(setting.Description);
            }
        }
        public Settings GetByKey(SettingsKeys key)
        {
            Settings settings = null;

            using (var ctx = GetVtsContext("SettingsRepository"))
            {
                settings = CtxSetup(ctx.Settings).FirstOrDefault(n => n.Key == key);
            }
            return(settings);
        }
Exemple #11
0
        private async Task <IEnumerable <WorkItem> > GetWorkItems()
        {
            var query = serviceProvider.Get <SettingsService>().Get(SettingsKeys.WorkItemSectionQueryKey(UserContext), TfsContext.WorkItemManager.GetDefaultUserWorkItemQuery(UserContext.Identity));

            if (string.IsNullOrEmpty(query))
            {
                query = TfsContext.WorkItemManager.GetDefaultUserWorkItemQuery(UserContext.Identity);
            }
            return((await TfsContext.WorkItemManager.RunQueryAsync(query)).OfType <WorkItem>());
        }
Exemple #12
0
        /// <summary>
        /// Set object by key
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="name"></param>
        /// <param name="default"></param>
        /// <returns></returns>
        public static T Get <T>(string name, T @default)
        {
            var ht = (SettingsKeys.Contains(name)) ? Default.ActiveTable : Default.DataTable;

            if (!ht.Contains(name))
            {
                ht[name] = @default;
            }
            return((T)ht[name]);
        }
Exemple #13
0
        public static string UpComingReminderEN()
        {
            string UpComingReminderKey = SettingsKeys.UpComingReminderKey();

            using (RemindersEntities db = new RemindersEntities())
            {
                var Settings = db.Settings.Where(x => x.Key == UpComingReminderKey).FirstOrDefault();
                var value    = Convert.ToInt32(Settings.Values);
                var Lookups  = db.Lookups.Where(x => x.ID == value).FirstOrDefault();
                return(Lookups.NameEn);
            }
        }
Exemple #14
0
        private void ChangeWorkItemsQuery(object obj)
        {
            var query = serviceProvider.Get <SettingsService>().Get(SettingsKeys.WorkItemSectionQueryKey(UserContext), TfsContext.WorkItemManager.GetDefaultUserWorkItemQuery(UserContext.Identity));

            if (string.IsNullOrEmpty(query))
            {
                query = TfsContext.WorkItemManager.GetDefaultUserWorkItemQuery(UserContext.Identity);
            }
            QueryEditorDialog dialog = new QueryEditorDialog(query)
            {
                CanSelectQuery = true
            };

            dialog.RunQuery += (o, args) => TfsContext.WorkItemManager.ShowQueryResults(WorkItemManager.PrepareQueryText(dialog.Query));
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                serviceProvider.Get <SettingsService>().Set(SettingsKeys.WorkItemSectionQueryKey(UserContext), dialog.Query);
            }
        }
Exemple #15
0
 public void SetNetworkSetting(SettingsKeys key, int value)
 {
     SetSetting("Network Settings", key.ToString(), value.ToString(CultureInfo.InvariantCulture));
 }
Exemple #16
0
 public int GetNetworkSetting(SettingsKeys key)
 {
     return(GetSetting("Network Settings", key.ToString()).IntValue);
 }
Exemple #17
0
 public void SetClientSetting(SettingsKeys key, string value)
 {
     SetSetting("Client Settings", key.ToString(), value);
 }
Exemple #18
0
 public Setting GetClientSetting(SettingsKeys key)
 {
     return(GetSetting("Client Settings", key.ToString()));
 }
Exemple #19
0
 public void SetPositionSetting(SettingsKeys key, double value)
 {
     SetSetting("Position Settings", key.ToString(), value.ToString(CultureInfo.InvariantCulture));
 }
 public void SetClientSetting(SettingsKeys key, string[] strArray)
 {
     SetSetting("Client Settings", key.ToString(), strArray);
 }
 public SettingsViewModel GetIdFromKey(SettingsKeys sk)
 {
     return GetAll(true)
         .Where(n => n.Key == sk)
         .Select(n => 
             new SettingsViewModel
             {
                 Key = n.Key,
                 Value = n.Value,
                 Id = n.Id,
                 IsActive = n.IsActive
             }).First();
 }
 protected Guid AddAppSetting(string value, SettingsKeys key)
 {
     AppSettings setting = new AppSettings(Guid.NewGuid())
                               {
                                   Key = key,
                                   Value = value
                               };
     setting._SetStatus(EntityStatus.Active);
     return _settingsRepository.Save(setting);
 }
Exemple #23
0
        /// <summary>
        /// Determines whether this instance is injectable the specified setting.
        /// </summary>
        /// <returns><c>true</c> if this instance is injectable the specified setting; otherwise, <c>false</c>.</returns>
        /// <param name="setting">Setting.</param>
        private bool IsInjectable(KeyValuePair <string, object> setting)
        {
            bool isUnsafe = SettingsKeys.Contains(setting.Key) || setting.Key.EndsWith(OverrideSuffix);

            return(!isUnsafe || this.InjectOwnSettings);
        }
    /// <summary>
    /// Displays info label, if any module is disabled
    /// </summary>
    private bool DisplayErrorText()
    {
        GlobalObjects = ";" + GlobalObjects + ";";
        SiteObjects   = ";" + SiteObjects + ";";
        String invalidKeys    = String.Empty;
        bool   keyDisabled    = false;
        bool   isAnyKeySite   = false;
        bool   settingChecked = false;
        bool   showSite       = false;
        bool   showGlobal     = false;

        if (!String.IsNullOrEmpty(SettingsKeys))
        {
            // Iterate through all settings keys
            int i = 0;
            foreach (String key in SettingsKeys.Split(';'))
            {
                if (key != String.Empty)
                {
                    String objectKey    = ";" + key + ";";
                    bool   globalObject = GlobalObjects.Contains(objectKey);
                    bool   siteObject   = SiteObjects.Contains(objectKey);
                    String siteKeyName  = SiteName + "." + key;
                    String keyName      = (SiteOrGlobal || globalObject || KeyScope == DisabledModuleScope.Global) ? key : siteKeyName;

                    // If module disabled
                    if (!SettingsKeyProvider.GetBoolValue(keyName) || (siteObject && !SettingsKeyProvider.GetBoolValue(siteKeyName)))
                    {
                        // For siteorglobal settings check site setting separately
                        if (SiteOrGlobal && SettingsKeyProvider.GetBoolValue(siteKeyName))
                        {
                            settingChecked = true;
                            i++;
                            continue;
                        }

                        // If atleastone is checked, info error is set later
                        if (!AtLeastOne)
                        {
                            // If setting is global - hide site button
                            SettingsKeyInfo ski = SettingsKeyProvider.GetSettingsKeyInfo(key);
                            if ((ski != null) && (!ski.KeyIsGlobal))
                            {
                                isAnyKeySite = true;
                            }

                            // Get text (either from collection of text or from single text property)
                            String text = (InfoTexts.Count != 0 && InfoTexts.Count > i) ? InfoTexts[i] : InfoText;

                            // Add new text to label
                            lblText.Text += text;

                            // Add this key to collection of disabled keys
                            invalidKeys = key + ";";

                            // Make this info label visible
                            keyDisabled = true;

                            if (!siteObject && !globalObject)
                            {
                                showSite   = (KeyScope != DisabledModuleScope.Global);
                                showGlobal = (KeyScope != DisabledModuleScope.Site);
                            }
                            else
                            {
                                showSite   |= siteObject;
                                showGlobal |= globalObject;
                            }
                        }
                    }
                    else
                    {
                        settingChecked = true;
                    }
                }
                i++;
            }
        }

        // If atleastone is set, check if any setting is checked. If no, display warning message
        if (AtLeastOne && !settingChecked)
        {
            keyDisabled  = true;
            lblText.Text = InfoText;
        }

        // If parent panel is set, show(hide) it
        if (ParentPanel != null)
        {
            ParentPanel.Visible = keyDisabled;
        }

        // Show/hide this control if module disabled
        Visible = keyDisabled;

        // Show site button only if any key is site
        pnlSiteButton.Visible = isAnyKeySite;

        // Set result to property
        SettingsEnabled = !keyDisabled;

        pnlSiteButton.Visible   &= showSite;
        pnlGlobalButton.Visible &= showGlobal;

        return(!keyDisabled);
    }
Exemple #25
0
        //---------------------------------save list data after edit--------------------------------------//
        public static void Save(SettingsViewModel settingviewmodel)
        {
            try
            {
                RemindersEntities Entities = new RemindersEntities();


                string BirthDayEmailTextKey    = SettingsKeys.BirthDayEmailTextKey();
                string AnniversaryEmailTextKey = SettingsKeys.AnniversaryEmailTextKey();
                string BirthdayReminderKey     = SettingsKeys.BirthdayReminderKey();
                string AnniversaryReminderKey  = SettingsKeys.AnniversaryReminderKey();
                string EventReminderKey        = SettingsKeys.EventReminderKey();
                string SendBirthdayKey         = SettingsKeys.SendBirthdayKey();
                string SendAnniversaryKey      = SettingsKeys.SendAnniversaryKey();
                string SendEventKey            = SettingsKeys.SendEventKey();
                string UpComingReminderKey     = SettingsKeys.UpComingReminderKey();
                string EmailAdminKey           = SettingsKeys.EmailAdminKey();
                string EmailSenderKey          = SettingsKeys.EmailSenderKey();
                string PasswordSenderKey       = SettingsKeys.PasswordSenderKey();
                string smtpaddressKey          = SettingsKeys.smtpaddressKey();
                string portnumberKey           = SettingsKeys.portnumberKey();



                var set0 = Entities.Settings.Where(x => x.Key == BirthDayEmailTextKey).FirstOrDefault();
                set0.Values      = settingviewmodel.settingsView.BirthDayEmailText;
                set0.Description = settingviewmodel.settingsView.BirthDayEmailText;
                set0.CreatedOn   = DateTime.Now;

                var set1 = Entities.Settings.Where(x => x.Key == AnniversaryEmailTextKey).FirstOrDefault();
                set1.Values      = settingviewmodel.settingsView.AnniversaryEmailText;
                set1.Description = settingviewmodel.settingsView.AnniversaryEmailText;
                set1.CreatedOn   = DateTime.Now;


                var set2 = Entities.Settings.Where(x => x.Key == BirthdayReminderKey).FirstOrDefault();
                set2.Values = settingviewmodel.BirthdayReminderID.ToString();
                var Lookup2 = Entities.Lookups.Find(settingviewmodel.BirthdayReminderID);
                set2.Description = Lookup2.Description.ToString();
                set2.CreatedOn   = DateTime.Now;


                var set3 = Entities.Settings.Where(x => x.Key == AnniversaryReminderKey).FirstOrDefault();
                set3.Values = settingviewmodel.AnniversaryReminderID.ToString();
                var Lookup3 = Entities.Lookups.Find(settingviewmodel.AnniversaryReminderID);
                set3.Description = Lookup3.Description.ToString();
                set3.CreatedOn   = DateTime.Now;

                var set4 = Entities.Settings.Where(x => x.Key == EventReminderKey).FirstOrDefault();
                set4.Values = settingviewmodel.EventReminderID.ToString();
                var Lookup4 = Entities.Lookups.Find(settingviewmodel.EventReminderID);
                set4.Description = Lookup4.Description.ToString();
                set4.CreatedOn   = DateTime.Now;

                var set5 = Entities.Settings.Where(x => x.Key == SendBirthdayKey).FirstOrDefault();
                set5.Values = settingviewmodel.SendBirthdayID.ToString();
                var Lookup5 = Entities.Lookups.Find(settingviewmodel.SendBirthdayID);
                set5.Description = Lookup5.Description.ToString();
                set5.CreatedOn   = DateTime.Now;

                var set6 = Entities.Settings.Where(x => x.Key == SendAnniversaryKey).FirstOrDefault();
                set6.Values = settingviewmodel.SendAnniversaryID.ToString();
                var Lookup6 = Entities.Lookups.Find(settingviewmodel.SendAnniversaryID);
                set6.Description = Lookup6.Description.ToString();
                set6.CreatedOn   = DateTime.Now;

                var set7 = Entities.Settings.Where(x => x.Key == SendEventKey).FirstOrDefault();
                set7.Values = settingviewmodel.SendEventID.ToString();
                var Lookup7 = Entities.Lookups.Find(settingviewmodel.SendEventID);
                set7.Description = Lookup7.Description.ToString();
                set7.CreatedOn   = DateTime.Now;

                var set8 = Entities.Settings.Where(x => x.Key == UpComingReminderKey).FirstOrDefault();
                set8.Values = settingviewmodel.UpComingReminderID.ToString();
                var Lookup8 = Entities.Lookups.Find(settingviewmodel.UpComingReminderID);
                set8.Description = Lookup8.Description.ToString();
                set8.CreatedOn   = DateTime.Now;

                var set15 = Entities.Settings.Where(x => x.Key == EmailAdminKey).FirstOrDefault();
                set15.Values      = settingviewmodel.settingsView.EmailAdmin.ToString();
                set15.Description = settingviewmodel.settingsView.EmailAdmin.ToString();
                set15.CreatedOn   = DateTime.Now;

                Entities.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void CreateOrUpdateKeyValue(SettingsKeys key, SettingsInDetailViewModel viewModel)
        {
            string value = null;
            switch (key)
            {
                case SettingsKeys.WebServerUrl:
                    value = viewModel.WebServerUrl ?? "";
                    break;
                case SettingsKeys.PaymentGatewayWSUrl:
                    value = viewModel.PaymentGatewayWSUrl ?? "";
                    break;
                case SettingsKeys.AllowBarcodeInput:
                    value = viewModel.AllowBarcodeInput ?? "0";
                    break;
                case SettingsKeys.RecordsPerPage:
                    value = viewModel.RecordsPerPage.ToString() ?? "10";
                    break;
                case SettingsKeys.ApproveAndDispatch:
                    value = viewModel.ApproveAndDispatch ?? "0";
                    break;
                case SettingsKeys.AllowDecimal:
                    value = viewModel.AllowDecimal.ToString();
                    break;
                case SettingsKeys.EnForceStockTake:

                    value = viewModel.EnForceStockTake.ToString();
                    break;
                case SettingsKeys.EnableGps:
                    value = viewModel.EnableGps.ToString();
                    break;
                case SettingsKeys.NumberOfDecimalPlaces:
                    value = viewModel.NumberOfDecimalPlaces.ToString();
                    break;
            }

            if (_settingsViewModelBuilder.HasKey(key))
            {
                var setting = _settingsViewModelBuilder.GetIdFromKey(key);
                if (setting.Value != value)
                {
                    var id = setting.Id;
                    _settingsViewModelBuilder.SaveSetting(id, key, value);

                }
            }
            else
            {
                var id = Guid.NewGuid();
                _settingsViewModelBuilder.SaveSetting(id, key, value);
            }
        }
 public void SetInactive(SettingsKeys key)
 {
     var setting = _settingsRepository.GetByKey(key);
     if (setting != null)
         _settingsRepository.SetInactive(setting);
 }
 public void SetAsDeleted(SettingsKeys key)
 {
     var setting = _settingsRepository.GetByKey(key);
     if (setting != null)
         _settingsRepository.SetAsDeleted(setting);
 }
Exemple #29
0
 public Settings GetByKey(SettingsKeys key)
 {
     throw new NotImplementedException();
 }
 public bool HasKey(SettingsKeys sk)
 {
     return GetAll(true).Any(n => n.Key == sk);
 }
Exemple #31
0
 public Setting GetPositionSetting(SettingsKeys key)
 {
     return(GetSetting("Position Settings", key.ToString()));
 }
Exemple #32
0
    /// <summary>
    /// Displays info label, if any module is disabled
    /// </summary>
    private bool DisplayErrorText()
    {
        GlobalObjects = ";" + GlobalObjects + ";";
        SiteObjects   = ";" + SiteObjects + ";";

        bool keyDisabled    = false;
        bool isAnyKeySite   = false;
        bool settingChecked = false;
        bool showSite       = false;
        bool showGlobal     = false;

        // Check config keys - stronger
        if (!String.IsNullOrEmpty(ConfigKeys))
        {
            var keys = ConfigKeys.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string key in keys)
            {
                if (!ValidationHelper.GetBoolean(SettingsHelper.AppSettings[key], false))
                {
                    if (!AtLeastOne)
                    {
                        settingChecked = false;
                        break;
                    }
                }
                else
                {
                    settingChecked = true;
                }
            }
        }

        // Check settings
        if (!settingChecked && !String.IsNullOrEmpty(SettingsKeys))
        {
            int i = 0;

            var keys = SettingsKeys.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string key in keys)
            {
                String objectKey    = ";" + key + ";";
                bool   globalObject = GlobalObjects.Contains(objectKey);
                bool   siteObject   = SiteObjects.Contains(objectKey);
                String siteKeyName  = SiteName + "." + key;
                String keyName      = (SiteOrGlobal || globalObject || KeyScope == DisabledModuleScope.Global) ? key : siteKeyName;

                // If module disabled
                if (!SettingsKeyInfoProvider.GetBoolValue(keyName) || (siteObject && !SettingsKeyInfoProvider.GetBoolValue(siteKeyName)))
                {
                    // For site or global settings check site setting separately
                    if (SiteOrGlobal && SettingsKeyInfoProvider.GetBoolValue(siteKeyName))
                    {
                        settingChecked = true;
                        i++;
                        continue;
                    }

                    // If at least one is checked, info error is set later
                    if (!AtLeastOne)
                    {
                        // If setting is global - hide site button
                        var ski = SettingsKeyInfoProvider.GetSettingsKeyInfo(key);
                        if ((ski != null) && (!ski.KeyIsGlobal))
                        {
                            isAnyKeySite = true;
                        }

                        // Get text (either from collection of text or from single text property)
                        String text = (InfoTexts.Count != 0 && InfoTexts.Count > i) ? InfoTexts[i] : InfoText;

                        if (String.IsNullOrEmpty(text) && (ski != null))
                        {
                            text = GenerateInfoText(ski);
                        }

                        if (lblText.Text != "")
                        {
                            lblText.Text += " ";
                        }

                        // Add new text to label
                        lblText.Text += text;

                        // Add this key to collection of disabled keys

                        // Make this info label visible
                        keyDisabled = !String.IsNullOrEmpty(text);

                        if (!siteObject && !globalObject)
                        {
                            showSite   = (KeyScope != DisabledModuleScope.Global);
                            showGlobal = (KeyScope != DisabledModuleScope.Site);
                        }
                        else
                        {
                            showSite   |= siteObject;
                            showGlobal |= globalObject;
                        }
                    }
                }
                else
                {
                    settingChecked = true;
                }

                i++;
            }
        }

        // If atleastone is set, check if any setting is checked. If no, display warning message
        if (AtLeastOne && !settingChecked)
        {
            keyDisabled  = true;
            lblText.Text = InfoText;
        }

        // If parent panel is set, show(hide) it
        if (ParentPanel != null)
        {
            ParentPanel.Visible = keyDisabled;
        }

        // Show/hide this control if module disabled
        Visible = keyDisabled;

        // Show site button only if any key is site
        btnSite.Visible = isAnyKeySite;

        // Set result to property
        SettingsEnabled = !keyDisabled;

        btnSite.Visible   &= showSite;
        btnGlobal.Visible &= showGlobal;

        return(!keyDisabled);
    }
Exemple #33
0
        private bool ViewAgriModules(User user,AgriUserRole role,SettingsKeys settingKey)
        {
            var settings = ObjectFactory.GetInstance<ISettingsRepository>();

            bool result = false;

            var canViewModuleSetting = settings.GetByKey(settingKey) != null ? settings.GetByKey(settingKey).Value : null;
            var canViewModuleRight = user.UserRoles.Contains(((int)role).ToString());

            if (canViewModuleSetting == null || Convert.ToBoolean(canViewModuleSetting)==false)
            {
                result = false;
                //return result;
            }
            if (canViewModuleSetting != null && Convert.ToBoolean(canViewModuleSetting))
            {   
                result = true;
                if (!canViewModuleRight)
                    result = false;

            }



            return result;


        }
    /// <summary>
    /// Saves the changed settings
    /// </summary>
    /// <param name="isSite">Indicates whether changed settings is global or site</param>
    private void Save(bool isSite)
    {
        // This action is permitted only for global administrators
        if (CMSContext.CurrentUser.IsGlobalAdministrator)
        {
            if (!String.IsNullOrEmpty(SettingsKeys))
            {
                String[] keys = SettingsKeys.Split(';');
                foreach (String key in keys)
                {
                    if (key != String.Empty)
                    {
                        String objectKey    = ";" + key + ";";
                        String siteKeyName  = SiteName + "." + key;
                        bool   globalObject = GlobalObjects.Contains(objectKey);
                        bool   siteObject   = SiteObjects.Contains(objectKey);

                        // If setting is global or site (or both), set global(site) settings no matter what button (site or global) was clicked
                        if (globalObject || siteObject)
                        {
                            if (globalObject)
                            {
                                if (!SettingsKeyProvider.GetBoolValue(key))
                                {
                                    ObjectHelper.SetSettingsKeyValue(key, true);
                                }
                            }

                            if (siteObject)
                            {
                                if (!SettingsKeyProvider.GetBoolValue(siteKeyName))
                                {
                                    ObjectHelper.SetSettingsKeyValue(siteKeyName, true);
                                }
                            }

                            continue;
                        }

                        // Test first if settings is disabled
                        if (!SettingsKeyProvider.GetBoolValue(siteKeyName))
                        {
                            String keyName = isSite ? siteKeyName : key;
                            try
                            {
                                ObjectHelper.SetSettingsKeyValue(keyName, true);
                            }
                            catch (Exception)
                            {
                                if (isSite)
                                {
                                    // Site settings does not exists. Save as global then
                                    ObjectHelper.SetSettingsKeyValue(key, true);
                                }
                            }

                            // If global enabled and site still disabled - enable it also
                            if (!isSite && (KeyScope != DisabledModuleScope.Global))
                            {
                                // If settings not enabled, inherit from global
                                if (!SettingsKeyProvider.GetBoolValue(siteKeyName))
                                {
                                    ObjectHelper.SetSettingsKeyValue(siteKeyName, null);
                                }
                            }
                        }
                    }
                }
            }

            URLHelper.Redirect(URLHelper.CurrentURL);
        }
    }
Exemple #35
0
 public SettingsRef(Guid id, SettingsKeys key)
 {
     Id  = id;
     Key = key;
 }