コード例 #1
0
        protected override async Task OnLoadSnapshot(
            CatchupCacheSubscriptionHolder <TAggregate>[]?catchupCacheSubscriptionHolders,
            ISnapshotStrategy?snapshotStrategy,
            ISnapshotStore <TAggregate>?snapshotStore)
        {
            if (UseSnapshot)
            {
#nullable disable

                var eventTypeFilter = GetEventsFilters();

                foreach (var catchupCacheSubscriptionHolder in catchupCacheSubscriptionHolders)
                {
                    var snapshot = await snapshotStore.GetByVersionOrLast(catchupCacheSubscriptionHolder.StreamId, eventTypeFilter);

                    if (null == snapshot)
                    {
                        continue;
                    }

                    catchupCacheSubscriptionHolder.CurrentSnapshotEventVersion      = snapshot.VersionFromSnapshot;
                    catchupCacheSubscriptionHolder.LastProcessedEventSequenceNumber = snapshot.VersionFromSnapshot;
                    catchupCacheSubscriptionHolder.LastProcessedEventUtcTimestamp   = DateTime.UtcNow;

                    Logger?.LogInformation($"{Id} => OnLoadSnapshot - EntityId: {snapshot.EntityId} StreamId: {snapshot.EntityId}");

                    CurrentCache.AddOrUpdate(snapshot);
                }

#nullable disable
            }
コード例 #2
0
ファイル: Pages.ascx.cs プロジェクト: wforney/portal
        /// <summary>
        /// The UpDown_Click server event handler on this page is
        ///   used to move a portal module up or down on a tab's layout pane
        /// </summary>
        /// <param name="sender">
        /// The source of the event.
        /// </param>
        /// <param name="e">
        /// The <see cref="T:System.Web.UI.ImageClickEventArgs"/> instance containing the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        //protected void UpDownClick(object sender, ImageClickEventArgs e)
        //{
        //    var cmd = ((ImageButton)sender).CommandName;

        //    if (this.tabList.SelectedIndex > -1)
        //    {
        //        int delta;

        //        // Determine the delta to apply in the order number for the module
        //        // within the list.  +3 moves down one item; -3 moves up one item
        //        if (cmd == "down")
        //        {
        //            delta = 3;
        //        }
        //        else
        //        {
        //            delta = -3;
        //        }

        //        var t = this.PortalPages[this.tabList.SelectedIndex];
        //        t.Order += delta;
        //        this.OrderPages();
        //        this.Response.Redirect(
        //            HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, this.PageID, "selectedtabID=" + t.ID));
        //    }
        //}

        /// <summary>
        /// The OrderPages helper method is used to reset
        ///   the display order for tabs within the portal
        /// </summary>
        /// <remarks>
        /// </remarks>
        private void OrderPages()
        {
            var i = 1;

            this.PortalPages.Sort();

            foreach (var t in this.PortalPages)
            {
                // number the items 1, 3, 5, etc. to provide an empty order
                // number when moving items up and down in the list.
                t.Order = i;
                i      += 2;

                // rewrite tab to database
                var tabs = new PagesDB();

                // 12/16/2002 Start - Cory Isakson
                tabs.UpdatePageOrder(t.ID, t.Order);

                // 12/16/2002 End - Cory Isakson
            }

            // gbs: Invalidate cache, fix for bug RBM-220
            CurrentCache.RemoveAll("_PageNavigationSettings_");
        }
コード例 #3
0
        /// <summary>
        /// Updates the module setting.
        /// </summary>
        /// <param name="moduleId">
        /// The module id.
        /// </param>
        /// <param name="key">
        /// The key.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        /// <remarks>
        /// </remarks>
        public static void UpdateModuleSetting(int moduleId, string key, string value)
        {
            using (var connection = Config.SqlConnectionString)
                using (var command = new SqlCommand("rb_UpdateModuleSetting", connection))
                {
                    command.CommandType = CommandType.StoredProcedure;
                    var parameter = new SqlParameter("@ModuleID", SqlDbType.Int, 4)
                    {
                        Value = moduleId
                    };
                    command.Parameters.Add(parameter);
                    var parameter2 = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50)
                    {
                        Value = key
                    };
                    command.Parameters.Add(parameter2);
                    var parameter3 = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 0x5dc)
                    {
                        Value = value
                    };
                    command.Parameters.Add(parameter3);
                    connection.Open();
                    command.ExecuteNonQuery();
                }

            CurrentCache.Remove(Key.ModuleSettings(moduleId));
        }
