예제 #1
0
        void LoadMenuFile()
        {
            if (String.IsNullOrEmpty(_CurrentFullFileName))
            {
                return;
            }
            menuItemEditorSurvey1.imgList = this.imageList2;

            try
            {
                Menu = TreeListEngineDevExpress.LoadMenuFromFile(_CurrentFullFileName);
                this.menuItemSurveyBindingSource.DataSource = Menu.ItemList;
                PopulateImage();
            }
            catch (InvalidOperationException)
            {
                fwkMessageView_Error.Show("The file not contain correct Pelsoftat to represent any menu .-");
            }
            catch (Exception ex2)
            {
                fwkMessageView_Error.Show(ex2);
            }
            treeList1.ExpandAll();
            treeList1.RefreshDataSource();
            lblFileLoad.Text           = String.Concat("File ", _CurrentFullFileName);
            storage.StorageObject.File = _CurrentFullFileName;
            storage.Save();
        }
예제 #2
0
        public IActionResult EditRole(int roleId)
        {
            var roleModel = _RoleInfoService.GetRole(roleId);

            if (roleModel == null)
            {
                return(NotFound());
            }
            var vm = new AddRoleViewModel
            {
                IsEdit   = true,
                RoleInfo = roleModel
            };
            var allMenu = _MenuService.GetMenuList();
            IList <TreeMenu> treeMenuList = new List <TreeMenu>();
            var pMenus = allMenu.Where(p => p.MenuPId == 0);

            foreach (var item in pMenus)
            {
                TreeMenu treeMenu = new TreeMenu
                {
                    ParentMenu = item,
                    SubMenus   = allMenu.Where(p => p.MenuPId == item.MenuId).ToList()
                };
                treeMenuList.Add(treeMenu);
            }
            vm.MenuList  = treeMenuList;
            vm.RoleMenus = _MenuService.GetMenusByRoleIds(roleId);
            return(View("AddRole", vm));
        }
예제 #3
0
        private SideMenuInfo GetStaff(Menu[] Staff)
        {
            SideMenuInfo report = new SideMenuInfo
            {
                Name = "Staff",
                Icon = "~/Content/Images/Icons/Documents.png"
            };
            List <TreeMenu> reportMenus = new List <TreeMenu>();

            foreach (Menu parent in Staff.Where(p => string.IsNullOrWhiteSpace(p.PARENT_PGM)).OrderBy(p => p.SORT_ORDER))
            {
                TreeMenu menu = new TreeMenu(parent);
                menu.SubMenus = GetSubMenus(menu.PGM_NO, Staff);
                reportMenus.Add(menu);
            }
            Collection <SideMenuInfo> roots = new Collection <SideMenuInfo>();

            foreach (var item in reportMenus)
            {
                SideMenuInfo info = CovertToDocumentsMenuInfo(item);
                if (info != null)
                {
                    roots.Add(info);
                }
            }
            report.ChildNodes = roots;
            return(report);
        }
예제 #4
0
파일: MenuBLL.cs 프로젝트: zkg642/JXXZ
        public List <TreeMenu> GetTreeMenus(int userID, int?roleID = null)
        {
            List <TreeMenu> dataList = dal.GetMenusByUserID(userID, roleID)
                                       .Select(t => new TreeMenu
            {
                ID       = t.ID,
                Name     = t.Name,
                text     = t.Name,
                ParentID = t.ParentID,
                Url      = t.Url,
                icon     = t.icon
            }).ToList();

            List <TreeMenu> list = new List <TreeMenu>();

            if (dataList.Count > 0)
            {
                for (int i = 0; i < dataList.Count; i++)
                {
                    TreeMenu item = dataList[i];

                    if (item.ParentID == null)
                    {
                        item = GetMenuChildren(dataList, item);
                        list.Add(item);
                    }
                }
            }

            return(list);
        }
