/// <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); }
protected void btnDelete_Click(object sender, EventArgs e) { SubSonic.Query q = new SubSonic.Query("CSK_Coupons"); q.QueryType = SubSonic.QueryType.Delete; q.AddWhere("couponCode", txtCouponCode.Text); q.Execute(); Response.Redirect(Request.Url.PathAndQuery, true); }
/// <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); }