Ejemplo n.º 1
0
        /// <summary>
        /// Save grid settings for a specific module.
        /// </summary>
        /// <param name="moduleGuid">The module Guid of the module for which grid settings are saved.</param>
        /// <param name="gridSavedSettings">The grid settings to be saved.</param>
        /// <remarks>This method is not used by applications. It is reserved for component implementation.</remarks>
        public static void SaveModuleSettings(Guid moduleGuid, GridSavedSettings gridSavedSettings)
        {
            SettingsDictionary modSettings = Manager.SessionSettings.GetModuleSettings(moduleGuid);

            if (modSettings != null)
            {
                modSettings.SetValue <GridSavedSettings>("GridSavedSettings", gridSavedSettings);
                modSettings.Save();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads grid settings that have been previously saved for a specific module.
        /// If no saved settings are available, default settings are returned.
        /// </summary>
        /// <param name="moduleGuid">The module Guid of the module for which grid settings have been saved.</param>
        /// <param name="defaultInitialPage">Defines the default initial page within the grid. This page number is 1 based.</param>
        /// <param name="defaultPageSize">Defines the default initial page size of the grid.</param>
        /// <returns>Returns grid settings for the specified module.</returns>
        /// <remarks>Grid settings that are saved on behalf of modules are used whenever the module is displayed. This means that the same settings apply even if a module is used on several pages.
        ///
        /// This method is not used by applications. It is reserved for component implementation.</remarks>
        public static GridSavedSettings LoadModuleSettings(Guid moduleGuid, int defaultInitialPage = 1, int defaultPageSize = 10)
        {
            SettingsDictionary modSettings       = Manager.SessionSettings.GetModuleSettings(moduleGuid);
            GridSavedSettings  gridSavedSettings = modSettings.GetValue <GridSavedSettings>("GridSavedSettings");

            if (gridSavedSettings == null)
            {
                gridSavedSettings = new GridSavedSettings()
                {
                    CurrentPage = defaultInitialPage,
                    PageSize    = defaultPageSize,
                };
            }
            return(gridSavedSettings);
        }