コード例 #4
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            string editPortal = Request.Params["selectedTemplate"];

            if (editPortal != null)
            {
                if (Page.IsPostBack == false)
                {
                    List <String> lstPortal = new List <string>();
                    lstPortal.Add(editPortal);
                    ddlXMLTemplates.DataSource = lstPortal;
                    ddlXMLTemplates.DataBind();
                }
            }
            else
            {
                // Verify that the current user has access to access this page
                // Removed by Mario Endara <*****@*****.**> (2004/11/04)
                //            if (PortalSecurity.IsInRoles("Admins") == false)
                //                PortalSecurity.AccessDeniedEdit();
                // If this is the first visit to the page, populate the site data
                if (Page.IsPostBack == false)
                {
                    var templateServices = PortalTemplateFactory.GetPortalTemplateServices(new PortalTemplateRepository());


                    ddlXMLTemplates.DataSource = templateServices.GetTemplates(PortalSettings.PortalAlias, PortalSettings.PortalFullPath);
                    ddlXMLTemplates.DataBind();
                    if (ddlXMLTemplates.Items.Count != 0)
                    {
                        ddlXMLTemplates.SelectedIndex = 0;
                    }
                    else
                    {
                        chkUseXMLTemplate.Enabled = false;
                    }
                }
            }
            var chkbox = Request.Params["chkUseXMLTemplate"];

            if (chkbox != null)
            {
                chkUseXMLTemplate.Checked = bool.Parse(Request.Params["chkUseXMLTemplate"]);
            }
            if (chkUseXMLTemplate.Checked == false)
            {
                // Don't use a template portal, so show the EditTable
                // Remove the cache that can be setted by the new Portal, to get a "clean" PortalBaseSetting
                CurrentCache.Remove(Key.PortalBaseSettings());
                EditTable.DataSource = new SortedList(PortalSettings.GetPortalBaseSettings(null));
                EditTable.DataBind();
                EditTable.Visible       = true;
                ddlXMLTemplates.Enabled = false;
            }
            else
            {
                EditTable.Visible       = false;
                ddlXMLTemplates.Enabled = true;
            }
        }
コード例 #5
0
        private static GeographicProvider GetCurrentObject()
        {
            // Get the names of providers
            var config = ProviderConfiguration.GetProviderConfiguration(ProviderType);

            // Read specific configuration information for this provider
            var providerSettings = (ProviderSettings)config.Providers[config.DefaultProvider];

            // In the cache?
            var cacheKey = "Appleseed::Web::GeographicProvider::" + config.DefaultProvider;

            if (CurrentCache[cacheKey] == null)
            {
                // The assembly should be in \bin or GAC, so we simply need

                // to get an instance of the type
                try
                {
                    CurrentCache.Insert(
                        cacheKey, ProviderHelper.InstantiateProvider(providerSettings, typeof(GeographicProvider)));
                }
                catch (Exception e)
                {
                    throw new Exception("Unable to load provider", e);
                }
            }

            return((GeographicProvider)CurrentCache[cacheKey]);
        }
コード例 #6
0
        /// <summary>
        /// Read the Path dir and returns an ArrayList with all the Layouts found.
        ///   Static because the list is Always the same.
        /// </summary>
        /// <returns>
        /// A list of public layouts.
        /// </returns>
        public static List <LayoutItem> GetPublicLayouts()
        {
            // Jes1111 - 27-02-2005 - new version - correct caching
            List <LayoutItem> baseLayoutList;

            if (!CurrentCache.Exists(Key.LayoutList(Path)))
            {
                // Try to read directories from public Layout path
                var layouts = Directory.Exists(Path) ? Directory.GetDirectories(Path) : new string[0];

                // Ignore CVS and SVN
                baseLayoutList =
                    layouts.Select(layout => new LayoutItem {
                    Name = layout.Substring(Path.Length + 1)
                })
                    .Where(layout => layout.Name != "CVS" && layout.Name != "_svn" && layout.Name != ".svn")
                    .ToList();

                CurrentCache.Insert(Key.LayoutList(Path), baseLayoutList, new CacheDependency(Path));
            }
            else
            {
                baseLayoutList = (List <LayoutItem>)CurrentCache.Get(Key.LayoutList(Path));
            }

            return(baseLayoutList);
        }
コード例 #7
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void Page_Load(object sender, EventArgs e)
        {
            // Get portalID from querystring
            if (Request.Params["portalID"] != null)
            {
                currentPortalID = Int32.Parse(Request.Params["portalID"]);
            }

            if (currentPortalID != -1)
            {
                // Remove cache for reload settings
                if (!Page.IsPostBack)
                {
                    CurrentCache.Remove(Key.PortalSettings());
                }

                // Obtain PortalSettings of this Portal
                PortalSettings currentPortalSettings = new PortalSettings(currentPortalID);

                // If this is the first visit to the page, populate the site data
                if (!Page.IsPostBack)
                {
                    PortalIDField.Text = currentPortalID.ToString();
                    TitleField.Text    = currentPortalSettings.PortalName;
                    AliasField.Text    = currentPortalSettings.PortalAlias;
                    PathField.Text     = currentPortalSettings.PortalPath;
                }
                EditTable.DataSource =
                    new SortedList(
                        PortalSettings.GetPortalCustomSettings(currentPortalSettings.PortalID,
                                                               PortalSettings.GetPortalBaseSettings(null)));
                EditTable.DataBind();
                EditTable.ObjectID = currentPortalID;
            }
        }
