Ejemplo n.º 1
0
        protected void btn_Delete_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);

                        // Remove from Database
                        myNewsMgr.Remove_News_Comments(hidden_NewsID.Value);
                        myNewsMgr.Remove_News_Post(hidden_NewsID.Value);

                        // Remove Item from Category
                        CategoryMgr myCategoryMgr = new CategoryMgr();
                        myCategoryMgr.Delete_ComponentInCategory_Item(myNews_Post.CategoryID, "3A79BF21-D0DF-4825-BFB2-7F6738C12BA7");
                    }
                }

                Control_Init();
            }
        }
Ejemplo n.º 2
0
        private void Control_Init()
        {
            if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"]))
            {
                Lib.NewsMgr   myNewsMgr   = new Lib.NewsMgr();
                Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]);

                tbx_Title.Text = myNews_Post.News_Title;
                TextEditor_NewsContent.Content        = myNews_Post.News_Content;
                CategoryTree_Menu.Selected_CategoryID = myNews_Post.CategoryID;
                droplist_NewsStatus.SelectedValue     = myNews_Post.News_Status.ToString();
                tbx_Password.Text = myNews_Post.News_Password;
                RadDateTimePicker_NewsDate.SelectedDate = Convert.ToDateTime(myNews_Post.News_Date);
                TextEditor_ContentBrief.Content         = myNews_Post.News_Brief;
                tbx_Author.Text     = myNews_Post.Author;
                tbx_SourceName.Text = myNews_Post.Source_Name;
                tbx_SourceURL.Text  = myNews_Post.Source_URL;

                _newsid                        = myNews_Post.NewsID;
                ViewState["NewsID"]            = _newsid;
                _source_categoryid             = myNews_Post.CategoryID;
                ViewState["Source_CategoryID"] = _source_categoryid;
            }
            else
            {
                btn_Update.Enabled = false;
            }
        }
Ejemplo n.º 3
0
        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();
            }
        }
Ejemplo n.º 4
0
        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();
                }
            }
        }
Ejemplo n.º 5
0
        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);
            }
        }
Ejemplo n.º 6
0
        private void NewsList_DataBind()
        {
            if (!DataEval.IsEmptyQuery(_category_selected))
            {
                RadTabStrip_Commands.Visible = true;

                Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();
                ListView_NewsList.DataSource   = myNewsMgr.Get_News_Posts(_category_selected, "ALL", "News_Date", "DESC");
                ListView_NewsList.DataKeyNames = new string[] { "NewsID" };
                ListView_NewsList.DataBind();

                CheckBox chk_SelectAll = (CheckBox)ListView_NewsList.FindControl("chk_SelectAll");
                if (chk_SelectAll != null)
                {
                    chk_SelectAll.Checked = false;
                }
            }
        }
Ejemplo n.º 7
0
        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("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", News_Date),
                    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.Add_News_Post(UpdateData);

                // Add Item to Category
                CategoryMgr myCategoryMgr = new CategoryMgr();
                myCategoryMgr.Add_ComponentInCategory_Item(CategoryTree_Menu.Selected_CategoryID, "3A79BF21-D0DF-4825-BFB2-7F6738C12BA7");

                _iscreated = true;

                Control_Init();
            }
        }
Ejemplo n.º 8
0
        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);
            }
        }
