コード例 #1
0
        protected void Button_RemoveNews_Click(object sender, EventArgs e)
        {
            User loggedUser = Help.GetUserSession(Session);

            if (loggedUser != null && editingPost != null && loggedUser.ID == editingPost.Creator.ID)
            { //If there is a logged in user, and a post being editted, and the person logged in created the post...
                bool result = DatabaseHandler.RemoveNewsPost(Session, editingPost.ID);
                if (result)
                {
                    ShowNewsInfo("News post has been permanently removed.", Color.Red);
                }
                else
                {
                    ShowNewsInfo("An error occured while removing the news post, it was not removed.", Color.Red);
                }
            }
            else
            {
                if (editingPost == null)
                {
                    ShowNewsInfo("This is not a post yet, press Submit New instead.", Color.Red);
                }
            }
        }