예제 #5
0
        public void Populate(string pFullFileName, ImageList imgList)
        {
            if (string.IsNullOrEmpty(pFullFileName))
            {
                return;
            }
            this.imageList1 = imgList;

            TreeMenu menu = TreeListEngineDevExpress.LoadMenuFromFile(pFullFileName);

            this.menuItemSurveyBindingSource.DataSource = menu.ItemList;

            //foreach (MenuImage mi in menu.ImageList.OrderBy<MenuImage, int>(p => p.Index))
            //{
            //    imageList1.Images.Add(mi.Image);
            //}

            ((System.ComponentModel.ISupportInitialize)(this.treeList1)).BeginInit();
            this.treeList1.StateImageList  = this.imageList1;
            this.treeList1.SelectImageList = this.imageList1;

            ((System.ComponentModel.ISupportInitialize)(this.treeList1)).EndInit();
            treeList1.ExpandAll();
            treeList1.RefreshDataSource();
        }
예제 #6
0
        public async Task ShowMenu(WindowType hostIdentifier = WindowType.Root)
        {
            var viewModel = new TreeMenuViewModel(_dataProvider);
            var view      = new TreeMenu(viewModel);

            await DialogHost.Show(view, Common.GetEnumDescription(hostIdentifier));
        }
예제 #7
0
파일: TreeView.cs 프로젝트: oqewok/gitter
        public TreeView(GuiProvider gui)
            : base(Guids.TreeViewGuid, gui)
        {
            InitializeComponent();

            _splitContainer.BackColor        = GitterApplication.Style.Colors.WorkArea;
            _splitContainer.Panel1.BackColor = GitterApplication.Style.Colors.Window;
            _splitContainer.Panel2.BackColor = GitterApplication.Style.Colors.Window;

            _directoryTree.Columns.ShowAll(column => column.Id == (int)ColumnId.Name);
            _directoryTree.Columns[0].SizeMode = ColumnSizeMode.Auto;
            _treeContent.Columns.ShowAll(column => column.Id == (int)ColumnId.Name || column.Id == (int)ColumnId.Size);
            _treeContent.Columns.GetById((int)ColumnId.Name).SizeMode = ColumnSizeMode.Auto;

            _directoryTree.SelectionChanged         += OnDirectoryTreeSelectionChanged;
            _directoryTree.ItemContextMenuRequested +=
                (sender, e) =>
            {
                var vm = ViewModel as TreeViewModel;
                if (vm != null && vm.TreeSource != null)
                {
                    var menu = new TreeMenu(vm.TreeSource, (TreeDirectoryListItem)e.Item);
                    Utility.MarkDropDownForAutoDispose(menu);
                    e.ContextMenu         = menu;
                    e.OverrideDefaultMenu = true;
                }
            };
            _directoryTree.PreviewKeyDown += OnKeyDown;

            _treeContent.ItemContextMenuRequested += OnContextMenuRequested;
            _treeContent.SelectionChanged         += OnTreeContentSelectionChanged;
            _treeContent.PreviewKeyDown           += OnKeyDown;

            AddTopToolStrip(_toolBar = new TreeToolbar(this));
        }
예제 #8
0
        private static bool GetNodeHasChildren(TreeNode node, QPModelDataContext ctx, DbConnection connection, bool enableContentGrouping, bool areChildNodesParents)
        {
            bool result = false;

            if (areChildNodesParents)
            {
                result = true;
            }
            else if (node.Code == EntityTypeCode.CustomerCode || node.IsFolder || node.IsRecurring || node.IsGroup)
            {
                var count = TreeMenu.GetTreeChildNodesCount(
                    ctx,
                    connection,
                    node.Code,
                    node.IsFolder ? node.ParentId : node.Id,
                    node.IsFolder,
                    node.IsGroup,
                    node.GroupItemCode,
                    0,
                    QPContext.CurrentUserId,
                    QPContext.IsAdmin,
                    QPContext.CurrentCustomerCode,
                    enableContentGrouping);
                result = count > 0;
            }
            return(result);
        }