コード例 #8
0
        /// <summary>
        /// The UpdateModuleSetting Method updates a single module setting
        /// in the ModuleSettings database table.
        /// </summary>
        /// <param name="moduleID">The module ID.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        public static void UpdateModuleSetting(int moduleID, string key, string value)
        {
            // Create Instance of Connection and Command Object
            using (SqlConnection myConnection = Config.SqlConnectionString)
            {
                using (SqlCommand myCommand = new SqlCommand("rb_UpdateModuleSetting", myConnection))
                {
                    // Mark the Command as a SPROC
                    myCommand.CommandType = CommandType.StoredProcedure;

                    // Add Parameters to SPROC
                    SqlParameter parameterModuleID = new SqlParameter(strATModuleID, SqlDbType.Int, 4);
                    parameterModuleID.Value = moduleID;
                    myCommand.Parameters.Add(parameterModuleID);

                    SqlParameter parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50);
                    parameterKey.Value = key;
                    myCommand.Parameters.Add(parameterKey);

                    SqlParameter parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500);
                    parameterValue.Value = value;
                    myCommand.Parameters.Add(parameterValue);

                    myConnection.Open();
                    myCommand.ExecuteNonQuery();
                }
            }
            //Invalidate cache
            CurrentCache.Remove(Key.ModuleSettings(moduleID));
        }
コード例 #9
0
        /// <summary>
        /// Currently cached directory.  If there is no cached list it will
        /// automatically call the function to build it.
        /// </summary>
        /// <returns>All Directory Items</returns>
        public static List <DirectoryItemForMobile> GetDirectoryForMobile(bool includeMobile)
        {
            List <DirectoryItem> CurrentCache;

            // First we pull the full list from cache (saves having to keep multiple caches for Mobile)
            CurrentCache = (List <DirectoryItem>)System.Web.HttpRuntime.Cache[CURRENT_DIRECTORY_CACHE_NAME];
            if (CurrentCache == null)
            {
                CurrentCache = LoadCurrentDirectory();
            }

            return(CurrentCache.OrderBy(x => x.Name).Select(x => new DirectoryItemForMobile
            {
                Name = x.Name,
                PC = x.PC,
                Phone = x.Phone,
                IsServiceCenter = x.IsServiceCenter,
                IsRegionSupport = x.IsRegionSupport,
                IsRegionManager = x.IsRegionManager,
                IsPCManager = x.IsPCManager,
                IsProfitCenter = x.IsProfitCenter,
                HasShowroom = x.HasShowroom,
                Email = x.EmailAddress,
                Mobile = includeMobile ? x.Mobile : "",
                Street = x.Street,
                CSZ = x.CSZ,
                RegionNumber = x.RegionNumber,
                RegionName = x.RegionName,
                ManagerDepartment = x.ManagerDepartment,
                EclipseBox = x.EclipseBox,
                OnSiteContact = x.OnSiteContact
            }).ToList());
        }
コード例 #10
0
        /// <summary>
        /// Read the Path dir and returns an ArrayList with all the Themes found.
        ///   Static because the list is Always the same.
        /// </summary>
        /// <returns>
        /// A list of theme items.
        /// </returns>
        public static List <ThemeItem> GetPublicThemes()
        {
            List <ThemeItem> baseThemeList;

            if (!CurrentCache.Exists(Key.ThemeList(Path)))
            {
                // Initialize array

                // Try to read directories from public theme path
                var themes = Directory.Exists(Path) ? Directory.GetDirectories(Path) : new string[0];

                // Ignore CVS and SVN.
                baseThemeList =
                    themes.Select(t1 => new ThemeItem {
                    Name = t1.Substring(Path.Length + 1)
                }).Where(
                        t => t.Name != "CVS" && t.Name != "_svn").ToList();
                CurrentCache.Insert(Key.ThemeList(Path), baseThemeList, new CacheDependency(Path));
            }
            else
            {
                baseThemeList = (List <ThemeItem>)CurrentCache.Get(Key.ThemeList(Path));
            }

            return(baseThemeList);
        }
コード例 #11
0
 /// <summary>
 /// Clears the cache list.
 /// </summary>
 public void ClearCacheList()
 {
     // Clear cache
     lock (this)
     {
         // Jes1111
         // LayoutManager.cachedLayoutsList = null;
         CurrentCache.Remove(Key.LayoutList(Path));
         CurrentCache.Remove(Key.LayoutList(this.PortalLayoutPath));
     }
 }
