Ejemplo n.º 1
0
        private void AddRoom(ServiceDTO serviceDto, RoomBuilder roomBuilder)
        {
            var area = new AttachedPropertyDTO
            {
                AttachedActor = roomBuilder.Name,
                Properties    = new Dictionary <string, string>()
            };

            if (!string.IsNullOrWhiteSpace(_workingTime))
            {
                area.Properties[MotionProperties.WorkingTime] = _workingTime;
            }

            foreach (var property in roomBuilder.Properties)
            {
                area.Properties[property.Key] = property.Value;
            }

            foreach (var detector in roomBuilder.Detectors.Values)
            {
                AddMotionSensor(detector.DetectorName, roomBuilder.Name, detector.Neighbors, serviceDto);
            }


            serviceDto.AreasAttachedProperties.Add(area);
        }
        private static void AddArea(ServiceDTO serviceDto, string areaName, IDictionary <string, string> properties = null)
        {
            var area = new AttachedPropertyDTO
            {
                AttachedActor = areaName,
                Properties    = new Dictionary <string, string>()
            };

            if (properties != null)
            {
                foreach (var property in properties)
                {
                    area.Properties.Add(property.Key, property.Value);
                }
            }

            serviceDto.AreasAttachedProperties.Add(area);
        }