Пример #1
0
        /// <summary>
        /// Add Update friendly url
        /// </summary>
        /// <param name="pageId">page id</param>
        /// <param name="friendlyurl">friendly url</param>
        private void AddUpdateFriendlyUrl(int pageId, string friendlyurl, int dynamicPageId, bool addExtension = true)
        {
            PagesDB pages  = new PagesDB();
            string  result = string.Empty;

            if (drpPageList.SelectedValue == "-1")
            {
                if (addExtension)
                {
                    result = pages.CreateFriendlyURL(txtDyanmicPage.Text, (txtFriendlyURL.Text.StartsWith("/") ? txtFriendlyURL.Text : "/" + txtFriendlyURL.Text) + lblFriendlyExtension.Text, dynamicPageId);
                }
                else
                {
                    result = pages.CreateFriendlyURL(txtDyanmicPage.Text, (txtFriendlyURL.Text.StartsWith("/") ? txtFriendlyURL.Text : "/" + txtFriendlyURL.Text), dynamicPageId);
                }
            }
            else
            {
                //when friendlyURL saved, Set result as (0/1)
                result = pages.UpdateFriendlyURL(pageId, friendlyurl);
            }

            //If result get 0 then error message will display
            divErrorMessage.Visible = (result == "0");

            //If result get 1 then success message will display
            divSuccessMessage.Visible = (result != "0");

            //remove from cache
            SqlUrlBuilderProvider.ClearCachePageUrl(pageId);
            UrlBuilderHelper.ClearUrlElements(pageId);
        }
Пример #2
0
        /// <summary>
        /// Add Update friendly url
        /// </summary>
        /// <param name="daynamicPageId">page id</param>
        /// <param name="friendlyurl">friendly url</param>
        private void AddUpdateDaynamicPagesFriendlyUrl(int daynamicPageId, string redirectToUrl, string friendlyurl)
        {
            PagesDB pages = new PagesDB();

            divValidationErrorMessage.Visible = false;
            divErrorMessage.Visible           = false;
            divSuccessMessage.Visible         = false;

            if ((!redirectToUrl.StartsWith("/") &&
                 !redirectToUrl.StartsWith("http://") &&
                 !redirectToUrl.StartsWith("https://")) ||
                (!friendlyurl.StartsWith("/") &&
                 !friendlyurl.StartsWith("http://") &&
                 !friendlyurl.StartsWith("https://"))
                )
            {
                divValidationErrorMessage.Visible = true;
            }
            else
            {
                //when friendlyURL saved, Set result as (0/1)
                //change this method for rb_Pages_DynamicRedirects Table.
                string result = pages.UpdateFriendlyURL(redirectToUrl, friendlyurl, daynamicPageId);

                //If result get 0 then error message will display
                divErrorMessage.Visible = (result == "0");

                //If result get 1 then success message will display
                divSuccessMessage.Visible = (result != "0");

                //remove from cache
                SqlUrlBuilderProvider.ClearCachePageUrl(daynamicPageId);
                UrlBuilderHelper.ClearUrlElements(daynamicPageId);
            }
        }
Пример #3
0
        /// <summary>
        /// Row Deleteting It will clear friendly url
        /// </summary>
        /// <param name="sender"> The source of event.</param>
        /// <param name="e"> The <see cref="System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param>
        protected void gdDynamicPages_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow row = (GridViewRow)gdDynamicPages.Rows[e.RowIndex];

            System.Web.UI.WebControls.Label lblPageID = (System.Web.UI.WebControls.Label)row.FindControl("lblPageID");
            int pageID = Convert.ToInt32(lblPageID.Text);

            new PagesDB().DeleteDynamicFriendlyUrl(pageID);

            //remove from cache
            SqlUrlBuilderProvider.ClearCachePageUrl(pageID);
            UrlBuilderHelper.ClearUrlElements(pageID);

            this.LoadGrid();
        }
Пример #4
0
        /// <summary>
        /// Slider Image Listing - Row Deleting
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.GridViewDeleteEventArgs"/> instance containing the event data.</param>
        protected void GdSliderImageManager_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow currentRow = (GridViewRow)this.GdSliderImageManager.Rows[e.RowIndex];

            System.Web.UI.WebControls.Label lblImageID = (System.Web.UI.WebControls.Label)currentRow.FindControl("lblImageID");
            var sliderImageDetail = this.slider.SliderIamgeDetail(Convert.ToInt32(lblImageID.Text));

            var path = Server.MapPath("/Images/Sliders/" + sliderImageDetail.SliderID + "/" + sliderImageDetail.SliderImageID + sliderImageDetail.SliderImageExt);

            File.Delete(path);

            this.slider.DeleteSliderImage(Convert.ToInt32(lblImageID.Text));
            SqlUrlBuilderProvider.ClearCachePageUrl(this.PageID);
            UrlBuilderHelper.ClearUrlElements(this.PageID);

            this.LoadGrid();
        }
Пример #5
0
        /// <summary>
        /// Add Update friendly url
        /// </summary>
        /// <param name="daynamicPageId">page id</param>
        /// <param name="friendlyurl">friendly url</param>
        private void AddUpdateDaynamicPagesFriendlyUrl(int daynamicPageId, string redirectToUrl, string friendlyurl)
        {
            PagesDB pages = new PagesDB();

            //when friendlyURL saved, Set result as (0/1)
            //change this method for rb_Pages_DynamicRedirects Table.
            string result = pages.UpdateFriendlyURL(redirectToUrl, friendlyurl, daynamicPageId);

            //If result get 0 then error message will display
            divErrorMessage.Visible = (result == "0");

            //If result get 1 then success message will display
            divSuccessMessage.Visible = (result != "0");

            //remove from cache
            SqlUrlBuilderProvider.ClearCachePageUrl(daynamicPageId);
            UrlBuilderHelper.ClearUrlElements(daynamicPageId);
        }
Пример #6
0
        /// <summary>
        /// Slider Listing - Row Update
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:System.GridViewDeleteEventArgs"/> instance containing the event data.</param>
        protected void GdSliderManager_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow currentRow = (GridViewRow)this.GdSliderManager.Rows[e.RowIndex];

            System.Web.UI.WebControls.Label lblSliderID = (System.Web.UI.WebControls.Label)currentRow.FindControl("lblSliderID");
            this.slider.DeleteSlider(Convert.ToInt32(lblSliderID.Text));

            var path = Server.MapPath("/Images/Sliders/" + lblSliderID.Text);

            if (Directory.Exists(path))
            {
                Directory.Delete(path, true);
            }

            SqlUrlBuilderProvider.ClearCachePageUrl(this.PageID);
            UrlBuilderHelper.ClearUrlElements(this.PageID);

            this.LoadGrid();
        }
Пример #7
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();
                    //remove from cache
                    SqlUrlBuilderProvider.ClearCachePageUrl(this.PageID);
                    UrlBuilderHelper.ClearUrlElements(this.PageID);

                    // 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();

                    PortalSettings.UpdatePortalSettingParentPageCache(Int32.Parse(this.parentPage.SelectedItem.Value), this.PageID);

                    // 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)
                    {
                        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);
                        }

                        Response.Write("<script type=\"text/javascript\">window.parent.location = '" + returnPage + "';</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 (Exception ex)
                {
                    if (ex.Message == "FriendlyUrlIsAlreadyExists")
                    {
                        this.lblUrlAlreadyExist.Visible = true;
                    }
                    else
                    {
                        this.lblErrorNotAllowed.Visible = true;
                    }
                }
            }
        }