Exemplo n.º 1
0
        protected void uiButtonUpdate_Click(object sender, EventArgs e)
        {
            EGEMech.BLL.Page page = new EGEMech.BLL.Page();
            if (CurrentPage !=null)
            {
                page = CurrentPage;
            }
            else
            {
                page.AddNew();
            }

            page.Title = uiTextBoxTitle.Text;
            page.Name = uiTextBoxName.Text;
            page.InMenu = uiCheckBoxInMenu.Checked;
            page.Content = Server.HtmlEncode(uiFCKeditorContent.Value);
            if (!string.IsNullOrEmpty(uiDropDownListPages.SelectedValue))
                page.ParentID = Convert.ToInt32(uiDropDownListPages.SelectedValue);
            page.Save();
            uiPanelEdit.Visible = false;
            uiPanelViewPages.Visible = true;
            Clearfields();
            BindData();
            LoadDDLs();
            CurrentPage = null;
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                int pid = 0;
                if (Request.QueryString["pid"] != null)
                {
                    try
                    {
                        pid = Convert.ToInt32(Request.QueryString["pid"].ToString());
                    }
                    catch (Exception ex)
                    {
                        pid = 0;
                    }
                }

                if (pid == 0)
                {
                    Response.Redirect("~/Default.aspx");
                }
                else
                {
                    EGEMech.BLL.Page page = new EGEMech.BLL.Page();
                    page.LoadByPrimaryKey(pid);
                    uiLabelTitle.Text = page.Title;
                    uiLiteralContent.Text = Server.HtmlDecode(page.Content);
                }
            }
        }
Exemplo n.º 3
0
 protected void uiButtonCancel_Click(object sender, EventArgs e)
 {
     uiPanelEdit.Visible = false;
     uiPanelViewPages.Visible = true;
     Clearfields();
     CurrentPage =null;
 }
Exemplo n.º 4
0
        private void LoadMenu()
        {
            string menu = " <ul>";
            EGEMech.BLL.Page page = new EGEMech.BLL.Page();
            page.GetAllPagesByParent(0);
            for (int i = 0; i < page.RowCount; i++)
            {
                menu += "<li><a href='Default.aspx'>" + page.Title + "</a> ";
                menu += LoadChildren(page.PageID);
                menu += "</li>";
                page.MoveNext();
            }
            menu += "</ul>";

            Literal1.Text = menu;
        }
Exemplo n.º 5
0
 private string LoadChildren(int parent)
 {
     string submenu = "";
     EGEMech.BLL.Page page = new EGEMech.BLL.Page();
     page.GetAllPagesByParent(parent);
     if (page.RowCount > 0)
     {
         submenu = "<ul style='display: none;'>";
         for (int i = 0; i < page.RowCount; i++)
         {
             submenu += "<li><a href='Default.aspx'>" + page.Title + "</a> ";
             submenu += LoadChildren(page.PageID);
             submenu += "</li>";
             page.MoveNext();
         }
         submenu += "</ul>";
     }
     return submenu;
 }
Exemplo n.º 6
0
 private void LoadDDLs()
 {
     EGEMech.BLL.Page page = new EGEMech.BLL.Page();
     page.LoadAll();
     uiDropDownListPages.DataSource = page.DefaultView;
     uiDropDownListPages.DataTextField = "Name";
     uiDropDownListPages.DataValueField = "PageID";
     uiDropDownListPages.DataBind();
     uiDropDownListPages.Items.Insert(0, new ListItem("Choose page", ""));
 }
Exemplo n.º 7
0
 private void BindData()
 {
     EGEMech.BLL.Page page = new EGEMech.BLL.Page();
     page.LoadAll();
     uiGridViewPages.DataSource = page.DefaultView;
     uiGridViewPages.DataBind();
 }
Exemplo n.º 8
0
        protected void uiGridViewPages_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditPages")
            {
                EGEMech.BLL.Page page = new EGEMech.BLL.Page();
                page.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                CurrentPage = page;

                uiTextBoxTitle.Text = page.Title;
                uiTextBoxName.Text = page.Name;
                uiCheckBoxInMenu.Checked = page.InMenu;
                uiFCKeditorContent.Value = Server.HtmlDecode(page.Content);
                if(!page.IsColumnNull("ParentID"))
                    uiDropDownListPages.SelectedValue = page.ParentID.ToString();
                uiPanelViewPages.Visible = false;
                uiPanelEdit.Visible = true;
            }
            else if (e.CommandName == "DeletePages")
            {
                try
                {
                    EGEMech.BLL.Page page = new EGEMech.BLL.Page();
                    page.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument));
                    page.MarkAsDeleted();
                    page.Save();
                    BindData();
                }
                catch (Exception ex)
                {
                    uiLabelError.Visible = true;
                }

            }
        }