} //End Load DM Data private WaterFlowData LoadWaterData(double siteLat, double siteLong, DateTime date) { WaterFlowData data = new WaterFlowData(); data.DataTypes = WaterRepository.FetchBestDataTypesForStationDate(WaterRepository.GetClosestStations(siteLat, siteLong, 1), date).FirstOrDefault(); data.chartDataValues = ""; if (data.DataTypes != null) { data.WaterDataValues = WaterRepository.FetchByDateRange(data.DataTypes.StationID, data.DataTypes.DataID, date.AddDays(-42), date); data.ParameterInfo = WaterRepository.GetParameterCodeInfoFromDataType(data.DataTypes.DataID); data.ClosestStation = WaterRepository.GetStationInfo(data.DataTypes.StationID); foreach (WaterDataValue value in data.WaterDataValues) { if (value.Value == -999999) { data.chartDataValues += "null, "; } else { data.chartDataValues += value.Value + ", "; } } // Only remove the ending comma if it was added if (data.chartDataValues.Length > 0) { data.chartDataValues = data.chartDataValues.Substring(0, data.chartDataValues.Length - 2); } } else { data.WaterDataValues = new List <WaterDataValue>(); } return(data); } //End Load DM Data
public WaterService(WaterRepository repository, IUnitWork unitWork) { _repository = repository; _unitWork = unitWork; }