예제 #9
0
파일: MenuBLL.cs 프로젝트: zkg642/JXXZ
        private TreeMenu GetMenuChildren(List <TreeMenu> dataList, TreeMenu item)
        {
            List <TreeMenu> list = new List <TreeMenu>();

            for (int i = 0; i < dataList.Count; i++)
            {
                TreeMenu childrenItem = dataList[i];

                if (childrenItem.ParentID != null && childrenItem.ParentID == item.ID)
                {
                    childrenItem = GetMenuChildren(dataList, childrenItem);
                    list.Add(childrenItem);
                }
            }

            if (list.Count > 0)
            {
                item.expanded = true;
                item.leaf     = false;
            }
            else
            {
                item.expanded = false;
                item.leaf     = true;
            }

            item.children = list;

            return(item);
        }
예제 #10
0
        public IActionResult GetList(TreeMenu tree)
        {
            using (_dbContext)
            {
                var query = _dbContext.Column.Where(x => x.IsDeleted != 1 && x.SuperiorUuid == null);
                if (!string.IsNullOrEmpty(tree.Kw))
                {
                    query = query.Where(x => x.ColumnTitle.Contains(tree.Kw.Trim()));
                }
                query = query.OrderByDescending(x => x.IsStick).ThenByDescending(x => x.SortId);
                var data       = query.Paged(tree.CurrentPage, tree.PageSize).ToList();
                var totalCount = query.Count();
                //拼接json字符串
                var returndata = "[";
                for (int i = 0; i < data.Count; i++)
                {
                    int shuju = _dbContext.Column.Count(x => x.SuperiorUuid == data[i].ColumnUuid);


                    if (data[i].SuperiorMenu == 0)
                    {
                        //var cplist = data[i].cpName.Split(',');
                        returndata = returndata + "{columnUuid:'" + data[i].ColumnUuid + "',columnTitle:'" + data[i].ColumnTitle + "',sortID:'" + data[i].SortId + "',addTime:'" + data[i].AddTime + "',isStick:'" + data[i].IsStick + "',children:" + (shuju > 0 ? ChildrenData(data[i].ColumnUuid) : "[]") + "},";
                    }
                }

                returndata = returndata.Trim(',') + "]";
                var obj = JsonConvert.DeserializeObject(returndata);
                return(Ok(new { obj, totalCount }));
            }
        }
예제 #11
0
        private void newToolStripButton_Click(object sender, EventArgs e)
        {
            Menu = new TreeMenu();

            this.Text            = string.Concat(this.Text, " v.", Assembly.GetExecutingAssembly().GetName().Version.ToString());
            _CurrentFullFileName = FileFunctions.OpenFileDialog_New(Menu.GetXml(), FileFunctions.OpenFilterEnums.OpenXmlFilter, true);

            LoadMenuFile();
        }
예제 #12
0
        //[Browsable(false)]
        //public bool CategoryChange
        //{
        //    get { return menuItemEditorSurvey1.CategoryChange; }
        //}

        #endregion

        #region Constructor

        public FRM_EditMenu(TreeMenu menu, Fwk.UI.Controls.Menu.Tree.MenuItem pMenuItemSurvey, Action pAction, string assemblybaseType)
        {
            InitializeComponent();
            menuItemEditorSurvey1.ShowAction       = pAction;
            menuItemEditorSurvey1.MenuItem         = pMenuItemSurvey;
            menuItemEditorSurvey1.TreeMenu         = menu;
            menuItemEditorSurvey1.AssemblyBaseType = assemblybaseType;
            menuItemEditorSurvey1.Populate();
        }
        /// <summary>
        /// Triggered whenever any link is clicked
        /// </summary>
        /// <param name="parameters">The parameters passed in from the link</param>
        public void LinkClicked(params object[] parameters)
        {
            string className = parameters[0].ToString();
            string module    = parameters[1].ToString();

            TreeMenu menuItem = new TreeMenu();

            menuItem.ActionClass = className;
            menuItem.Module      = module;
            ShowControl(menuItem);
            panelConfiguration.SelectNode(menuItem);
        }
