Очистка кода 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 EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDb", "AsbCloudDb\AsbCloudDb.csproj", "{40FBD29B-724B-4496-B5D9-1A5D14102456}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDb", "AsbCloudDb\AsbCloudDb.csproj", "{40FBD29B-724B-4496-B5D9-1A5D14102456}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SyncDicts", "SyncDicts\SyncDicts.csproj", "{39DA5EFF-D018-45AE-B0A0-A241B488660F}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU 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}.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.ActiveCfg = Release|Any CPU
{40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.Build.0 = 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 EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -5,7 +5,7 @@
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<NoWarn>1701;1702;IDE0090;IDE0063</NoWarn> <NoWarn>1701;1702;IDE0090;IDE0063;IDE0066</NoWarn>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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) private IReportGenerator GetReportGenerator(int wellId, DateTime begin, DateTime end, int stepSeconds, int format, AsbCloudDbContext context)
{ {
var dataSource = new ReportDataSourcePgCloud(context, wellId); var dataSource = new ReportDataSourcePgCloud(context, wellId);
var generator = new PdfGenerator(dataSource); var generator = new PdfGenerator(dataSource)
generator.ReportDirectory = Path.Combine(RootPath, $"{wellId}"); {
generator.Begin = begin; ReportDirectory = Path.Combine(RootPath, $"{wellId}"),
generator.End = end; Begin = begin,
generator.Step = TimeSpan.FromSeconds(stepSeconds); End = end,
generator.WithCharts = true; Step = TimeSpan.FromSeconds(stepSeconds),
generator.WithEvents = true; WithCharts = true,
return generator; 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(); return Ok();
} }
/// <summary> ///// <summary>
/// Загрузка архива (sqlite3). ///// Загрузка архива (sqlite3).
/// <example> ///// <example>
/// var fileName = @"C:\temp\default.sqlite3"; ///// var fileName = @"C:\temp\default.sqlite3";
/// var fileStream = System.IO.File.OpenRead(fileName); ///// var fileStream = System.IO.File.OpenRead(fileName);
/// var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName)); ///// var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName));
/// cli.ApiTelemetryDbAsync("1", new List&lt;FileParameter&gt; { file }).Wait(); ///// cli.ApiTelemetryDbAsync("1", new List&lt;FileParameter&gt; { file }).Wait();
/// </example> ///// </example>
/// </summary> ///// </summary>
// <param name="uid"></param> ///// <param name="uid"></param>
// <param name="files"></param> ///// <param name="files"></param>
// <returns></returns> ///// <returns></returns>
//[HttpPost] //[HttpPost]
//[Route("{uid}/db")] //[Route("{uid}/db")]
//public IActionResult PostDb(string uid, IFormFileCollection files) //public IActionResult PostDb(string uid, IFormFileCollection files)
@ -153,5 +153,6 @@ namespace AsbCloudWebApi.Controllers
// } // }
// return Ok(); // return Ok();
//} //}
} }
} }

View File

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

View File

@ -79,32 +79,32 @@ namespace SyncDicts
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages); //res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages);
} }
private static bool Send<T>(string url, T obj) //private static bool Send<T>(string url, T obj)
{ //{
// sending data // // sending data
var requestBodyJson = JsonSerializer.Serialize(obj); // var requestBodyJson = JsonSerializer.Serialize(obj);
var data = Encoding.UTF8.GetBytes(requestBodyJson); // var data = Encoding.UTF8.GetBytes(requestBodyJson);
var request = MakeRequest(url); // var request = MakeRequest(url);
using var streamWriter = request.GetRequestStream(); // using var streamWriter = request.GetRequestStream();
streamWriter.Write(data); // streamWriter.Write(data);
streamWriter.Close(); // streamWriter.Close();
// getting response // // getting response
if (request.GetResponse() is not HttpWebResponse response) // if (request.GetResponse() is not HttpWebResponse response)
{//FAILED // {//FAILED
return false; // return false;
} // }
if (response.StatusCode == HttpStatusCode.OK) // if (response.StatusCode == HttpStatusCode.OK)
{// sent succesfilly // {// sent succesfilly
return true; // return true;
} // }
else // else
{//failed // {//failed
return false; // return false;
} // }
} //}
private static HttpWebRequest MakeRequest(string url, string contentType = "application/json") private static HttpWebRequest MakeRequest(string url, string contentType = "application/json")
{ {