コード例 #1
0
ファイル: Database.cs プロジェクト: ckaczor/HomeMonitor
        public async Task <IEnumerable <WeatherValueGrouped> > GetReadingValueHistoryGrouped(WeatherValueType weatherValueType, DateTimeOffset start, DateTimeOffset end, int bucketMinutes)
        {
            await using var connection = CreateConnection();

            var query = ResourceReader.GetString("ChrisKaczor.HomeMonitor.Weather.Service.Data.Resources.GetReadingValueHistoryGrouped.sql");

            query = query.Replace("@Value", weatherValueType.ToString());

            return(await connection.QueryAsync <WeatherValueGrouped>(query, new { Start = start, End = end, BucketMinutes = bucketMinutes }));
        }
コード例 #2
0
ファイル: Database.cs プロジェクト: ckaczor/HomeMonitor
        public async Task <decimal> GetReadingValueSum(WeatherValueType weatherValueType, DateTimeOffset start, DateTimeOffset end)
        {
            await using var connection = CreateConnection();

            var query = ResourceReader.GetString("ChrisKaczor.HomeMonitor.Weather.Service.Data.Resources.GetReadingValueSum.sql");

            query = query.Replace("@Value", weatherValueType.ToString());

            return(await connection.ExecuteScalarAsync <decimal>(query, new { Start = start, End = end }));
        }