예제 #14
0
        public ActionResult Detail(int Id)
        {
            TreeMenu tm = treeMenuBll.GetEntities(u => u.Id == Id).FirstOrDefault();

            ViewBag.Id = tm.Id.ToString();
            ViewBag.tm = tm;
            var roles = roleInfoBll.GetEntities(r => true).ToList();

            ViewBag.RoleListDataSource         = roles;
            ViewBag.RoleListSelectedValueArray = tm.RoleInfo.Select <RoleInfo, string>(r => r.ID.ToString()).ToArray();
            return(View(tm));
        }
예제 #15
0
        public UIHandler()
        {
            RPG.UIHandler = this;
            KeyDown      += OnKeyDown;
            //Use some fancy transitions
            View.MenuTransitions = true;
            View.PopMenu();
            View.MenuOffset   = new Point(-302, 0);
            View.MenuPosition = new Point(UI.WIDTH - 300, 0);

            CharacterMenu = new RPGMenu("Character Menu", new GTASprite("CommonMenu", "interaction_bgd", Color.ForestGreen), new IMenuItem[] {
                new MenuButton("Quests", "").WithActivate(OpenQuestLog),
                new MenuButton("Set Skillbar", "").WithActivate(OpenSkillBarMenu),
                new MenuButton("Skills", "").WithActivate(OpenSkillsMenu),
                new MenuButton("Weapons", "").WithActivate(OpenWeaponsMenu),
                //new MenuButton("Talents", "", () => { View.PopMenu(); }),
                //new MenuButton("Mod Weapons", "", () => { View.PopMenu(); }),
                //new MenuButton("Mod Cars", "", () => { View.PopMenu();}),
                new MenuButton("Back", "").WithActivate(() => View.PopMenu())
            });

            ActionsMenu = new RPGMenu("ACTIONS", new GTASprite("CommonMenu", "interaction_bgd", Color.Red), new IMenuItem[] {
                new MenuButton("Spawn Personal Vehicle", "").WithActivate(() => RPGMethods.SpawnCar()),
                new MenuButton("Get Random Contract", "").WithActivate(GetRandomContract),
                new MenuButton("Purchase Goods", "").WithActivate(OpenShop),
                new MenuButton("Craft Items", "").WithActivate(OpenCrafting),
                new MenuButton("Back", "").WithActivate(View.PopMenu)
            });

            SkillTreeMenu  = RPG.SkillHandler.GetSkillMenu();
            WeaponTreeMenu = RPG.WeaponHandler.GetWeaponMenu();

            //var o = new MenuNumericScroller("Number", "", d => { }, d => { }, 0, 100, 1);
            //var p = new MenuToggle("Toggle", "", ()=> { }, () => { });

            MainMenu = new RPGMenu("RPG Menu", new GTASprite("CommonMenu", "interaction_bgd", Color.DodgerBlue), new IMenuItem[] {
                new MenuButton("Inventory", "").WithActivate(OpenInventory),
                new MenuButton("Character Menu", "").WithActivate(OpenCharacterMenu),
                new MenuButton("Actions ", "").WithActivate(() => View.AddMenu(ActionsMenu)),
                new MenuButton("Options", "").WithActivate(() => OpenOptionsMenu()),
                new MenuButton("Play as Michael, Franklin and Trevor ", "").WithActivate(ConfirmPlayAsTrio),
                new MenuButton("Play as Yourself", "").WithActivate(ConfirmPlayAsYourCharacter),
                new MenuButton("Return to Normal Mode ", "").WithActivate(ConfirmReturnToNormal),
                new MenuButton("Close", "").WithActivate(View.PopMenu)
            });



            RPGUI.FormatMenu(ActionsMenu);
            RPGUI.FormatMenu(MainMenu);
            RPGUI.FormatMenu(CharacterMenu);
        }
