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