// GET: adminMain/MainPage
        public override ActionResult Index()
        {
            UserInfoManage userManage = new UserInfoManage();

            ViewBag.Title = "高校招生数据管理与分析系统";
            string[] key   = { CookieKeys.USERNAME, CookieKeys.USERDUTY };
            string   sName = string.Join("", userManage.GetLoginUserInfo(key));

            ViewData["MainPage_labUserNameText"] = sName;
            var Panel = this.GetCmp <Panel>("Menu");

            switch (AppSettingValues.MENUTYPE)
            {
            case "Default":
                Panel.Width = 150;
                break;

            case "Tree":
                Panel.Width = 180;
                break;

            case "Image":
                Panel.Width = 120;
                break;

            default:
                return(null);
            }
            return(View());
        }
        /// <summary>
        /// 初始化DataList顶部工具条的Button
        /// </summary>
        private void InitTopButton(string PanelID, DataListManage datalistMan, string Center_PageID)
        {
            foreach (ButtonModel mo in datalistMan.arrTopButton)
            {
                SetButtonVisiable(PanelID, mo.ButtonID);
                if (mo.ButtonName != null)
                {
                    SetButtonName(PanelID, mo.ButtonID, mo.ButtonName);
                }
                if (mo.ButtonIcon != Icon.Blank)
                {
                    SetButtonIcon(PanelID, mo.ButtonID, mo.ButtonIcon);
                }
            }

            if (datalistMan.bNeedAuthor)
            {
                UserInfoManage userMan     = new UserInfoManage();
                string[]       key         = { CookieKeys.USERROLES };
                string         sUserRoles  = string.Join("", userMan.GetLoginUserInfo(key));
                var            authormodel = userMan.GetAccountOperationModel(sUserRoles, Center_PageID);
                if (!authormodel.AddFlag)
                {
                    SetButtonVisiable(PanelID, DataListButton.btnAdd, false);
                    SetButtonVisiable(PanelID, DataListButton.btnInport, false);
                }
                if (!authormodel.EditFlag)
                {
                    SetButtonVisiable(PanelID, DataListButton.btnEdit, false);
                }
                if (!authormodel.DeleteFlag)
                {
                    SetButtonVisiable(PanelID, DataListButton.btnDelete, false);
                }
                if (!authormodel.SearchFlag)
                {
                    SetButtonVisiable(PanelID, DataListButton.btnSearch, false);
                    SetButtonVisiable(PanelID, DataListButton.btnReset, false);
                    SetButtonVisiable(PanelID, DataListButton.btnExport, false);
                }
            }
        }
        /// <summary>
        /// 初始化image菜单,不存在三级
        /// </summary>
        /// <returns></returns>
        //public ActionResult InitImageMenu()
        //{
        //    string sWebPath = GetApplicationPath();

        //    string sRelationIDs = System.Web.HttpContext.Current.Request.Cookies.Get("UserRoles").Value;
        //    operationMan.InitAuthorizationArray(sRelationIDs);

        //    Panel motherPanel = new Panel();
        //    motherPanel.Border = false;
        //    motherPanel.Header = false;
        //    motherPanel.Layout = "Accordion";
        //    motherPanel.Region = Region.Center;
        //    motherPanel.Width = 120;
        //    //首先获取一级菜单
        //    tblTreeInfo[] FirstModels = (tblTreeInfo[])operationMan.GetSomeTreeModels(-1, sRelationIDs);
        //    long nFirstNode = 0;
        //    for (int i = 0; i < FirstModels.Length; i++)
        //    {
        //        Panel menupanel = new Panel();
        //        menupanel.Title = FirstModels[i].Name;
        //        menupanel.Border = false;
        //        menupanel.Header = true;
        //        menupanel.Width = 120;
        //        menupanel.Layout = "VBox";
        //        menupanel.AutoScroll = true;

        //        //然后是二级菜单
        //        tblTreeInfo[] SecondModels = (tblTreeInfo[])operationMan.GetSomeTreeModels(FirstModels[i].ID, sRelationIDs);
        //        string sAddress = sWebPath + ConstAddressPath.ICON_PATH;
        //        string sWebAddress = ConstAddressPath.ICON_WEBPATH;
        //        FileManager clsFile = new FileManager();
        //        for (int j = 0; j < SecondModels.Length; j++)
        //        {
        //            ImageButton MenuItem = new ImageButton();
        //            MenuItem.ImageUrl = sAddress + "OperationInfo_" + SecondModels[j].ID + "_1.jpg";
        //            if (clsFile.HasFile(sWebAddress + "OperationInfo_" + SecondModels[j].ID + "_2.jpg"))
        //                MenuItem.OverImageUrl = sAddress + "OperationInfo_" + SecondModels[j].ID + "_2.jpg";
        //            if (clsFile.HasFile(sWebAddress + "OperationInfo_" + SecondModels[j].ID + "_3.jpg"))
        //                MenuItem.PressedImageUrl = sAddress + "OperationInfo_" + SecondModels[j].ID + "_3.jpg";
        //            MenuItem.DirectEvents.Click.Method = HttpMethod.POST;
        //            MenuItem.DirectEvents.Click.Url = sWebPath + "/MainPage/MenuNodeClick";
        //            MenuItem.Width = 100;
        //            MenuItem.Height = 100;
        //            Parameter para = new Parameter();
        //            para.Name = "nodeId";
        //            if (nFirstNode == 0)
        //                nFirstNode = SecondModels[j].ID;
        //            para.Value = SecondModels[j].ID.ToString();
        //            para.Mode = ParameterMode.Raw;
        //            MenuItem.DirectEvents.Click.ExtraParams.Add(para);
        //            ToolTip tooltip = new ToolTip();
        //            if (SecondModels[j].Remark != "")
        //                tooltip.Html = SecondModels[j].Remark;
        //            else
        //                tooltip.Html = SecondModels[j].Name;
        //            MenuItem.ToolTips.Add(tooltip);
        //            menupanel.Items.Add(MenuItem);
        //        }
        //        motherPanel.Items.Add(menupanel);
        //    }
        //    motherPanel.DirectEvents.AfterRender.Method = HttpMethod.POST;
        //    motherPanel.DirectEvents.AfterRender.Url = sWebPath + "/MainPage/InitMenuCenter";
        //    motherPanel.DirectEvents.AfterRender.ExtraParams.Add(new Parameter("sFirstLeafID", nFirstNode.ToString(), ParameterMode.Raw));

        //    return this.ComponentConfig(motherPanel);
        //}

        /// <summary>
        /// 初始化Accordion样式菜单
        /// </summary>
        /// <returns></returns>
        public ActionResult InitAccordionMenu()
        {
            UserInfoManage      userMan      = new UserInfoManage();
            OperationInfoManage operationMan = new OperationInfoManage();
            string sWebPath = GetApplicationPath();

            string[] key          = { CookieKeys.USERROLES };
            string   sRelationIDs = string.Join("", userMan.GetLoginUserInfo(key));

            operationMan.InitAuthorizationArray(sRelationIDs);

            Panel motherPanel = new Panel();

            motherPanel.Border = false;
            motherPanel.Header = false;
            motherPanel.Layout = "Accordion";
            motherPanel.Region = Region.Center;
            //首先获取一级菜单
            tblTreeInfo[] FirstModels = (tblTreeInfo[])operationMan.GetSomeTreeModels(-1, sRelationIDs);
            long          nFirstNode  = 0;

            for (int i = 0; i < FirstModels.Length; i++)
            {
                MenuPanel menupanel = new MenuPanel();
                menupanel.Title = FirstModels[i].Name;
                //然后是二级菜单
                tblTreeInfo[] SecondModels = (tblTreeInfo[])operationMan.GetSomeTreeModels(FirstModels[i].ID, sRelationIDs);
                for (int j = 0; j < SecondModels.Length; j++)
                {
                    MenuItem menuitem = new MenuItem();
                    menuitem.Text = SecondModels[j].Name;
                    if (SecondModels[j].IsLeaf)
                    {
                        menuitem.Icon = Icon.ArrowRight;
                        menuitem.DirectEvents.Click.Method = HttpMethod.POST;
                        menuitem.DirectEvents.Click.Url    = sWebPath + "/MainPage/MenuNodeClick";
                        Parameter para = new Parameter();
                        para.Name = "nodeId";
                        if (nFirstNode == 0)
                        {
                            nFirstNode = SecondModels[j].ID;
                        }
                        para.Value = SecondModels[j].ID.ToString();
                        para.Mode  = ParameterMode.Raw;
                        menuitem.DirectEvents.Click.ExtraParams.Add(para);
                    }
                    else
                    {
                        //然后是三级菜单
                        tblTreeInfo[] ThirdModels = (tblTreeInfo[])operationMan.GetSomeTreeModels(SecondModels[j].ID, sRelationIDs);
                        Menu          subMenu     = new Menu();
                        for (int k = 0; k < ThirdModels.Length; k++)
                        {
                            MenuItem submenuitem = new MenuItem();
                            submenuitem.Text = ThirdModels[k].Name;
                            submenuitem.Icon = Icon.ArrowRight;
                            submenuitem.DirectEvents.Click.Method = HttpMethod.POST;
                            submenuitem.DirectEvents.Click.Url    = sWebPath + "/MainPage/MenuNodeClick";
                            Parameter para = new Parameter();
                            para.Name  = "nodeId";
                            para.Value = ThirdModels[k].ID.ToString();
                            para.Mode  = ParameterMode.Raw;
                            submenuitem.DirectEvents.Click.ExtraParams.Add(para);
                            submenuitem.DirectEvents.Click.EventMask.ShowMask = true;
                            submenuitem.DirectEvents.Click.EventMask.Msg      = "正在加载,请稍后...";
                            subMenu.Items.Add(submenuitem);
                        }
                        menuitem.Icon = Icon.PlayGreen;
                        menuitem.Menu.Add(subMenu);
                    }
                    menupanel.Menu.Items.Add(menuitem);
                }
                motherPanel.Items.Add(menupanel);
            }
            motherPanel.DirectEvents.AfterRender.Method = HttpMethod.POST;
            motherPanel.DirectEvents.AfterRender.Url    = sWebPath + "/MainPage/InitMenuCenter";
            motherPanel.DirectEvents.AfterRender.ExtraParams.Add(new Parameter("sFirstLeafID", nFirstNode.ToString(), ParameterMode.Raw));
            return(this.ComponentConfig(motherPanel));
        }