コード例 #12
0
        /// <summary>
        /// The GetModuleSettings Method returns a hashtable of
        /// custom module specific settings from the database.  This method is
        /// used by some user control modules to access misc settings.
        /// </summary>
        /// <param name="moduleID">The module ID.</param>
        /// <param name="_baseSettings">The _base settings.</param>
        /// <returns></returns>
        public static Hashtable GetModuleSettings(int moduleID, Hashtable _baseSettings)
        {
            if (!CurrentCache.Exists(Key.ModuleSettings(moduleID)))
            {
                // Get Settings for this module from the database
                Hashtable _settings = new Hashtable();

                // Create Instance of Connection and Command Object
                using (SqlConnection myConnection = Config.SqlConnectionString)
                {
                    using (SqlCommand myCommand = new SqlCommand("rb_GetModuleSettings", myConnection))
                    {
                        // Mark the Command as a SPROC
                        myCommand.CommandType = CommandType.StoredProcedure;

                        // Add Parameters to SPROC
                        SqlParameter parameterModuleID = new SqlParameter(strATModuleID, SqlDbType.Int, 4);
                        parameterModuleID.Value = moduleID;
                        myCommand.Parameters.Add(parameterModuleID);

                        // Execute the command
                        myConnection.Open();
                        using (SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection))
                        {
                            while (dr.Read())
                            {
                                _settings[dr["SettingName"].ToString()] = dr["SettingValue"].ToString();
                            }
                        }
                    }
                }

                foreach (string key in _baseSettings.Keys)
                {
                    if (_settings[key] != null)
                    {
                        SettingItem s = ((SettingItem)_baseSettings[key]);
                        if (_settings[key].ToString().Length != 0)
                        {
                            s.Value = _settings[key].ToString();
                        }
                    }
                }

                CurrentCache.Insert(Key.ModuleSettings(moduleID), _baseSettings);
            }
            else
            {
                _baseSettings = (Hashtable)CurrentCache.Get(Key.ModuleSettings(moduleID));
            }
            return(_baseSettings);
        }
コード例 #13
0
        /// <summary>
        /// The OnUpdate on this page is used to save
        ///   the current tab settings to the database and
        ///   then redirect back to the main admin page.
        /// </summary>
        /// <param name="e">
        /// The <see cref="T:System.EventArgs"/> instance containing the event data.
        /// </param>
        /// <remarks>
        /// </remarks>
        protected override void OnUpdate(EventArgs e)
        {
            // Only Update if Input Data is Valid
            if (this.Page.IsValid)
            {
                try
                {
                    this.SavePageData();

                    // Flush all tab navigation cache keys. Very important for recovery the changes
                    // made in all languages and not get a error if user change the tab parent.
                    // [email protected] (05/10/2004)
                    CurrentCache.RemoveAll("_PageNavigationSettings_");
                    PortalSettings.RemovePortalSettingsCache(PageID, PortalSettings.PortalAlias);

                    // Clear AppleseedSiteMapCache
                    AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();

                    // redirect back to the admin page
                    // int adminIndex = portalSettings.DesktopPages.Count-1;
                    // 3_aug_2004 Cory Isakson use returntabid from QueryString
                    // Updated 6_Aug_2004 by Cory Isakson to accomodate addtional Page Management
                    var    retPage = this.Request.QueryString["returnPageID"];
                    string returnPage;

                    if (Request.QueryString.GetValues("ModalChangeMaster") != null)
                    {
                        Response.Write("<script type=\"text/javascript\">window.parent.location = window.parent.location.href;</script>");
                    }
                    else
                    {
                        if (retPage != null)
                        {
                            // user is returned to the calling tab.
                            returnPage = HttpUrlBuilder.BuildUrl(int.Parse(retPage));
                        }
                        else
                        {
                            // user is returned to updated tab
                            returnPage = HttpUrlBuilder.BuildUrl(this.PageID);
                        }

                        this.Response.Redirect(returnPage);
                    }
                }
                catch
                {
                    this.lblErrorNotAllowed.Visible = true;
                }
            }
        }
コード例 #14
0
 /// <summary>
 /// Productses the specified tab.
 /// </summary>
 /// <param name="tab">The tab.</param>
 /// <returns></returns>
 private bool products(int tab)
 {
     if (!AutoShopDetect)
     {
         return(false);
     }
     if (!CurrentCache.Exists(Key.TabNavigationSettings(tab, "Shop")))
     {
         PortalSettings portalSettings = (PortalSettings)HttpContext.Current.Items["PortalSettings"];
         bool           exists         = new ModulesDB().ExistModuleProductsInPage(tab, portalSettings.PortalID);
         CurrentCache.Insert(Key.TabNavigationSettings(tab, "Shop"), exists);
     }
     return((bool)CurrentCache.Get(Key.TabNavigationSettings(tab, "Shop")));
 }
