コード例 #1
0
        public void CheckArtworkConditions(List <Artwork> artworks)
        {
            foreach (var a in artworks)
            {
                if (!a.Location.Equals("Storage"))
                {
                    bool addToList = false;
                    Console.WriteLine("a location=" + a.Location);
                    RoomMeasurement actualRoom = MeasurementList.getRoomMeasurementByRoomNo(a.Location);
                    if (actualRoom != null)
                    {
                        Console.WriteLine("aMaxCo2 =" + a.MaxCo2 + "actualRoomCo2:" + actualRoom.Co2);
                        if (a.MaxCo2 < actualRoom.Co2 || a.MinCo2 > actualRoom.Co2)
                        {
                            a.Comment += "Bad Co2 Levels,";
                            addToList  = true;
                        }

                        if (a.MaxHumidity < actualRoom.Humidity || a.MinHumidity > actualRoom.Humidity)
                        {
                            a.Comment += "Bad Humidity Levels,";
                            addToList  = true;
                        }

                        if (a.MaxLight < actualRoom.Light || a.MinLight > actualRoom.Light)
                        {
                            a.Comment += "Bad Light Levels,";
                            addToList  = true;
                        }

                        if (a.MaxTemperature < actualRoom.Temperature || a.MinTemperature > actualRoom.Temperature)
                        {
                            a.Comment += "Bad Temperature Levels,";
                            addToList  = true;
                        }

                        if (addToList)
                        {
                            Artworks.artworks.Add(a);
                        }
                        Console.WriteLine("artwork added" + a.Author);
                    }
                }
            }
        }
コード例 #2
0
        public void mockMeasurementsExceptRoomNo(string roomNo)
        {
            RoomMeasurement a1 = new RoomMeasurement(1, 200, 25, 75, 400, "A1");
            RoomMeasurement a2 = new RoomMeasurement(2, 300, 8, 50, 300, "A2");
            RoomMeasurement a3 = new RoomMeasurement(3, 220, 23, 60, 200, "A3");
            RoomMeasurement b1 = new RoomMeasurement(4, 320, 26, 69, 210, "B1");
            RoomMeasurement b2 = new RoomMeasurement(5, 120, 24, 53, 230, "B2");
            RoomMeasurement b3 = new RoomMeasurement(6, 20, 20, 33, 225, "B3");
            RoomMeasurement b4 = new RoomMeasurement(7, 225, 16, 22, 226, "B4");

            if (!roomNo.Equals("A1"))
            {
                addRoomMeasurement(a1);
            }
            if (!roomNo.Equals("A2"))
            {
                addRoomMeasurement(a2);
            }
            if (!roomNo.Equals("A3"))
            {
                addRoomMeasurement(a3);
            }
            if (!roomNo.Equals("B1"))
            {
                addRoomMeasurement(b1);
            }
            if (!roomNo.Equals("B2"))
            {
                addRoomMeasurement(b2);
            }
            if (!roomNo.Equals("B3"))
            {
                addRoomMeasurement(b3);
            }
            if (!roomNo.Equals("B4"))
            {
                addRoomMeasurement(b4);
            }
        }
コード例 #3
0
 public void addRoomMeasurement(RoomMeasurement roomMeasurement)
 {
     Measurements.Add(roomMeasurement);
     Console.WriteLine(roomMeasurement.roomNo);
 }