예제 #16
0
        /// <summary>
        /// Handles the AfterSelect event of the treeConfig control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.TreeViewEventArgs"/> instance containing the event data.</param>
        private void treeConfig_AfterSelect(object sender, TreeViewEventArgs e)
        {
            TreeNode selectedNode = treeConfig.SelectedNode;
            object   obj          = selectedNode.Tag;

            if (obj != null && obj.GetType() == typeof(TreeMenu))
            {
                TreeMenu menu = (TreeMenu)obj;
                if (ActionTrigger != null && !string.IsNullOrEmpty(menu.ActionClass))
                {
                    ActionTriggerEventHandlerArgs arg = new ActionTriggerEventHandlerArgs(menu);
                    this.ActionTrigger.BeginInvoke(this, arg, new AsyncCallback(this.AsyncCallback), null);
                }
            }
        }
예제 #17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MenuProvider"/> class.
        /// </summary>
        /// <param name="configFile">The config file.</param>
        public MenuProvider(string configFile) : this()
        {
            _treeMenu = Xml.Load <TreeMenu>(configFile);
            _images   = new ImageList();

            var images = Xml.Load <TreeMenuImages>("TreeMenuImage.xml");

            if (images == null)
            {
                return;
            }
            foreach (string t in images.Files)
            {
                _images.Images.Add(Image.FromFile(images.Folder + "\\" + t));
            }
        }
예제 #18
0
        /// <summary>
        /// Restablece el valor estatico de MenuItemList
        /// </summary>
        /// <param name="pFullFileName"></param>
        /// <returns></returns>
        public static TreeMenu LoadMenuFromFile(String pFullFileName)
        {
            //Application.StartupPath
            if (String.IsNullOrEmpty(pFullFileName))
            {
                return(null);
            }
            if (!System.IO.File.Exists(pFullFileName))
            {
                return(null);
            }

            String wXml = Fwk.HelperFunctions.FileFunctions.OpenTextFile(pFullFileName);

            return(TreeMenu.GetFromXml <TreeMenu>(wXml));
        }
예제 #19
0
        public ActionResult FavoriteMenu()
        {
            TreeMenu AllMenu              = new TreeMenu();
            TreeMenu SupportMenuItem      = new TreeMenu("Support Center", "javascript:PopWindowURL('" + Url.Content("~/IFF_MAIN/ASPX/misc/support_main.aspx'") + ",400,300)");
            TreeMenu ClientSearchMenuItem = new TreeMenu("Client Search", "javascript:PopWindowURL('" + Url.Content("~/IFF_MAIN/ASPX/onlines/companyconfig/companysearch.aspx'") + ",800,600)");
            TreeMenu DocMenuItem          = new TreeMenu("Document Status", "javascript:PopWindowURL('" + Url.Content("~/IFF_MAIN/ASPX/doctrack/operationdoctracking.aspx'") + ",800,600)");
            TreeMenu RecentWorkMenuItem   = new TreeMenu("Recent Works", "javascript:PopWindowURL('" + Url.Content("~/IFF_MAIN/ASPX/misc/recentwork2.aspx'") + ",800,600)");
            TreeMenu FavoirteMenuItems    = new TreeMenu("Favorites", "javascript:PopWindowURL('" + Url.Content("~/asp/site_admin/favorite_manager.asp'") + ",800,600)");
            TreeMenu BoardMenuItem        = new TreeMenu("Company Board", "javascript:viewPrivateBoard();");

            AllMenu.Children.Add(SupportMenuItem);
            AllMenu.Children.Add(ClientSearchMenuItem);
            AllMenu.Children.Add(DocMenuItem);
            AllMenu.Children.Add(RecentWorkMenuItem);
            AllMenu.Children.Add(FavoirteMenuItems);
            AllMenu.Children.Add(BoardMenuItem);
            string elt_account_number = Request.Cookies["CurrentUserInfo"]["elt_account_number"];
            string user_id            = Request.Cookies["CurrentUserInfo"]["user_id"];
            TabsBL tbBL  = new TabsBL();
            var    items = tbBL.GetAllFavoriteTabItem(elt_account_number, user_id);
            var    tops  = (from c in items select c.top_module).Distinct();

            foreach (var t in tops)
            {
                var FirstMenuItem = new TreeMenu(t, "javascript:void(0)");
                FavoirteMenuItems.Children.Add(FirstMenuItem);
                var seconds = (from c in items where c.top_module == t select c.sub_module).Distinct();
                foreach (var s in seconds)
                {
                    var SecondMenuItem = new TreeMenu(s, "javascript:void(0)");
                    FirstMenuItem.Children.Add(SecondMenuItem);
                    var third = (from c in items where c.sub_module == s && c.top_module == t select c);
                    foreach (var thr in third)
                    {
                        SecondMenuItem.Children.Add(new TreeMenu(thr.page_label, "javascript:PopWindowURL('" + Url.Content("~/" + thr.page_url) + "',800,600)"));
                    }
                }
            }



            var model = new HierarchicalModelDataSource <TreeMenu> {
                DataSource = AllMenu.Children
            };

            return(PartialView("_FavoriteMenu", model));
        }