コード例 #15
0
        public JsonResult moveNode(int pageID, int newParent, int idOldNode, int selectedposition)
        {
            //Cache clearing
            Appleseed.Framework.Web.SqlUrlBuilderProvider.ClearCachePageUrl(pageID);
            Appleseed.Framework.Web.UrlBuilderHelper.ClearUrlElements(pageID);
            CurrentCache.RemoveAll("_PageNavigationSettings_");
            PortalSettings.RemovePortalSettingsCache(pageID, PortalSettings.PortalAlias);
            Appleseed.Framework.Providers.AppleseedSiteMapProvider.AppleseedSiteMapProvider.ClearAllAppleseedSiteMapCaches();
            PortalSettings.UpdatePortalSettingParentPageCache(newParent, pageID);

            if (UserProfile.isCurrentUserAdmin || UserProfile.CurrentUser.HasPermission(AccessPermissions.PAGE_EDITING))
            {
                PagesDB db = new PagesDB();
                this.PortalPages = db.GetPagesFlat(this.PortalSettings.PortalID);
                db.UpdatePageParent(Convert.ToInt32(pageID), Convert.ToInt32(newParent), this.PortalSettings.PortalID);
                int order;
                if (Convert.ToInt32(idOldNode) == -1)
                {
                    order = 9999;
                }
                else
                {
                    List <PageStripDetails> childPages = new PagesDB().GetPagesinPage(this.PortalSettings.PortalID, newParent).Where(pg => pg.PageID != pageID).ToList();
                    if (childPages.Count == 0)
                    {
                        order = 0;
                    }
                    else
                    {
                        if (selectedposition < childPages.Count)
                        {
                            order = childPages[selectedposition].PageOrder - 1;
                        }
                        else
                        {
                            order = childPages[childPages.Count - 1].PageOrder + 1;
                        }
                    }
                }
                db.UpdatePageOrder(Convert.ToInt32(pageID), order);
                this.OrderPages();
                return(Json(""));
            }
            else
            {
                this.OrderPages();
                string errorMessage = General.GetString("ACCESS_DENIED", "You don't have permissin to move page", this);
                return(Json(new { error = true, errorMess = errorMessage }));
            }
        }
コード例 #16
0
        /// <summary>
        /// Update Page Custom Settings
        /// </summary>
        /// <param name="pageId">
        /// The page ID.
        /// </param>
        /// <param name="key">
        /// The setting key.
        /// </param>
        /// <param name="value">
        /// The value.
        /// </param>
        public static void UpdatePageSettings(int pageId, string key, string value)
        {
            // Create Instance of Connection and Command Object
            using (var connection = Config.SqlConnectionString)
                using (var command = new SqlCommand("rb_UpdateTabCustomSettings", connection))
                {
                    // Mark the Command as a SPROC
                    command.CommandType = CommandType.StoredProcedure;

                    // Add Parameters to SPROC
                    var parameterPageId = new SqlParameter("@TabID", SqlDbType.Int, 4)
                    {
                        Value = pageId
                    };
                    command.Parameters.Add(parameterPageId);
                    var parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50)
                    {
                        Value = key
                    };
                    command.Parameters.Add(parameterKey);
                    if ((key == "CustomLayout" || key == "CustomTheme" || key == "CustomThemeAlt") && (value == General.GetString("PAGESETTINGS_SITEDEFAULT")))
                    {
                        value = string.Empty;
                    }
                    var parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500)
                    {
                        Value = value
                    };
                    command.Parameters.Add(parameterValue);
                    connection.Open();

                    try
                    {
                        command.ExecuteNonQuery();
                    }
                    finally
                    {
                        connection.Close();
                    }
                }

            // Invalidate cache
            if (CurrentCache.Exists(Key.TabSettings(pageId)))
            {
                CurrentCache.Remove(Key.TabSettings(pageId));
            }

            // Clear URL builder elements
            HttpUrlBuilder.Clear(pageId);
        }
コード例 #17
0
 private void PagePropertyPage_Load(object sender, EventArgs e)
 {
     //We reset cache before dispay page to ensure dropdown shows actual data
     //by Pekka Ylenius
     CurrentCache.Remove(Key.ModuleSettings(ModuleID));
     // Using settings grouping tabs or not is set in config file. --Hongwei Shen
     EditTable.UseGroupingTabs = Rainbow.Framework.Settings.Config.UseSettingsGroupingTabs;
     // The width and height will take effect only when using grouping tabs.
     // When not using grouping tabs, width and height should be set in css
     // class -- Hongwei Shen
     EditTable.Width      = Rainbow.Framework.Settings.Config.SettingsGroupingWidth;
     EditTable.Height     = Rainbow.Framework.Settings.Config.SettingsGroupingHeight;
     EditTable.CssClass   = "st_control";
     EditTable.DataSource = new SortedList(moduleSettings);
     EditTable.DataBind();
 }
コード例 #18
0
        /// <summary>
        /// The SaveButton_Click is used to commit the tab/page
        /// information from the form to the database.
        /// Created by Mike Stone 29/12/2004
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        private void SaveButton_Click(object sender, EventArgs e)
        {
            //Only Save if Input Data is Valid
            int    NewPageID = 0;
            string returnPage;

            if (Page.IsValid == true)
            {
                try
                {
                    NewPageID = SavePageData();

                    // Flush all tab navigation cache keys. Very important for recovery the changes
                    // made in all languages and not get a error if user change the tab parent.
                    // [email protected] (05/10/2004)
                    // Copied to here 29/12/2004 by Mike Stone
                    CurrentCache.RemoveAll("_PageNavigationSettings_");

                    //Jump to Page option
                    if (cb_JumpToPage.Checked == true)
                    {
                        // Redirect to New Form - Mike Stone 19/12/2004
                        returnPage =
                            HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, NewPageID,
                                                    "SelectedPageID=" + NewPageID.ToString());
                    }
                    else
                    {
                        // Do NOT Redirect to New Form - Mike Stone 19/12/2004
                        // I guess every .aspx page needs to have a module tied to it.
                        // or you will get an error about edit access denied.
                        // Fix: RBP-594 by mike stone added returntabid to url.
                        returnPage =
                            HttpUrlBuilder.BuildUrl("~/DesktopModules/CoreModules/Pages/AddPage.aspx",
                                                    "mID=" + Request.QueryString["mID"] + "&returntabid=" +
                                                    Request.QueryString["returntabid"]);
                    }
                    Response.Redirect(returnPage);
                }
                catch
                {
                    lblErrorNotAllowed.Visible = true;
                }
            }
        }
