Ejemplo n.º 1
0
        public static bool Delete(int topicId)
        {
            bool status = false;

            GroupTopic groupTopic = new GroupTopic(topicId);

            DataTable dataTable = new DataTable();

            dataTable.Columns.Add("PostID", typeof(int));

            using (IDataReader reader = DBGroups.GroupTopicGetPosts(topicId))
            {
                while (reader.Read())
                {
                    DataRow row = dataTable.NewRow();
                    row["PostID"] = reader["PostID"];
                    dataTable.Rows.Add(row);
                }
            }

            foreach (DataRow row in dataTable.Rows)
            {
                groupTopic.DeletePost(Convert.ToInt32(row["PostID"]));
            }

            status = DBGroups.GroupTopicDelete(topicId);

            return(status);
        }
Ejemplo n.º 2
0
        public bool DeletePost(int postId)
        {
            bool deleted = DBGroups.GroupPostDelete(postId);

            if (deleted)
            {
                Group.DecrementPostCount(this.groupID);
                if (this.totalReplies > 0)
                {
                    DBGroups.GroupTopicDecrementReplyStats(this.topicID);
                }
                Group group = new Group(this.groupID);

                this.moduleID = group.ModuleId;
                this.postID   = postId;

                ContentChangedEventArgs e = new ContentChangedEventArgs();
                e.IsDeleted = true;
                OnContentChanged(e);

                int topicPostCount = GroupTopic.GetPostCount(this.topicID);
                if (topicPostCount == 0)
                {
                    GroupTopic.Delete(this.topicID);
                    Group.DecrementTopicCount(this.groupID);
                }

                ResetTopicSequences();
            }


            return(deleted);
        }