/// <summary> /// Adds the item to system data collections. /// </summary> /// <param name="type">The type.</param> /// <param name="ariName">Name of the ari.</param> /// <param name="ariType">Type of the ari.</param> /// <param name="ariValue">The ari value.</param> /// <param name="temperatureF">The farenhait temperature.</param> /// <param name="temperatureC">The celsius temperature.</param> private void AddItemToSystemDataCollections(string type, string ariName, string ariType, string ariValue, double temperatureF = 0, double temperatureC = 0) { if (ariType.ToLower().Contains("temperature") || ariType.ToLower().Contains("fan")) { var minValue = "0"; var maxValue = "0"; if (ariType.ToLower().Contains("temperature")) { if (ariName.ToLower().Contains("temperature #")) { Console.WriteLine(ariName); } var temperatureRepository = new TemperatureRepository(); temperatureRepository.Add(ariName, temperatureF, temperatureC); var maxAverageTemperature = temperatureRepository.GetMaxTemperature(ariName); var minAverageTemperature = temperatureRepository.GetMinTemperature(ariName); maxValue = $"{maxAverageTemperature.ValueC} ({maxAverageTemperature.ValueF} F)"; minValue = $"{minAverageTemperature.ValueC} ({minAverageTemperature.ValueF} F)"; } _systemDataCollections[type].Add(new SystemDataItem { Name = ariName, Type = ariType, Value = ariValue, MinValue = minValue, MaxValue = maxValue }); } }
public TemperatureInfo GetTemperatureInfo(string sessionId, int deviceId) { if (!userRepository.CanManageAverageTemperatures(sessionId)) { return(null); } TemperatureInfo info = new TemperatureInfo(); info.Max = temperatureRepository.GetMaxTemperature(deviceId); info.Min = temperatureRepository.GetMinTemperature(deviceId); info.Average = temperatureRepository.GetAverageTemperature(deviceId); return(info); }