コード例 #1
0
        private static Dictionary <string, ManagementBaseObject> GetCardholders(LenelService <Cardholder> cardholderService)
        {
            var cardholders = new Dictionary <string, ManagementBaseObject>();

            foreach (var card in cardholderService.GetInstances())
            {
                var key = card["SSNO"] as string;
                if (!string.IsNullOrEmpty(key))
                {
                    cardholders.Add(key, card);
                }
            }

            return(cardholders);
        }
コード例 #2
0
        private static Dictionary <string, ManagementBaseObject> GetLocations(LenelService <Location> locationService)
        {
            var locations = new Dictionary <string, ManagementBaseObject>();

            foreach (var location in locationService.GetInstances())
            {
                var key = location["Name"] as string;

                if (key != null)
                {
                    locations.Add(key, location);
                }
            }

            return(locations);
        }
コード例 #3
0
        private static Dictionary <int, ManagementBaseObject> GetBadges(LenelService <Badge> badgeService)
        {
            var badges = new Dictionary <int, ManagementBaseObject>();

            foreach (var badge in badgeService.GetInstances())
            {
                var key = badge["BADGEKEY"] as int?;

                if (key.HasValue)
                {
                    badges.Add(key.Value, badge);
                }
            }

            return(badges);
        }
コード例 #4
0
        private static Dictionary <string, ManagementBaseObject> GetDepartments(LenelService <Department> departmentService)
        {
            var departments = new Dictionary <string, ManagementBaseObject>();

            foreach (var department in departmentService.GetInstances())
            {
                var key = department["Name"] as string;

                if (key != null && departments.TryGetValue(key, out var value))
                {
                    continue;
                }

                if (key != null)
                {
                    departments.Add(key, department);
                }
            }

            return(departments);
        }