예제 #20
0
        public IActionResult AddRole()
        {
            var vm      = new AddRoleViewModel();
            var allMenu = _MenuService.GetMenuList();
            IList <TreeMenu> treeMenuList = new List <TreeMenu>();
            var pMenus = allMenu.Where(p => p.MenuPId == 0);

            foreach (var item in pMenus)
            {
                TreeMenu treeMenu = new TreeMenu {
                    ParentMenu = item, SubMenus = allMenu.Where(p => p.MenuPId == item.MenuId).ToList()
                };
                treeMenuList.Add(treeMenu);
            }
            vm.MenuList = treeMenuList;
            return(View(vm));
        }
        /// <summary>
        /// Shows the control.
        /// </summary>
        /// <param name="menuItem">The menu item.</param>
        private void ShowControl(TreeMenu menuItem)
        {
            if (menuItem != null)
            {
                if (currentControl != null && currentControl.Name.Equals(menuItem.ActionClass, StringComparison.OrdinalIgnoreCase))
                {
                    // Click on the same menu item
                    return;
                }

                Control control;
                if (userControlLookup.TryGetValue(menuItem.ActionClass.ToLower(), out control))
                {
                    SetControl(control, menuItem);
                }
            }
        }
예제 #22
0
 private void UcMain_Load(object sender, EventArgs e)
 {
     MethodName = MethodBase.GetCurrentMethod().Name;
     //AdminLogger.Instance.Log.Verbose(ClassName, MethodName, "Start");
     try
     {
         Header.MainWindow    = MainWindow;
         Header.ParentControl = this;
         TreeMenu.ExpandAll();
         TreeMenu.AfterSelect += TreeMenu_AfterSelect;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "MAIN", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     //AdminLogger.Instance.Log.Verbose(ClassName, MethodName, "End");
 }
예제 #23
0
        /// <summary>
        /// Selects the node.
        /// </summary>
        /// <param name="menu">The menu.</param>
        public void SelectNode(TreeMenu menu)
        {
            List <TreeNode> nodes = FlattenDepth(treeConfig);

            foreach (TreeNode node in nodes)
            {
                if (node.Tag != null && node.Tag.GetType() == typeof(TreeMenu))
                {
                    TreeMenu nodeMenu = (TreeMenu)node.Tag;
                    if (!string.IsNullOrEmpty(nodeMenu.ActionClass) && nodeMenu.ActionClass.Equals(menu.ActionClass))
                    {
                        treeConfig.SelectedNode = node;
                        node.ExpandAll();
                        return;
                    }
                }
            }
        }
예제 #24
0
        public string LeftMenuNav()
        {
            var    data = menuhandler.GetDataList();
            object obj  = null;

            //List<DTMenu> list = new List<DTMenu>();
            //list = (List<DTMenu>)data;

            if (data != null)
            {
                obj = TreeMenu.GetNodeTreeData();
            }

            ////设置版权
            //string copyright = System.Configuration.ConfigurationSettings.AppSettings["copyright"].ToString();
            //ViewBag.CopyRight = copyright;

            ////IEnumerable<DTMenu> dtmenu = TreeMenu.GetNodeTreeData(dtmenu);
            return(obj.ToString());
        }
예제 #25
0
        void LoadMenuFile()
        {
            try
            {
                treeList2.BeginUpdate();
                menu = Common.LoadMenuFromFile(@"m_patient.xml");
                this.treeMenuBindingSource.DataSource = menu.ItemList;


                treeList2.RefreshDataSource();
                treeList2.EndUpdate();
            }
            //catch (InvalidOperationException e)
            //{
            //    ExceptionViewer.Show(e);
            //}
            catch (Exception ex2)
            {
                ExceptionViewer.Show(ex2);
            }
        }
        void LoadMenuFile()
        {
            try
            {
                treeList2.BeginUpdate();
                menu = Health.Front.Bases.Helper.LoadMenuFromFile(@"dat\m_patient.xml");
                this.treeMenuBindingSource.DataSource = menu.ItemList;


                treeList2.RefreshDataSource();
                treeList2.EndUpdate();
            }
            catch (InvalidOperationException e)
            {
                ExceptionViewer.Show(e);
            }
            catch (Exception ex2)
            {
                ExceptionViewer.Show(ex2);
            }
        }
예제 #27
0
        private SideMenuInfo CovertToSideMenuInfo(TreeMenu treeMenu, Collection <SideMenu> nodes, string rootcode, string username)
        {
            if (treeMenu.PGM_ID.StartsWith("Warehouse"))
            {
                return(ConvertToWarehouses(treeMenu));
            }
            if (treeMenu.PGM_ID == "TMALL" && treeMenu.SubMenus != null)
            {
                foreach (var channel in treeMenu.SubMenus)
                {
                    string channelName = channel.PGM_ID;
                    foreach (var action in channel.SubMenus)
                    {
                        action.PGM_ID = channelName + action.PGM_ID;
                    }
                }
            }
            SideMenu node = nodes.Count(p => p.Code == treeMenu.PGM_ID) > 1
                ? nodes.FirstOrDefault(p => p.Code == treeMenu.PGM_ID && p.ParentCode == rootcode)
                : nodes.FirstOrDefault(p => p.Code == treeMenu.PGM_ID);

            if (node == null)
            {
                return(null);
            }
            SideMenuInfo result = SideMenuInfo.CreateFrom(node);

            result.Name    = treeMenu.PGM_NM;
            result.Type    = SideItemType.Page;
            result.BadgeId = node.Code.Replace(" ", "");
            result.Badge   = ReadBadge(node.Code, username);
            if (treeMenu.SubMenus != null && treeMenu.SubMenus.Length > 0)
            {
                foreach (var info in treeMenu.SubMenus.Select(temp => CovertToSideMenuInfo(temp, nodes, rootcode, username)).Where(info => info != null))
                {
                    result.ChildNodes.Add(info);
                }
            }
            return(result);
        }
 /// <summary>
 /// Outputs the specified text.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="menuItem">The menu item.</param>
 /// <param name="currentControl">The current control.</param>
 private void SetControl(Control control, TreeMenu menuItem)
 {
     if (control.InvokeRequired)
     {
         SetControlCallback scc = new SetControlCallback(SetControl);
         this.Invoke(scc, new object[] { control, menuItem });
     }
     else
     {
         //if (currentControl != null) currentControl.Visible = false;
         if (currentControl != null)
         {
             currentControl.Enabled = false;
             currentControl.Dock    = DockStyle.None;
         }
         control.Tag     = menuItem.Module;
         control.Enabled = true;
         control.Dock    = DockStyle.Fill;
         control.BringToFront();
         currentControl = control;
     }
 }
예제 #29
0
        public Collection <SideMenuInfo> Create(Collection <SideMenu> nodes, string username)
        {
            //if (nodes == null || nodes.Count == 0 || Menus == null || Menus.Length == 0)
            //    return null;

            List <TreeMenu> treeMenus = new List <TreeMenu>();

            foreach (var parent in Menus.Where(p => string.IsNullOrWhiteSpace(p.PARENT_PGM)).OrderBy(p => p.SORT_ORDER))
            {
                TreeMenu menu = new TreeMenu(parent);
                menu.SubMenus = GetSubMenus(menu.PGM_NO, Menus);
                treeMenus.Add(menu);
            }

            Collection <SideMenuInfo> roots = new Collection <SideMenuInfo>();

            foreach (var item in treeMenus)
            {
                var info = CovertToSideMenuInfo(item, nodes, item.PGM_ID, username);
                if (info != null)
                {
                    roots.Add(info);
                }
            }
            if (Reports != null && Reports.Length > 0)
            {
                roots.Add(GetReports(Reports));
            }
            if (Documents != null && Documents.Length > 0)
            {
                roots.Add(GetDocuments(Documents));
            }
            if (Staff != null && Staff.Length > 0)
            {
                roots.Add(GetStaff(Staff));
            }
            return(roots);
        }
예제 #30
0
        public IViewComponentResult Invoke()
        {
            string ctlName = RouteData.Values["controller"].ToString();
            string actName = RouteData.Values["action"].ToString();

            MenuSidebarViewModel vm = new MenuSidebarViewModel();

            if (string.IsNullOrWhiteSpace(_ApplicationContext.CurrentUserRoles))
            {
                vm.UserMenuTree = new List <TreeMenu>();
                return(View(vm));
            }

            var allMenu = _MenuService.GetMenusByRoleIds(_ApplicationContext.CurrentUserRoles.Split(',').Select(p => int.Parse(p)).ToArray()).Where(p => p.IsDisplay);
            IList <TreeMenu>           treeMenuList = new List <TreeMenu>();
            Dictionary <int, TreeMenu> dicPMenu     = new Dictionary <int, TreeMenu>();

            foreach (var item in allMenu)
            {
                if (!dicPMenu.ContainsKey(item.MenuPId))
                {
                    TreeMenu treeMenu = new TreeMenu();
                    treeMenu.ParentMenu = _MenuService.GetMenu(item.MenuPId);
                    treeMenu.SubMenus   = allMenu.Where(p => p.MenuPId == item.MenuPId).ToList();
                    treeMenuList.Add(treeMenu);

                    dicPMenu.Add(item.MenuPId, treeMenu);
                }
                if (string.Equals(item.ControllerName, ctlName, StringComparison.CurrentCultureIgnoreCase) && string.Equals(item.ActionName, actName, StringComparison.CurrentCultureIgnoreCase))
                {
                    vm.SelectedMenuId = item.MenuId;
                }
            }
            vm.UserMenuTree = treeMenuList;

            return(View(vm));
        }
예제 #31
0
        void LoadMenuFile()
        {
            try
            {
                treeList2.BeginUpdate();
                menu = Common.LoadMenuFromFile(@"m_patient.xml");
                this.treeMenuBindingSource.DataSource = menu.ItemList;


                treeList2.RefreshDataSource();
                treeList2.EndUpdate();


            }
            //catch (InvalidOperationException e)
            //{
            //    ExceptionViewer.Show(e);
            //}
            catch (Exception ex2)
            {
                
                ExceptionViewer.Show(ex2);
            }
        }
        void LoadMenuFile()
        {
            try
            {
                treeList2.BeginUpdate();
                menu = Health.Front.Bases.Helper.LoadMenuFromFile(@"dat\m_patient.xml");
                this.treeMenuBindingSource.DataSource = menu.ItemList;


                treeList2.RefreshDataSource();
                treeList2.EndUpdate();

        
            }
            catch (InvalidOperationException e)
            {
                ExceptionViewer.Show(e);
            }
            catch (Exception ex2)
            {
                ExceptionViewer.Show(ex2);
            }
        }