Ejemplo n.º 1
0
        /// <summary>
        /// Deletes the page and all of it's related regions.
        /// </summary>
        /// <returns></returns>
        public virtual bool DeleteAll()
        {
            // Since we can have multiple rows for all id's, get everything.
            List <Region>   regions    = Region.GetAllByPageId(Page.Id);
            List <Property> properties = Property.GetAllByParentId(Page.Id);
            List <Page>     pages      = Page.Get("page_id=@0", Page.Id);

            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                // Call OnDelete for all extensions
                Extensions.ForEach(e => e.Body.OnManagerDelete(Page));

                // Call OnDelete for all regions
                Regions.ForEach(r => r.Body.OnManagerDelete(Page));

                // Delete all entities
                regions.ForEach(r => r.Delete(tx));
                properties.ForEach(p => p.Delete(tx));
                pages.ForEach(p => p.Delete(tx));
                Permalink.Delete(tx);

                // Change global last modified
                Web.ClientCache.SetSiteLastModified(tx);

                tx.Commit();
            }
            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Deletes the page and all of it's related regions.
        /// </summary>
        /// <returns></returns>
        public virtual bool DeleteAll()
        {
            // Since we can have multiple rows for all id's, get everything.
            List <Region>   regions    = Region.GetAllByPageId(Page.Id);
            List <Property> properties = Property.GetAllByParentId(Page.Id);
            List <Page>     pages      = Page.Get("page_id=@0", Page.Id);

            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                regions.ForEach(r => r.Delete(tx));
                properties.ForEach(p => p.Delete(tx));
                pages.ForEach(p => p.Delete(tx));
                Permalink.Delete(tx);

                // Change global last modified
                Web.ClientCache.SetSiteLastModified(tx);

                tx.Commit();

                try {
                    // Delete page preview
                    // WebPages.WebThumb.RemovePagePreview(Page.Id) ;
                } catch {}
            }
            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Deletes the post.
        /// </summary>
        /// <returns></returns>
        public virtual bool DeleteAll()
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                List <Relation> rel   = Relation.Get("relation_data_id = @0", Post.Id);
                List <Post>     posts = Post.Get("post_id = @0", Post.Id);

                rel.ForEach(r => r.Delete(tx));
                posts.ForEach(p => p.Delete(tx));
                Permalink.Delete(tx);

                tx.Commit();
            }
            return(true);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Deletes the model and all related data.
        /// </summary>
        public bool DeleteAll()
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                try {
                    // Delete all relations to the current category
                    List <Relation> pc = Relation.GetByTypeAndRelatedId(Relation.RelationType.POSTCATEGORY, Category.Id);
                    pc.ForEach((r) => r.Delete(tx));

                    // Delete category
                    Category.Delete(tx);

                    // Delete permalink
                    Permalink.Delete(tx);
                    tx.Commit();
                } catch { tx.Rollback(); return(false); }
            }
            return(true);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Deletes the post.
        /// </summary>
        /// <returns></returns>
        public virtual bool DeleteAll()
        {
            using (IDbTransaction tx = Database.OpenConnection().BeginTransaction()) {
                List <Relation> rel   = Relation.Get("relation_data_id = @0", Post.Id);
                List <Post>     posts = Post.Get("post_id = @0", Post.Id);

                // Call OnDelete for all extensions
                Extensions.ForEach(e => e.Body.OnManagerDelete(Post));

                // Delete all entities
                rel.ForEach(r => r.Delete(tx));
                posts.ForEach(p => p.Delete(tx));
                Permalink.Delete(tx);

                tx.Commit();
            }
            return(true);
        }