コード例 #19
0
        /// <summary>
        /// Gets the display name of the country.
        /// </summary>
        /// <param name="countryId">The country id.</param>
        /// <param name="c">The c.</param>
        /// <returns></returns>
        public override string GetCountryDisplayName(string countryId, CultureInfo c)
        {
            var cacheKey = string.Format("COUNTRY_{0} - {1}", countryId, c.TwoLetterISOLanguageName);

            if (CurrentCache.Get(cacheKey) == null)
            {
                var result = this.GetLocalizedDisplayName("COUNTRY_" + countryId, c);

                if (string.IsNullOrEmpty(result))
                {
                    result = this.GetCountry(countryId).NeutralName;
                }

                CurrentCache.Insert(cacheKey, result);
            }

            return((string)CurrentCache.Get(cacheKey));
        }
コード例 #20
0
        /// <summary>
        /// Gets the states's name in the specified language if available. It not, gets the default one.
        /// </summary>
        /// <param name="stateId"></param>
        /// <param name="c">a <code>System.Globalization.CultureInfo</code> describing the language we want the name for</param>
        /// <returns>
        /// A <code>string</code> containing the localized name.
        /// </returns>
        /// <exception cref="StateNotFoundException">If the state is not found</exception>
        public override string GetStateDisplayName(int stateId, CultureInfo c)
        {
            var cacheKey = string.Format("STATENAME_{0} - {1}", stateId, c.TwoLetterISOLanguageName);

            if (CurrentCache.Get(cacheKey) == null)
            {
                var result = this.GetLocalizedDisplayName("STATENAME_" + stateId, c);

                if (string.IsNullOrEmpty(result))
                {
                    result = this.GetState(stateId).NeutralName;
                }

                CurrentCache.Insert(cacheKey, result);
            }

            return((string)CurrentCache.Get(cacheKey));
        }
コード例 #21
0
        /// <summary>
        /// Gets the administrative division's name in the specified language if available. It not, gets the default one.
        /// </summary>
        /// <param name="administrativeDivisionName"></param>
        /// <param name="c">a <code>System.Globalization.CultureInfo</code> describing the language we want the name for</param>
        /// <returns>
        /// A <code>string</code> containing the localized name.
        /// </returns>
        public override string GetAdministrativeDivisionName(string administrativeDivisionName, CultureInfo c)
        {
            var cacheKey = string.Format("ADMINISTRATIVEDIVISIONNAME_{0} - {1}", administrativeDivisionName, c.TwoLetterISOLanguageName);

            if (CurrentCache.Get(cacheKey) == null)
            {
                var result = this.GetLocalizedDisplayName("ADMINISTRATIVEDIVISIONNAME_" + administrativeDivisionName, c);

                if (string.IsNullOrEmpty(result))
                {
                    result = administrativeDivisionName;
                }

                CurrentCache.Insert(cacheKey, result);
            }

            return((string)CurrentCache.Get(cacheKey));
        }
        /// <summary>
        /// <see cref="Rainbow.Framework.Providers.Geographic.GeographicProvider.GetStateDisplayName( int, System.Globalization.CultureInfo )"/>
        /// </summary>
        public override string GetStateDisplayName(int stateID, System.Globalization.CultureInfo c)
        {
            string cacheKey = "STATENAME_" + stateID + " - " + c.TwoLetterISOLanguageName;

            if (CurrentCache.Get(cacheKey) == null)
            {
                string result = GetLocalizedDisplayName("STATENAME_" + stateID, c);

                if (string.IsNullOrEmpty(result))
                {
                    result = this.GetState(stateID).NeutralName;
                }

                CurrentCache.Insert(cacheKey, result);
            }

            return(( string )CurrentCache.Get(cacheKey));
        }
        /// <summary>
        /// <see cref="Rainbow.Framework.Providers.Geographic.GeographicProvider.GetAdministrativeDivisionName( string, System.Globalization.CultureInfo )"/>
        /// </summary>
        public override string GetAdministrativeDivisionName(string administrativeDivisionName, System.Globalization.CultureInfo c)
        {
            string cacheKey = "ADMINISTRATIVEDIVISIONNAME_" + administrativeDivisionName + " - " + c.TwoLetterISOLanguageName;

            if (CurrentCache.Get(cacheKey) == null)
            {
                string result = GetLocalizedDisplayName("ADMINISTRATIVEDIVISIONNAME_" + administrativeDivisionName, c);

                if (string.IsNullOrEmpty(result))
                {
                    result = administrativeDivisionName;
                }

                CurrentCache.Insert(cacheKey, result);
            }

            return(( string )CurrentCache.Get(cacheKey));
        }
