protected void ViewCate(string group)
 {
     PagesBSO pagesBSO = new PagesBSO();
     DataTable table = pagesBSO.PageGetGroup(group, Language.language);
     commonBSO commonBSO = new commonBSO();
     ddlPage.Items.Clear();
     commonBSO.FillToDropDown(ddlPage, table, "~~ Lựa chọn trang đã có ~~", "0", "PageName", "PageName", "");
 }
Exemple #2
0
 private void AddDynamicNodes(XmlElement rootElement)
 {
     DataTable datatable = new PagesBSO().GetPagesCate(Language.language);
     if (datatable != null)
     {
         foreach (DataRow rows in datatable.Rows)
         {
             AddDynamicChildElement(rootElement, "~/Default2.aspx?goto=" + rows["PageName"].ToString(), rows["PageName"].ToString(), rows["PageName"].ToString());
         }
     }
 }
        private void ViewPages(int Id)
        {
            PagesBSO pagesBSO = new PagesBSO();
            Pages pages = pagesBSO.GetPagesById(Id);





            ltlTitle.Text = pages.PageTitle;
            //     LabelDate.Text = pages.PostDate.ToString("dd/MM/yyyy");

            ltlDescribe.Text = pages.Describe;
            FullDescirbe.Text = pages.PageContent;
            LabelAuthor.Text = pages.Author;

            if (pages.Imagethumb != "")
                ltlImageThumb.Text = @"<img src='../../Upload/BlogPage/" + pages.Imagethumb + "' align='left' class='border_image' width='240' style='margin-bottom:3px;'>";

        }
        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;
                hddPageID.Value = Convert.ToString(Id);
                try
                {
                    PagesBSO pagesBSO = new PagesBSO();
                    Pages pages = pagesBSO.GetPagesById(Id);
                    ddlPage.SelectedValue = pages.PageName;
                    txtPageName.Text = pages.PageName;
                    rdbGroup.SelectedValue = pages.Icon;
                    txtTitle.Text = pages.PageTitle;
                    rdbType1.SelectedValue = pages.PageType.ToString();
                    rdbType1.Enabled = false;
                    txtRadshort.Html = pages.Describe;
                    hddImage.Value = pages.Imagethumb;
                    txtRad_full.Html = pages.PageContent;
                    txtRadDate.SelectedDate = pages.PostDate;
                    txtAuthor.Text = pages.Author;
                    rdbActive.SelectedValue = pages.Status.ToString();
                    rdbIsView.SelectedValue = pages.IsView.ToString();
                    rdbComment.SelectedValue = pages.IsComment.ToString();

                    hddCommentTotal.Value = Convert.ToString(pages.CommentTotal);
                    hddVisitTotal.Value = Convert.ToString(pages.VisitTotal);
                    hddCreateUserName.Value = pages.CreatedUserName;
                    hddApprovalUserName.Value = pages.ApprovalUserName;
                    hddApprovalDate.Value = Convert.ToString(pages.ApprovalDate);



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

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

                    if (pages.PageType == true)
                    {
                        divFull.Visible = true;
                        divTitle1.Visible = true;
                    }
                    else
                    {
                        divFull.Visible = false;
                        divTitle1.Visible = false;
                    }

                }
                catch (Exception ex)
                {
                    clientview.Text = ex.Message.ToString();
                }
            }
            else
            {
                txtRadDate.SelectedDate = DateTime.Now;
                btn_add.Visible = true;
                btn_edit.Visible = false;

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

                    rdbApproval.Enabled = true;
                }
                else
                {

                    rdbApproval.Enabled = false;
                }

            }
        }
 protected void btn_edit_Click(object sender, EventArgs e)
 {
     try
     {
         Pages pages = ReceiveHtml();
         PagesBSO pagesBSO = new PagesBSO();
         pagesBSO.PagesUpdate(pages);
         clientview.Text = String.Format(Resources.StringAdmin.UpdateSuccessful, "Trang", pages.PageName);
         ViewCate(hddGroup.Value);
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }
 protected void btn_add_Click(object sender, EventArgs e)
 {
     try
     {
         Pages pages = ReceiveHtml();
         PagesBSO pagesBSO = new PagesBSO();
         pagesBSO.PageCreate(pages);
         clientview.Text = String.Format(Resources.StringAdmin.AddNewsSuccessful);
         ViewCate(hddGroup.Value);
     }
     catch (Exception ex)
     {
         clientview.Text = ex.Message.ToString();
     }
 }
        protected void GridView1_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/editpage/" + 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"))
                    {
                        PagesBSO pagesBSO = new PagesBSO();
                        pagesBSO.DeletePages(Id);
                        PagesView(hddGroup.Value);

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

                    break;
            }
        }
 protected void btn_delAll_Click(object sender, EventArgs e)
 {
     if (PagesID() != "")
     {
         PagesBSO pagesBSO = new PagesBSO();
         pagesBSO.DeletePages(PagesID());
     }
     PagesView(hddGroup.Value);
 }
        protected void btn_disable_approval_Click(object sender, EventArgs e)
        {
            if (PagesID() != "")
            {
                PagesBSO pagesBSO = new PagesBSO();
                pagesBSO.PagesUpdate(PagesID(), "0", Session["Admin_UserName"].ToString(), DateTime.Now);
            }

            PagesView(hddGroup.Value);
        }
        protected void btn_disable_Click(object sender, EventArgs e)
        {
            if (PagesID() != "")
            {
                PagesBSO pagesBSO = new PagesBSO();
                pagesBSO.PagesUpdate(PagesID(), "0");
            }

            PagesView(hddGroup.Value);
        }
        protected void PagesView(string group)
        {
            PagesBSO pagesBSO = new PagesBSO();
            DataTable table = new DataTable();

            if (!Session["Admin_UserName"].Equals("administrator"))
            {
                table = pagesBSO.PagesSearchCate(group, Language.language);
            }
            else
            {
                table = pagesBSO.PagesSearchCate(group, Language.language);
            }


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