public int AddReadHourly(RootWeatherDataModel <HourlyDataModel> rootWeatherDataModel, bool isStation, int?idStation, int idNode) { int rowsupdated = 0; using (IDbConnection db = new SqlConnection(_connectionString)) { foreach (var item in rootWeatherDataModel.Data) { string sql = $"IF NOT EXISTS (SELECT * FROM [dbo].[Read_Hourly] WHERE DateReading = @DateReading and IdNode = @IdNode) " + $"Insert into [dbo].[Read_Hourly] (DateReading,Temperature,Dwpt, Rhum, Prcp, Snow, Wdir, Wspd, Wpgt, Pres, Tsun, Coco, IsStation, IdNode) values (@DateReading, @Temperature, @Dwpt, @Rhum, @Prcp, @Snow, @Wdir, @Wspd, @Wpgt, @Pres, @Tsun, @Coco, @IsStation, @IdNode)"; rowsupdated = db.Execute(sql, new { DateReading = item.Time, Temperature = item.Temp, Dwpt = item.Dwpt, Rhum = item.Rhum, Prcp = item.Prcp, Snow = item.Snow, Wdir = item.WDir, Wspd = item.WSpd, Wpgt = item.WPgt, Pres = item.Pres, Tsun = item.Tsun, Coco = item.Coco, isStation = isStation, idNode = idNode }); } } return(rowsupdated); }
public int AddHourlyDataOfPointToDatabase( RootWeatherDataModel <HourlyDataModel> hourlyData, string stationName, int IdNode) { Station station = _WeatherStationRepository.GetWeatherStationFromDatabaseByStationName(stationName); return(_readHourlyRepository.AddReadHourly(hourlyData, true, station.Id_Station, IdNode)); }
public RootWeatherDataModel <HourlyDataModel> GetHourlyDataOfPoint( HourlyDataOfAPointQueryParams hourlyDataOfAPointParams, string stationName) { RootWeatherDataModel <HourlyDataModel> hourlyData = _pointData.GetHourlyDataOfPoint(hourlyDataOfAPointParams); return(hourlyData); }
public IActionResult ClimateNormalsOfAStation([FromQuery] string stationId) { RootWeatherDataModel <ClimateNormalsDataModel> data = _weatherHistoryApplication.GetClimateNormalsOfAStation(stationId); return(Ok(data)); }
public IActionResult DailyDataOfAPoint([FromQuery] DailyDataOfAPointQueryParams dailyDataOfAPointParams) { RootWeatherDataModel <DailyDataModel> data = _weatherHistoryApplication.DailyDataOfAPoint(dailyDataOfAPointParams); return(Ok(data)); }
public IActionResult DailyDataOfStation([FromQuery] DailyDataOfStationQueryParams dailyDataOfStationParams) { RootWeatherDataModel <DailyDataModel> data = _weatherHistoryApplication.GetDailyDataOfStation(dailyDataOfStationParams); return(Ok(data)); }
public IActionResult HourlyDataOfPoint([FromQuery] HourlyDataOfAPointQueryParams hourlyDataOfAPointParams) { RootWeatherDataModel <HourlyDataModel> data = _weatherHistoryApplication.GetHourlyDataOfPoint(hourlyDataOfAPointParams); return(Ok(data)); }
public IActionResult ClimateNormalsOfAPoint(float lat, float lon, int alt) { RootWeatherDataModel <ClimateNormalsOfAPointDataModel> data = _weatherHistoryApplication.ClimateNormalsOfAPoint(lat, lon, alt); return(Ok(data)); }