コード例 #24
0
        /// <summary>
        /// OnUpdate
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        protected override void OnUpdate(EventArgs e)
        {
            base.OnUpdate(e);

            if (Page.IsValid)
            {
                //Update main settings and Tab info in the database
                new PortalsDB().UpdatePortalInfo(currentPortalID, TitleField.Text, PathField.Text, false);

                // Update custom settings in the database
                EditTable.ObjectID = currentPortalID;
                EditTable.UpdateControls();

                // Remove cache for reload settings before redirect
                CurrentCache.Remove(Key.PortalSettings());
                // Redirect back to calling page
                RedirectBackToReferringPage();
            }
        }
コード例 #25
0
        /// <summary>
        /// Gets the image menu.
        /// </summary>
        /// <returns>
        /// A System.Collections.Hashtable value...
        /// </returns>
        private Hashtable GetImageMenu()
        {
            Hashtable imageMenuFiles;

            if (!CurrentCache.Exists(Key.ImageMenuList(this.PortalSettings.CurrentLayout)))
            {
                imageMenuFiles = new Hashtable {
                    { General.GetString("PAGESETTINGS_SITEDEFAULT", "(Site Default)"), string.Empty }
                };
                var layoutManager = new LayoutManager(this.PortalPath);

                var menuDirectory = Path.WebPathCombine(
                    layoutManager.PortalLayoutPath, this.PortalSettings.CurrentLayout);
                if (Directory.Exists(menuDirectory))
                {
                    menuDirectory = Path.WebPathCombine(menuDirectory, "menuimages");
                }
                else
                {
                    menuDirectory = Path.WebPathCombine(
                        LayoutManager.Path, this.PortalSettings.CurrentLayout, "menuimages");
                }

                if (Directory.Exists(menuDirectory))
                {
                    var menuImages = (new DirectoryInfo(menuDirectory)).GetFiles("*.gif");

                    foreach (var fi in menuImages.Where(fi => fi.Name != "spacer.gif" && fi.Name != "icon_arrow.gif"))
                    {
                        imageMenuFiles.Add(fi.Name, fi.Name);
                    }
                }

                CurrentCache.Insert(Key.ImageMenuList(this.PortalSettings.CurrentLayout), imageMenuFiles, null);
            }
            else
            {
                imageMenuFiles = (Hashtable)CurrentCache.Get(Key.ImageMenuList(this.PortalSettings.CurrentLayout));
            }

            return(imageMenuFiles);
        }
コード例 #26
0
        /// <summary>
        /// Update Page Custom Settings
        /// </summary>
        /// <param name="pageID">The page ID.</param>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        public static void UpdatePageSettings(int pageID, string key, string value)
        {
            // Create Instance of Connection and Command Object
            using (SqlConnection myConnection = Config.SqlConnectionString)
            {
                using (SqlCommand myCommand = new SqlCommand("rb_UpdateTabCustomSettings", myConnection))
                {
                    // Mark the Command as a SPROC
                    myCommand.CommandType = CommandType.StoredProcedure;
                    // Add Parameters to SPROC
                    SqlParameter parameterPageID = new SqlParameter("@TabID", SqlDbType.Int, 4);
                    parameterPageID.Value = pageID;
                    myCommand.Parameters.Add(parameterPageID);
                    SqlParameter parameterKey = new SqlParameter("@SettingName", SqlDbType.NVarChar, 50);
                    parameterKey.Value = key;
                    myCommand.Parameters.Add(parameterKey);
                    SqlParameter parameterValue = new SqlParameter("@SettingValue", SqlDbType.NVarChar, 1500);
                    parameterValue.Value = value;
                    myCommand.Parameters.Add(parameterValue);
                    myConnection.Open();

                    try
                    {
                        myCommand.ExecuteNonQuery();
                    }

                    finally
                    {
                        myConnection.Close();
                    }
                }
            }

            //Invalidate cache
            if (CurrentCache.Exists(Key.TabSettings(pageID)))
            {
                CurrentCache.Remove(Key.TabSettings(pageID));
            }

            // Clear url builder elements
            HttpUrlBuilder.Clear(pageID);
        }
コード例 #27
0
        /// <summary>
        /// Read the Path dir and returns
        /// an ArrayList with all the Themes found, public and privates
        /// </summary>
        /// <returns></returns>
        public ArrayList GetPrivateThemes()
        {
            ArrayList privateThemeList;

            if (!CurrentCache.Exists(Key.ThemeList(PortalThemePath)))
            {
                privateThemeList = new ArrayList();
                string[] themes;

                // Try to read directories from private theme path
                if (Directory.Exists(PortalThemePath))
                {
                    themes = Directory.GetDirectories(PortalThemePath);
                }

                else
                {
                    themes = new string[0];
                }

                for (int i = 0; i <= themes.GetUpperBound(0); i++)
                {
                    ThemeItem t = new ThemeItem();
                    t.Name = themes[i].Substring(PortalThemePath.Length + 1);

                    if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS
                    {
                        privateThemeList.Add(t);
                    }
                }

                CurrentCache.Insert(Key.ThemeList(PortalThemePath), privateThemeList,
                                    new CacheDependency(PortalThemePath));
                //Debug.WriteLine("Storing privateThemeList in Cache: item count is " + privateThemeList.Count.ToString());
            }
            else
            {
                privateThemeList = (ArrayList)CurrentCache.Get(Key.ThemeList(PortalThemePath));
                //Debug.WriteLine("Retrieving privateThemeList from Cache: item count is " + privateThemeList.Count.ToString());
            }
            return(privateThemeList);
        }
