Exemplo n.º 1
0
        public RoomInfo GetInfo(string roomAddress, string securityKey = null)
        {
            var room = _simpleTimedCache.GetCachedValue("RoomInfo_" + roomAddress,
                                                        TimeSpan.FromHours(24),
                                                        () => Task.FromResult(ExchangeServiceExecuteWithImpersonationCheck(roomAddress, svc => svc.ResolveName(roomAddress).SingleOrDefault()))).Result;

            if (null == room)
            {
                return(null);
            }

            var rights = _securityRepository.GetSecurityRights(roomAddress, securityKey);

            if (rights == SecurityStatus.Granted && _useChangeNotification)
            {
                // make sure we track rooms we're controlling
                _changeNotificationService.TrackRoom(roomAddress);
            }

            var roomMetadata = _roomRepository.GetRoomInfo(roomAddress) ?? new RoomMetadata();

            return(new RoomInfo()
            {
                CurrentTime = _dateTimeService.Now,
                DisplayName = (room.Mailbox.Name ?? "").Replace("(Meeting Room ", "("),
                SecurityStatus = rights,
                Size = roomMetadata.Size,
                BuildingId = roomMetadata.BuildingId,
                Floor = roomMetadata.Floor,
                DistanceFromFloorOrigin = roomMetadata.DistanceFromFloorOrigin ?? new Point(),
                Equipment = roomMetadata.Equipment,
                HasControllableDoor = !string.IsNullOrEmpty(roomMetadata.GdoDeviceId),
                BeaconUid = roomMetadata.BeaconUid,
            });
        }
        public object GetInfo(string roomAddress, string securityKey = null)
        {
            NameResolution room;

            using (_concurrencyLimiter.StartOperation())
            {
                room = _exchangeService.ResolveName(roomAddress).SingleOrDefault();
            }

            if (null == room)
            {
                return(null);
            }

            var rights = _securityRepository.GetSecurityRights(roomAddress, securityKey);

            if (rights == SecurityStatus.Granted && _useChangeNotification)
            {
                // make sure we track rooms we're controlling
                _changeNotificationService.TrackRoom(roomAddress);
            }

            return(new
            {
                CurrentTime = _dateTimeService.Now,
                DisplayName = room.Mailbox.Name,
                SecurityStatus = rights
            });
        }
        public RoomInfo GetStaticInfo(IRoom room)
        {
            var roomName = _exchangeConferenceRoomDiscoveryService.GetRoomName(room.RoomAddress).Result;

            if (null == roomName)
            {
                return(null);
            }

            var canControl = CanControl(room);

            if (canControl && _useChangeNotification)
            {
                // make sure we track rooms we're controlling
                _changeNotificationService.TrackRoom(room, _exchangeServiceManager, _contextService.CurrentOrganization);
            }

            var building = _buildingRepository.Get(room.BuildingId) ?? new BuildingEntity();
            var floor    = _floorRepository.Get(room.FloorId) ?? new FloorEntity();

            return(BuildRoomInfo(roomName, canControl, (RoomMetadataEntity)room, building, floor));
        }