예제 #1
0
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     try
     {
         PageComment pageComment = ReceiveHtml();
         PageCommentBSO pageCommentBSO = new PageCommentBSO();
         pageCommentBSO.UpdatePageComment(pageComment);
         clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Nhận xét", pageComment.Title);
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }
예제 #2
0
        protected void initControl(int Id)
        {
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            if (Id > 0)
            {
                btn_add.Visible = false;
                btn_edit.Visible = true;
                hddCommentID.Value = Convert.ToString(Id);
                try
                {
                    PageCommentBSO pageCommentBSO = new PageCommentBSO();
                    PageComment pageComment = pageCommentBSO.GetPageCommentById(Id);
                    txtTitle.Text = pageComment.Title;
                    txtFullName.Text = pageComment.FullName;
                    hddNewsID.Value = Convert.ToString(pageComment.PageID);
                    txtContent.Html = pageComment.Content;
                    txtDateCreated.SelectedDate = pageComment.DateCreated;
                    rdbActive.SelectedValue = pageComment.Actived.ToString();
                    hddGroup.Value = pageComment.GroupCate;
                    txtEmail.Text = pageComment.Email;

                    hddApprovalUserName.Value = pageComment.ApprovalUserName;
                    hddApprovalDate.Value = Convert.ToString(pageComment.ApprovalDate);

                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                    {
                        rdbActive.SelectedValue = Convert.ToString(pageComment.Actived);
                        rdbActive.Enabled = true;
                    }
                    else
                    {
                        rdbActive.SelectedValue = Convert.ToString(pageComment.Actived);
                        rdbActive.Enabled = false;
                    }

                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Approval"))
                    {

                        rdbActive.Enabled = true;
                    }
                    else
                    {

                        rdbActive.Enabled = false;
                    }
                }
            }
            else
            {
                btn_add.Visible = true;
                btn_edit.Visible = false;
                //     hddNewsID = 0;
            }
        }
예제 #3
0
        protected void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                PageComment pageComment = ReceiveHtml();
                PageCommentBSO pageCommentBSO = new PageCommentBSO();
                pageCommentBSO.CreatePageComment(pageComment);
                clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);

            }
            catch (Exception ex)
            {
                clientview.Text = ex.Message.ToString();
            }
        }
예제 #4
0
        protected void grvPageComment_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int Id = Convert.ToInt32(e.CommandArgument.ToString());
            string cName = e.CommandName.ToLower();
            AdminBSO adminBSO = new AdminBSO();
            ETO.Admin admin = new ETO.Admin();
            switch (cName)
            {
                case "_view":
                    break;
                case "_edit":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        Response.Redirect("~/Admin/editpagecomment/" + Id + "/Default.aspx");

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }

                    break;
                case "_delete":
                    admin = adminBSO.GetAdminById(Session["Admin_UserName"].ToString());

                    if (Session["Admin_UserName"].ToString().Equals("administrator") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Edit") || adminBSO.CheckPermission(Session["Admin_UserName"].ToString(), "Write"))
                    {
                        PageCommentBSO pageCommentBSO = new PageCommentBSO();
                        pageCommentBSO.DeletePageComment(Id);
                        PageCommentView(hddGroup.Value);

                    }
                    else
                    {
                        //  Response.Redirect("~/Homepage.aspx?dll=listnews");
                    }

                    break;
            }
        }
예제 #5
0
 protected void btn_delAll_Click(object sender, EventArgs e)
 {
     if (PageCommentID() != "")
     {
         PageCommentBSO pageCommentBSO = new PageCommentBSO();
         pageCommentBSO.DeletePageComment(PageCommentID());
     }
     PageCommentView(hddGroup.Value);
 }
예제 #6
0
 protected void btn_disable_Click(object sender, EventArgs e)
 {
     if (PageCommentID() != "")
     {
         PageCommentBSO pageCommentBSO = new PageCommentBSO();
         pageCommentBSO.UpdatePageComment(PageCommentID(), "0");
     }
     PageCommentView(hddGroup.Value);
 }
예제 #7
0
        protected void PageCommentView(string group)
        {
            PageCommentBSO pageCommentBSO = new PageCommentBSO();
            DataTable table = new DataTable();
            table = pageCommentBSO.GetAllGroupCateViewPageComment(group);


            commonBSO commonBSO = new commonBSO();
            commonBSO.FillToGridView(grvPageComment, table);
        }