コード例 #28
0
        /// <summary>
        /// Gets the image menu.
        /// </summary>
        /// <returns>A System.Collections.Hashtable value...</returns>
        private Hashtable GetImageMenu()
        {
            Hashtable imageMenuFiles;

            if (!CurrentCache.Exists(Key.ImageMenuList(portalSettings.CurrentLayout)))
            {
                imageMenuFiles = new Hashtable();
                imageMenuFiles.Add("-Default-", string.Empty);
                string        menuDirectory = string.Empty;
                LayoutManager layoutManager = new LayoutManager(PortalPath);

                menuDirectory = Path.WebPathCombine(layoutManager.PortalLayoutPath, portalSettings.CurrentLayout);
                if (Directory.Exists(menuDirectory))
                {
                    menuDirectory = Path.WebPathCombine(menuDirectory, "menuimages");
                }
                else
                {
                    menuDirectory = Path.WebPathCombine(LayoutManager.Path, portalSettings.CurrentLayout, "menuimages");
                }

                if (Directory.Exists(menuDirectory))
                {
                    FileInfo[] menuImages = (new DirectoryInfo(menuDirectory)).GetFiles("*.gif");

                    foreach (FileInfo fi in menuImages)
                    {
                        if (fi.Name != "spacer.gif" && fi.Name != "icon_arrow.gif")
                        {
                            imageMenuFiles.Add(fi.Name, fi.Name);
                        }
                    }
                }
                CurrentCache.Insert(Key.ImageMenuList(portalSettings.CurrentLayout), imageMenuFiles, null);
            }
            else
            {
                imageMenuFiles = (Hashtable)CurrentCache.Get(Key.ImageMenuList(portalSettings.CurrentLayout));
            }
            return(imageMenuFiles);
        }
コード例 #29
0
        /// <summary>
        /// Read the Path dir and returns
        ///   an ArrayList with all the Themes found, public and privates
        /// </summary>
        /// <returns>
        /// A list of theme items.
        /// </returns>
        public List <ThemeItem> GetPrivateThemes()
        {
            List <ThemeItem> privateThemeList;

            if (!CurrentCache.Exists(Key.ThemeList(this.PortalThemePath)))
            {
                privateThemeList = new List <ThemeItem>();

                // Try to read directories from private theme path
                var themes = Directory.Exists(this.PortalThemePath)
                                 ? Directory.GetDirectories(this.PortalThemePath)
                                 : new string[0];

                for (var i = 0; i <= themes.GetUpperBound(0); i++)
                {
                    var t = new ThemeItem {
                        Name = themes[i].Substring(this.PortalThemePath.Length + 1)
                    };

                    // Ignore CVS and SVN
                    if (t.Name != "CVS" && t.Name != "_svn")
                    {
                        privateThemeList.Add(t);
                    }
                }

                CurrentCache.Insert(
                    Key.ThemeList(this.PortalThemePath), privateThemeList, new CacheDependency(this.PortalThemePath));

                // Debug.WriteLine("Storing privateThemeList in Cache: item count is " + privateThemeList.Count.ToString());
            }
            else
            {
                privateThemeList = (List <ThemeItem>)CurrentCache.Get(Key.ThemeList(this.PortalThemePath));

                // Debug.WriteLine("Retrieving privateThemeList from Cache: item count is " + privateThemeList.Count.ToString());
            }

            return(privateThemeList);
        }
コード例 #30
0
        /// <summary>
        /// Read the Path dir and returns an ArrayList with all the Themes found.
        /// Static because the list is Always the same.
        /// </summary>
        /// <returns></returns>
        public static ArrayList GetPublicThemes()
        {
            ArrayList baseThemeList;

            if (!CurrentCache.Exists(Key.ThemeList(Path)))
            {
                //Initialize array
                baseThemeList = new ArrayList();
                string[] themes;

                // Try to read directories from public theme path
                if (Directory.Exists(Path))
                {
                    themes = Directory.GetDirectories(Path);
                }

                else
                {
                    themes = new string[0];
                }

                for (int i = 0; i < themes.Length; i++)
                {
                    ThemeItem t = new ThemeItem();
                    t.Name = themes[i].Substring(Path.Length + 1);

                    if (t.Name != "CVS" && t.Name != "_svn") //Ignore CVS and _svn folders
                    {
                        baseThemeList.Add(t);
                    }
                }
                CurrentCache.Insert(Key.ThemeList(Path), baseThemeList, new CacheDependency(Path));
            }

            else
            {
                baseThemeList = (ArrayList)CurrentCache.Get(Key.ThemeList(Path));
            }
            return(baseThemeList);
        }