protected void btn_Move_Click(object sender, EventArgs e) { if (Page.IsValid) { for (int i = 0; i < ListView_NewsList.Items.Count; i++) { CheckBox chk_Selected = (CheckBox)ListView_NewsList.Items[i].FindControl("chk_Selected"); if (chk_Selected.Checked) { HiddenField hidden_NewsID = (HiddenField)ListView_NewsList.Items[i].FindControl("Hidden_NewsID"); Lib.NewsMgr myNewsMgr = new Lib.NewsMgr(); Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(hidden_NewsID.Value); if (myNews_Post.CategoryID != CategoryTree_MoveTo.Selected_CategoryID) { e2Data[] UpdateData = { new e2Data("NewsID", myNews_Post.NewsID), new e2Data("CategoryID", CategoryTree_MoveTo.Selected_CategoryID) }; myNewsMgr.Edit_News_Post(UpdateData); // Switch Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Move_ComponentInCategory_Item(myNews_Post.CategoryID, CategoryTree_MoveTo.Selected_CategoryID, "3A79BF21-D0DF-4825-BFB2-7F6738C12BA7"); } } } Control_Init(); } }
protected void btn_PostComment_Click(object sender, EventArgs e) { if (Page.IsValid) { if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"])) { string _current_userid = Security.Users.UserStatus.Current_UserID(this.Page); if (!_isguestcomment) { if (_current_userid == "0") { Control_Init(); return; } } Lib.NewsMgr myNewsMgr = new Lib.NewsMgr(); e2Data[] UpdateData = { new e2Data("Parent_CommentID", "-1"), new e2Data("NewsID", Request["NexusNewsPostID"]), new e2Data("UserID", _current_userid), new e2Data("UserName", tbx_Comment_UserName.Text), new e2Data("UserEmail", tbx_Comment_UserEmail.Text), new e2Data("UserURL", tbx_Comment_UserURL.Text), new e2Data("UserIPaddress", Request.ServerVariables["REMOTE_ADDR"]), new e2Data("Post_Date", DateTime.Now.ToString()), new e2Data("Post_Content", RadEditor_Comment.Content), new e2Data("Comment_Approved", "1") }; myNewsMgr.Add_News_Comment(UpdateData); // Add Comment Count Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]); int _comment_count = Convert.ToInt32(myNews_Post.Comment_Count) + 1; e2Data[] UpdateData_Post = { new e2Data("NewsID", myNews_Post.NewsID), new e2Data("Comment_Count", _comment_count.ToString()) }; myNewsMgr.Edit_News_Post(UpdateData_Post); Control_Init(); } } }
protected void btn_Update_Click(object sender, EventArgs e) { if (Page.IsValid) { Lib.NewsMgr myNewsMgr = new Lib.NewsMgr(); string News_Date; if (RadDateTimePicker_NewsDate.SelectedDate != null) { News_Date = RadDateTimePicker_NewsDate.SelectedDate.ToString(); } else { News_Date = DateTime.Now.ToString(); } e2Data[] UpdateData = { new e2Data("NewsID", _newsid), new e2Data("CategoryID", CategoryTree_Menu.Selected_CategoryID), new e2Data("UserID", Security.Users.UserStatus.Current_UserID(this.Page)), new e2Data("UserName", Security.Users.UserStatus.Current_UserName(this.Page)), new e2Data("News_Date", News_Date), new e2Data("News_ModifyDate", DateTime.Now.ToString()), new e2Data("News_Title", tbx_Title.Text), new e2Data("News_Brief", TextEditor_ContentBrief.Content), new e2Data("News_Content", TextEditor_NewsContent.Content), new e2Data("News_Status", droplist_NewsStatus.SelectedValue), new e2Data("News_Password", tbx_Password.Text), new e2Data("Author", tbx_Author.Text), new e2Data("Source_Name", tbx_SourceName.Text), new e2Data("Source_URL", tbx_SourceURL.Text) }; myNewsMgr.Edit_News_Post(UpdateData); // Switch Category CategoryMgr myCategoryMgr = new CategoryMgr(); myCategoryMgr.Move_ComponentInCategory_Item(_source_categoryid, CategoryTree_Menu.Selected_CategoryID, "3A79BF21-D0DF-4825-BFB2-7F6738C12BA7"); // Finish Update Close Window string _finishupdate_script = string.Format("CloseAndRebind({0});", DataEval.QuoteText("Module_ControlPanel")); ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "myScript", _finishupdate_script, true); } }
private void Control_PreInit() { if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"])) { // Add View Count Lib.NewsMgr myNewsMgr = new Lib.NewsMgr(); Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]); int _view_count = Convert.ToInt32(myNews_Post.View_Count) + 1; e2Data[] UpdateData_Post = { new e2Data("NewsID", myNews_Post.NewsID), new e2Data("View_Count", _view_count.ToString()) }; myNewsMgr.Edit_News_Post(UpdateData_Post); } }