예제 #1
0
        // Create Page
        protected void btn_AddPage_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string   Page_SortOrder;
                SiteMenu mySiteMenu = new SiteMenu();

                if (_parent_pageindexid != "-1")
                {
                    Menu_Nodes myParent_Menu_Node = mySiteMenu.Get_Menu_Node(_parent_pageindexid);
                    Page_SortOrder = (myParent_Menu_Node.ChildrenCount + 1).ToString();
                }
                else
                {
                    // Base Parent
                    Page_SortOrder = (mySiteMenu.Get_Root_Menu_Count() + 1).ToString();
                }

                PageMgr myPageMgr = new PageMgr();

                // Page Index
                string PageIndexID = Tools.IDGenerator.Get_New_GUID_PlainText();

                e2Data[] UpdateData_PageIndex =
                {
                    new e2Data("PageIndexID",        PageIndexID),
                    new e2Data("Parent_PageIndexID", _parent_pageindexid),
                    new e2Data("Page_CategoryID",    "1"),
                    new e2Data("Page_Name",          tbx_MenuName.Text),
                    new e2Data("Page_Type",          droplist_PageType.SelectedValue),
                    new e2Data("SortOrder",          Page_SortOrder)
                };

                myPageMgr.Add_PageIndex(UpdateData_PageIndex);

                // Page Properties
                Add_Property(PageIndexID);

                // URLrewrite
                string URLrewrite = tbx_Page_Name.Text;

                Page_Type myPage_Type = (Page_Type)StringEnum.Parse(typeof(Page_Type), droplist_PageType.SelectedValue, true);

                switch (myPage_Type)
                {
                // Create Normal Page
                case Page_Type.Normal_Page:

                    if (rbtn_IsTemplate_Inherited.SelectedValue == "0")
                    {
                        Add_Template(PageIndexID);
                    }

                    if (rbtn_IsAttribute_Inherited.SelectedValue == "0")
                    {
                        Add_Attribute(PageIndexID);
                    }

                    break;

                // Create Category
                case Page_Type.Category:
                    if (rbtn_IsTemplate_Inherited.SelectedValue == "0")
                    {
                        Add_Template(PageIndexID);
                    }

                    if (rbtn_IsAttribute_Inherited.SelectedValue == "0")
                    {
                        Add_Attribute(PageIndexID);
                    }

                    break;

                case Page_Type.Internal_Page_Pointer:
                    Add_IntLink(PageIndexID);
                    break;

                case Page_Type.External_Link:
                    Add_ExtLink(PageIndexID);
                    break;
                }

                // Finishe Update
                //_pageindexid = PageIndexID;
                //OnFinishUpdate(this, EventArgs.Empty);
                Response.Redirect(string.Format("Pages.aspx?PageIndexID={0}", PageIndexID));
            }
        }