Ejemplo n.º 9
0
        private void Control_Init()
        {
            if (!DataEval.IsEmptyQuery(_newslistid))
            {
                if (Request.QueryString["PageLink"] == "Disable")
                {
                    ListView_NewsList.Enabled   = false;
                    btn_NewsStatus_Show.Enabled = false;
                }

                #region Bind Data to droplist
                // Enable user edit mode

                //Gets your enum names and adds it to a string array
                Array enumNames = Enum.GetValues(typeof(Lib.News_Status));

                //Creates an ArrayList
                ArrayList myNews_Statuses = new ArrayList();

                //Loop through your string array and poppulates the ArrayList
                foreach (Lib.News_Status myNews_Status in enumNames)
                {
                    myNews_Statuses.Add(new { Value = StringEnum.GetStringValue(myNews_Status), Name = myNews_Status.ToString() });
                }


                //Bind the ArrayList to your DropDownList
                droplist_NewsStatus_Show.DataSource     = myNews_Statuses;
                droplist_NewsStatus_Show.DataTextField  = "Name";
                droplist_NewsStatus_Show.DataValueField = "Value";
                droplist_NewsStatus_Show.DataBind();
                #endregion

                if (DataEval.IsEmptyQuery(_news_status_show))
                {
                    _news_status_show = droplist_NewsStatus_Show.SelectedValue;
                }
                else
                {
                    droplist_NewsStatus_Show.SelectedValue = _news_status_show;
                }

                if (Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                {
                    //lbtn_Add_News.Visible = true;
                    droplist_NewsStatus_Show.Visible = true;
                    btn_NewsStatus_Show.Visible      = true;
                }
                else
                {
                    //lbtn_Add_News.Visible = false;
                    droplist_NewsStatus_Show.Visible = false;
                    btn_NewsStatus_Show.Visible      = false;
                }

                Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();

                ListView_NewsList.DataSource   = myNewsMgr.Get_News_Posts(_categoryid, _news_status_show, _sortorder, _orientation, _totalnumber, _newsdetailurl);
                ListView_NewsList.DataKeyNames = new string[] { "NewsID" };

                Core.Tools.AppItemTemplates myItemTemplate = new Core.Tools.AppItemTemplates();

                switch (_itemtemplate)
                {
                case "Default":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsList_Default.ascx";
                    break;

                case "TitleOnly":
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsList_TitleOnly.ascx";
                    break;

                case "Custom":
                    myItemTemplate.ItemTemplatePath = _itemtemplateurl;
                    break;

                default:
                    myItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsList_Default.ascx";
                    break;
                }

                myItemTemplate.Set_Separator("");
                myItemTemplate.Set_DataEmpty("");

                ListView_NewsList.ItemTemplate            = Page.LoadTemplate(myItemTemplate.ItemTemplatePath);
                ListView_NewsList.AlternatingItemTemplate = Page.LoadTemplate(myItemTemplate.AltPath);

                if (!DataEval.IsEmptyQuery(myItemTemplate.Separator))
                {
                    ListView_NewsList.ItemSeparatorTemplate = Page.LoadTemplate(myItemTemplate.Separator);
                }

                if (!DataEval.IsEmptyQuery(myItemTemplate.DataEmpty))
                {
                    ListView_NewsList.EmptyDataTemplate = Page.LoadTemplate(myItemTemplate.DataEmpty);
                }

                try
                {
                    ListView_NewsList.DataBind();
                }
                catch
                {
                    // Load Template Failed
                }

                DataPager_NewsList.PageSize = _numberperpage;
                DataPager_NewsList.Visible  = _enable_pager;
            }
        }
Ejemplo n.º 10
0
        private void Control_Init()
        {
            if (DataEval.IsEmptyQuery(_newsdetailid))
            {
                MultiView_NewsDetail.SetActiveView(View_New);
            }
            else
            {
                MultiView_NewsDetail.SetActiveView(View_Detail);

                if (Request.QueryString["PageLink"] == "Disable")
                {
                    hlink_Edit_News.Enabled = false;
                    btn_PostComment.Enabled = false;
                }

                // Init Comment Form
                RadEditor_Comment.ToolsFile = "~/App_Data/Editor/BasicTools.xml";
                RadEditor_Comment.EditModes = Telerik.Web.UI.EditModes.Design | Telerik.Web.UI.EditModes.Preview;
                RadEditor_Comment.Content   = "";

                if (!DataEval.IsEmptyQuery(Request["NexusNewsPostID"]))
                {
                    Lib.NewsMgr myNewsMgr = new Lib.NewsMgr();

                    Lib.News_Post myNews_Post = myNewsMgr.Get_News_Post(Request["NexusNewsPostID"]);

                    if (Security.Users.UserStatus.Validate_PageAuth_Modify(this.Page))
                    {
                        hlink_Edit_News.Visible = true;

                        hlink_Edit_News.Attributes["href"]    = "#";
                        hlink_Edit_News.Attributes["onclick"] = string.Format("return Show_ControlManager('/App_AdminCP/SiteAdmin/PoP_ControlPanel.aspx?ControlID={0}&NexusNewsPostID={1}');", "60B08E61-40DA-4989-B401-81B75A619F85", myNews_Post.NewsID);
                    }
                    else
                    {
                        hlink_Edit_News.Visible = false;
                    }

                    // Page Title
                    if (_ispagetitle)
                    {
                        Page.Title = myNews_Post.News_Title;
                    }

                    // Fillup Post Content
                    List <News_Post> myNews_Posts = new List <News_Post>();
                    myNews_Posts.Add(myNews_Post);

                    FormView_NewsDetail.DataSource   = myNews_Posts;
                    FormView_NewsDetail.DataKeyNames = new string[] { "NewsID" };

                    Core.Tools.AppItemTemplates myNewsDetail_ItemTemplate = new Core.Tools.AppItemTemplates();

                    switch (_newsdetail_itemtemplate)
                    {
                    case "Default":
                        myNewsDetail_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsDetail_Default.ascx";
                        break;

                    case "Custom":
                        myNewsDetail_ItemTemplate.ItemTemplatePath = _newsdetail_itemtemplateurl;
                        break;

                    default:
                        myNewsDetail_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsDetail_Default.ascx";
                        break;
                    }

                    FormView_NewsDetail.ItemTemplate = Page.LoadTemplate(myNewsDetail_ItemTemplate.ItemTemplatePath);

                    try
                    {
                        FormView_NewsDetail.DataBind();
                    }
                    catch
                    {
                        // Load Template Failed
                    }


                    //lbl_Title.Text = myNews_Post.News_Title;
                    //lbl_News_Date.Text = myNews_Post.News_Date_Short;
                    //lbl_UserName.Text = myNews_Post.UserName;
                    //Literal_Content.Text = myNews_Post.News_Content;
                    //lbl_Post_ModifyDate.Text = myNews_Post.News_ModifyDate;
                    //lbl_Comment_Count.Text = myNews_Post.Comment_Count;

                    //// Fillup Author
                    //if (DataEval.IsEmptyQuery(myNews_Post.Author) && DataEval.IsEmptyQuery(myNews_Post.Source_Name))
                    //{
                    //    Panel_Original_Source.Visible = false;
                    //}
                    //else
                    //{
                    //    Panel_Original_Source.Visible = true;

                    //    if (!DataEval.IsEmptyQuery(myNews_Post.Author))
                    //        lbl_Author.Text = "Author : " + myNews_Post.Author;

                    //    if (!DataEval.IsEmptyQuery(myNews_Post.Source_Name_URL))
                    //        lbl_Source_Name.Text = "Source : " + myNews_Post.Source_Name_URL;

                    //}

                    // Enable Comment
                    if (_iscomment)
                    {
                        // Show Comment Title
                        #region Show Comment Title
                        FormView_Comment.DataSource   = myNews_Posts;
                        FormView_Comment.DataKeyNames = new string[] { "NewsID" };

                        Core.Tools.AppItemTemplates myCommentTitle_ItemTemplate = new Core.Tools.AppItemTemplates();

                        switch (_commenttitle_itemtemplate)
                        {
                        case "Default":
                            myCommentTitle_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsCommentTitle_Default.ascx";
                            break;

                        case "Custom":
                            myCommentTitle_ItemTemplate.ItemTemplatePath = _commenttitle_itemtemplateurl;
                            break;

                        default:
                            myCommentTitle_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsCommentTitle_Default.ascx";
                            break;
                        }

                        FormView_Comment.ItemTemplate = Page.LoadTemplate(myCommentTitle_ItemTemplate.ItemTemplatePath);

                        try
                        {
                            FormView_Comment.DataBind();
                        }
                        catch
                        {
                            // Load Template Failed
                        }

                        #endregion

                        //  Load User Name and Disable Guest Comment
                        string _current_username = Security.Users.UserStatus.Current_UserName(this.Page);
                        if (_current_username == "Guest")
                        {
                            if (_isguestcomment)
                            {
                                btn_PostComment.Enabled = true;
                            }
                            else
                            {
                                btn_PostComment.Enabled = false;
                            }

                            tbx_Comment_UserName.Enabled  = true;
                            Panel_Comment_Contact.Visible = false;
                        }
                        else
                        {
                            tbx_Comment_UserName.Text     = _current_username;
                            tbx_Comment_UserName.Enabled  = false;
                            Panel_Comment_Contact.Visible = true;
                        }

                        // Bind Post Comment
                        ListView_Comment.DataSource   = myNewsMgr.Get_News_Comments(Request["NexusNewsPostID"], "1");
                        ListView_Comment.DataKeyNames = new string[] { "CommentID" };

                        Core.Tools.AppItemTemplates myComment_ItemTemplate = new Core.Tools.AppItemTemplates();

                        switch (_comment_itemtemplate)
                        {
                        case "Default":
                            myComment_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsComment_Default.ascx";
                            break;

                        case "Custom":
                            myComment_ItemTemplate.ItemTemplatePath = _comment_itemtemplateurl;
                            break;

                        default:
                            myComment_ItemTemplate.ItemTemplatePath = "~/App_Control_Style/Nexus_News/Templates/NewsComment_Default.ascx";
                            break;
                        }

                        myComment_ItemTemplate.Set_Separator("");
                        myComment_ItemTemplate.Set_DataEmpty("");

                        ListView_Comment.ItemTemplate            = Page.LoadTemplate(myComment_ItemTemplate.ItemTemplatePath);
                        ListView_Comment.AlternatingItemTemplate = Page.LoadTemplate(myComment_ItemTemplate.AltPath);

                        if (!DataEval.IsEmptyQuery(myComment_ItemTemplate.Separator))
                        {
                            ListView_Comment.ItemSeparatorTemplate = Page.LoadTemplate(myComment_ItemTemplate.Separator);
                        }

                        if (!DataEval.IsEmptyQuery(myComment_ItemTemplate.DataEmpty))
                        {
                            ListView_Comment.EmptyDataTemplate = Page.LoadTemplate(myComment_ItemTemplate.DataEmpty);
                        }

                        try
                        {
                            ListView_Comment.DataBind();
                        }
                        catch
                        {
                            // Load Template Failed
                        }

                        DataPager_PostView.PageSize = _numberperpage;

                        Panel_Comment.Visible = true;
                    }
                    else
                    {
                        Panel_Comment.Visible = false;
                    }
                }
                else
                {
                    // No Post ID
                    hlink_Edit_News.Visible = false;
                    Panel_Comment.Visible   = false;
                }
            }
        }