Очистка кода v2.0

This commit is contained in:
KharchenkoVV 2021-05-19 15:50:09 +05:00
parent e3c916bc42
commit dfdfeff32e
6 changed files with 57 additions and 51 deletions

View File

@ -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

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0090;IDE0063</NoWarn>
<NoWarn>1701;1702;IDE0090;IDE0063;IDE0066</NoWarn>
</PropertyGroup>
<ItemGroup>

View File

@ -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;
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;
}
}
}
}

View File

@ -127,18 +127,18 @@ namespace AsbCloudWebApi.Controllers
return Ok();
}
/// <summary>
/// Загрузка архива (sqlite3).
/// <example>
/// 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&lt;FileParameter&gt; { file }).Wait();
/// </example>
/// </summary>
// <param name="uid"></param>
// <param name="files"></param>
// <returns></returns>
///// <summary>
///// Загрузка архива (sqlite3).
///// <example>
///// 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&lt;FileParameter&gt; { file }).Wait();
///// </example>
///// </summary>
///// <param name="uid"></param>
///// <param name="files"></param>
///// <returns></returns>
//[HttpPost]
//[Route("{uid}/db")]
//public IActionResult PostDb(string uid, IFormFileCollection files)
@ -153,5 +153,6 @@ namespace AsbCloudWebApi.Controllers
// }
// return Ok();
//}
}
}

View File

@ -9,7 +9,7 @@ namespace ConsoleApp1
// для работы с таблицами
public class TableMapper<T>
{
Dictionary<string, PropertyHelper> props;
private readonly Dictionary<string, PropertyHelper> props;
public TableMapper()
{

View File

@ -79,32 +79,32 @@ namespace SyncDicts
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages);
}
private static bool Send<T>(string url, T obj)
{
// sending data
var requestBodyJson = JsonSerializer.Serialize(obj);
var data = Encoding.UTF8.GetBytes(requestBodyJson);
//private static bool Send<T>(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")
{