/// <summary> /// Saves the page to the DB /// </summary> /// <param name="p"></param> public static void SavePage(CMS.Page p) { if (p.PageID == 0) { //this is an insert p.PageGuid = System.Guid.NewGuid(); //configure the URL from the title p.PageUrl = TransformTitleToUrl(p.Title); } //gotta make sure the URL's not already in there //the SiteMapProvider doesn't like it CMS.Page pCheck = new Page("PageURL", p.PageUrl); int existingUrls = new SubSonic.Query(Page.Schema).WHERE(Page.Columns.PageUrl, p.PageUrl).GetRecordCount(); if (existingUrls > 0) { existingUrls++; p.PageUrl = p.PageUrl.Replace(".aspx", "_" + existingUrls.ToString() + ".aspx"); } //save it p.Save(System.Web.HttpContext.Current.User.Identity.Name); }
static CMS.Page LoadChildItem(CMS.Page parentItem) { CMS.Page result = null; foreach (CMS.Page item in unSortedPages) { result = null; if (item.ParentID == parentItem.PageID) { result = item; item.Level = parentItem.Level + 1; sortedPages.Add(result); LoadChildItem(result); } } return(result); }