コード例 #1
0
        internal static bool DisplayFolder(ApplicationMenuFolder amf)
        {
            foreach (ApplicationMenuItem menu in amf.MenuItems)
            {
                if (menu.UserGrant <= GlobalInfo.UserInfo.userType)
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #2
0
        private static void LoadFolder(ApplicationMenuModule appModuleOri, XmlNodeList folderList)
        {
            ApplicationMenuFolder appFolder;
            ApplicationMenuModule appModule = appModuleOri;

            foreach (XmlNode folderNode in folderList)
            {
                string folder = folderNode.Attributes["name"].Value;
                if (folderNode.Attributes["namespace"] != null)
                {
                    appModule = ModuleList.Find(p => { return(p.Namespace.Module == folderNode.Attributes["namespace"].Value); });
                }
                else
                {
                    appModule = appModuleOri;
                }

                Debug.Assert(appModule != null, "implementare");

                appFolder = appModule.MenuFolders.Find(p => { return(p.Folder == folder); });
                if (appFolder == null)
                {
                    appFolder = new ApplicationMenuFolder(folder);
                    appModule.MenuFolders.Add(appFolder);
                }

                XmlNodeList itemList = folderNode.SelectNodes("item");
                foreach (XmlNode menuNode in itemList)
                {
                    string    itemName  = menuNode.Attributes["name"].Value;
                    NameSpace nSpace    = new NameSpace(menuNode.SelectSingleNode("namespace").InnerText);
                    string    formtype  = menuNode.SelectSingleNode("formtype").InnerText;
                    string    usergrant = menuNode.SelectSingleNode("usergrant").InnerText;

                    DocumentType formType = (DocumentType)Enum.Parse(typeof(DocumentType), formtype);
                    UserType     userType = (UserType)Enum.Parse(typeof(UserType), usergrant);

                    if (GlobalInfo.UserInfo.userType < userType)
                    {
                        continue;
                    }

                    appFolder.MenuItems.Add(new ApplicationMenuItem(itemName, nSpace, formType, userType));
                }
            }
        }
コード例 #3
0
        private static void LoadFolder(ApplicationMenuModule appModuleOri, XmlNodeList folderList)
        {
            ApplicationMenuFolder appFolder;
            var appModule = appModuleOri;

            folderList.Cast <XmlNode>().ToList().ForEach(folderNode =>
            {
                var folder = folderNode.Attributes["name"].Value;
                appModule  = folderNode.Attributes["namespace"] != null
                                ? ModuleList.Find(p => { return(p.Namespace.Module == folderNode.Attributes["namespace"].Value); })
                                : appModuleOri;

                Debug.Assert(appModule != null, "implementare");

                appFolder = appModule.MenuFolders.Find(p => { return(p.Folder == folder); });
                if (appFolder == null)
                {
                    appFolder = new ApplicationMenuFolder(folder);
                    appModule.MenuFolders.Add(appFolder);
                }

                folderNode.SelectNodes("item").Cast <XmlNode>().ToList().ForEach(menuNode =>
                {
                    var itemName  = menuNode.Attributes["name"].Value;
                    var nSpace    = new NameSpace(menuNode.SelectSingleNode("namespace").InnerText);
                    var formtype  = menuNode.SelectSingleNode("formtype").InnerText;
                    var usergrant = menuNode.SelectSingleNode("usergrant").InnerText;

                    var formType = (DocumentType)Enum.Parse(typeof(DocumentType), formtype);
                    var userType = (UserType)Enum.Parse(typeof(UserType), usergrant);

                    if (GlobalInfo.UserInfo.userType >= userType)
                    {
                        appFolder.MenuItems.Add(new ApplicationMenuItem(itemName, nSpace, formType, userType));
                    }
                });
            });
        }