Ejemplo n.º 1
0
        private void setAllBusinessDic()
        {
            var keyPart = "BusinessSystem.";

            var nodes = _IBaseConfig.GetConfigNodes(c => c.Key.StartsWith(keyPart) && !c.IsDeleted, 1, 4);

            foreach (var node in nodes)
            {
                var business = new BusinessSystemInfo()
                {
                    Key  = node.NodeName,
                    Name = node.NodeValue
                };

                node.ChildNodes.Where(n => n.NodeName == "User").ToList().ForEach(u => {
                    u.ChildNodes.ForEach(uu => {
                        var userID = int.Parse(uu.NodeName);

                        if (_UserBusinesses.ContainsKey(userID))
                        {
                            _UserBusinesses[userID].Add(business);
                        }
                        else
                        {
                            _UserBusinesses.Add(userID, new List <BusinessSystemInfo>()
                            {
                                business
                            });
                        }
                    });
                });
            }
        }
Ejemplo n.º 2
0
        public List <BusinessSystemInfo> All(bool withuser = false)
        {
            var keyPart = "BusinessSystem.";

            List <ConfigNode> nodes = null;

            if (withuser)
            {
                nodes = _IBaseConfig.GetConfigNodes(c => c.Key.StartsWith(keyPart), keyPart, true, 1);
            }
            else
            {
                nodes = _IBaseConfig.GetConfigNodes(c => c.Key.StartsWith(keyPart) && c.Type == "0", keyPart, true, 1);
            }

            var result = new List <BusinessSystemInfo>();

            foreach (var node in nodes)
            {
                var business = new BusinessSystemInfo()
                {
                    Key  = node.NodeName,
                    Name = node.NodeValue
                };

                if (withuser)
                {
                    business.Users = GetUsers(node.NodeName);
                }

                result.Add(business);
            }

            return(result);
        }