diff --git a/AsbCloud.sln b/AsbCloud.sln index 1d1809ad..3539f040 100644 --- a/AsbCloud.sln +++ b/AsbCloud.sln @@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "ConsoleApp1\ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDb", "AsbCloudDb\AsbCloudDb.csproj", "{40FBD29B-724B-4496-B5D9-1A5D14102456}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SyncDicts", "SyncDicts\SyncDicts.csproj", "{39DA5EFF-D018-45AE-B0A0-A241B488660F}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -41,10 +39,6 @@ Global {40FBD29B-724B-4496-B5D9-1A5D14102456}.Debug|Any CPU.Build.0 = Debug|Any CPU {40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.ActiveCfg = Release|Any CPU {40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.Build.0 = Release|Any CPU - {39DA5EFF-D018-45AE-B0A0-A241B488660F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39DA5EFF-D018-45AE-B0A0-A241B488660F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39DA5EFF-D018-45AE-B0A0-A241B488660F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39DA5EFF-D018-45AE-B0A0-A241B488660F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj index 4924a523..42d9a0ad 100644 --- a/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj +++ b/AsbCloudInfrastructure/AsbCloudInfrastructure.csproj @@ -5,7 +5,7 @@ - 1701;1702;IDE0090;IDE0063 + 1701;1702;IDE0090;IDE0063;IDE0066 diff --git a/AsbCloudInfrastructure/Services/ReportService.cs b/AsbCloudInfrastructure/Services/ReportService.cs index 0c36611b..f1e95e1e 100644 --- a/AsbCloudInfrastructure/Services/ReportService.cs +++ b/AsbCloudInfrastructure/Services/ReportService.cs @@ -65,14 +65,25 @@ namespace AsbCloudInfrastructure.Services private IReportGenerator GetReportGenerator(int wellId, DateTime begin, DateTime end, int stepSeconds, int format, AsbCloudDbContext context) { var dataSource = new ReportDataSourcePgCloud(context, wellId); - var generator = new PdfGenerator(dataSource); - generator.ReportDirectory = Path.Combine(RootPath, $"{wellId}"); - generator.Begin = begin; - generator.End = end; - generator.Step = TimeSpan.FromSeconds(stepSeconds); - generator.WithCharts = true; - generator.WithEvents = true; - return generator; + var generator = new PdfGenerator(dataSource) + { + ReportDirectory = Path.Combine(RootPath, $"{wellId}"), + Begin = begin, + End = end, + Step = TimeSpan.FromSeconds(stepSeconds), + WithCharts = true, + WithEvents = true + }; + + switch(format) + { + case 0: + return generator; + case 1: + return generator; + default: + return generator; + } } } } diff --git a/AsbCloudWebApi/Controllers/TelemetryController.cs b/AsbCloudWebApi/Controllers/TelemetryController.cs index e5bc24d0..fbbd82b0 100644 --- a/AsbCloudWebApi/Controllers/TelemetryController.cs +++ b/AsbCloudWebApi/Controllers/TelemetryController.cs @@ -127,18 +127,18 @@ namespace AsbCloudWebApi.Controllers return Ok(); } - /// - /// Загрузка архива (sqlite3). - /// - /// var fileName = @"C:\temp\default.sqlite3"; - /// var fileStream = System.IO.File.OpenRead(fileName); - /// var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName)); - /// cli.ApiTelemetryDbAsync("1", new List<FileParameter> { file }).Wait(); - /// - /// - // - // - // + ///// + ///// Загрузка архива (sqlite3). + ///// + ///// var fileName = @"C:\temp\default.sqlite3"; + ///// var fileStream = System.IO.File.OpenRead(fileName); + ///// var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName)); + ///// cli.ApiTelemetryDbAsync("1", new List<FileParameter> { file }).Wait(); + ///// + ///// + ///// + ///// + ///// //[HttpPost] //[Route("{uid}/db")] //public IActionResult PostDb(string uid, IFormFileCollection files) @@ -153,5 +153,6 @@ namespace AsbCloudWebApi.Controllers // } // return Ok(); //} + } } diff --git a/ConsoleApp1/TableMapper.cs b/ConsoleApp1/TableMapper.cs index fd6377c3..51ee517f 100644 --- a/ConsoleApp1/TableMapper.cs +++ b/ConsoleApp1/TableMapper.cs @@ -9,7 +9,7 @@ namespace ConsoleApp1 // для работы с таблицами public class TableMapper { - Dictionary props; + private readonly Dictionary props; public TableMapper() { diff --git a/SyncDicts/Program.cs b/SyncDicts/Program.cs index f0e0e9dc..3410f1c8 100644 --- a/SyncDicts/Program.cs +++ b/SyncDicts/Program.cs @@ -79,32 +79,32 @@ namespace SyncDicts //res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages); } - private static bool Send(string url, T obj) - { - // sending data - var requestBodyJson = JsonSerializer.Serialize(obj); - var data = Encoding.UTF8.GetBytes(requestBodyJson); + //private static bool Send(string url, T obj) + //{ + // // sending data + // var requestBodyJson = JsonSerializer.Serialize(obj); + // var data = Encoding.UTF8.GetBytes(requestBodyJson); - var request = MakeRequest(url); - using var streamWriter = request.GetRequestStream(); - streamWriter.Write(data); - streamWriter.Close(); + // var request = MakeRequest(url); + // using var streamWriter = request.GetRequestStream(); + // streamWriter.Write(data); + // streamWriter.Close(); - // getting response - if (request.GetResponse() is not HttpWebResponse response) - {//FAILED - return false; - } + // // getting response + // if (request.GetResponse() is not HttpWebResponse response) + // {//FAILED + // return false; + // } - if (response.StatusCode == HttpStatusCode.OK) - {// sent succesfilly - return true; - } - else - {//failed - return false; - } - } + // if (response.StatusCode == HttpStatusCode.OK) + // {// sent succesfilly + // return true; + // } + // else + // {//failed + // return false; + // } + //} private static HttpWebRequest MakeRequest(string url, string contentType = "application/json") {