diff --git a/AsbCloud.sln b/AsbCloud.sln index 744cfbd1..7cd3f161 100644 --- a/AsbCloud.sln +++ b/AsbCloud.sln @@ -17,7 +17,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataTable", "DataTable\Data EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudWebApi.Tests", "AsbCloudWebApi.Tests\AsbCloudWebApi.Tests.csproj", "{9CF6FBB1-9AF5-45AB-A521-24F11A79B540}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsbCloudDbDemoData", "AsbCloudDbDemoData\AsbCloudDbDemoData.csproj", "{1208822E-9099-4D13-B72F-8721E5758577}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDevOperations", "AsbCloudDbDemoData\AsbCloudDevOperations.csproj", "{1208822E-9099-4D13-B72F-8721E5758577}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/AsbCloudDbDemoData/AsbCloudDbDemoData.csproj b/AsbCloudDbDemoData/AsbCloudDevOperations.csproj similarity index 79% rename from AsbCloudDbDemoData/AsbCloudDbDemoData.csproj rename to AsbCloudDbDemoData/AsbCloudDevOperations.csproj index 600d1b95..3c984937 100644 --- a/AsbCloudDbDemoData/AsbCloudDbDemoData.csproj +++ b/AsbCloudDbDemoData/AsbCloudDevOperations.csproj @@ -6,6 +6,7 @@ + diff --git a/AsbCloudDbDemoData/ControllerLoadTester.cs b/AsbCloudDbDemoData/ControllerLoadTester.cs new file mode 100644 index 00000000..7799667f --- /dev/null +++ b/AsbCloudDbDemoData/ControllerLoadTester.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using System.Text; +using System.Text.Json; +using AsbCloudApp.Data; + +namespace AsbCloudDbDemoData +{ + public class ControllerLoadTester + { + private readonly HttpClient client = new(); + + public void TestControllerRoute(string route, CancellationToken token = default) + { + var host = "http://localhost:5000"; + + var json = JsonSerializer.Serialize(new List()); + + var stringContent = new StringContent(json, Encoding.UTF8, "application/json"); + + Console.WriteLine("Start"); + + var tasks = new Task[100]; + + for (var i = 0; i < 100; i++) + { + var res = client.PostAsync(new Uri($"{host}/{route}{i}"), + stringContent, token); + + tasks[i] = res; + }; + + Task.WaitAll(tasks, token); + + Console.WriteLine("End"); + } + } +} diff --git a/AsbCloudDbDemoData/DbDemoDataFiller.cs b/AsbCloudDbDemoData/DbDemoDataFiller.cs new file mode 100644 index 00000000..e0320cbe --- /dev/null +++ b/AsbCloudDbDemoData/DbDemoDataFiller.cs @@ -0,0 +1,308 @@ +using AsbCloudDb.Model; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; + +namespace AsbCloudDbDemoData +{ + public static class DbDemoDataFiller + { + public static void AddDemoData() + { + Console.WriteLine("Заполнить БД тестовыми данными? y/n"); + string result = Console.ReadLine(); + + if (result != "y") + { + Console.WriteLine("Хорошо, в другой раз."); + return; + } + + try + { + var options = new DbContextOptionsBuilder() + .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True") + .Options; + using var demoContext = new AsbCloudDbContext(options); + + demoContext.Deposits.Add(new Deposit { Id = 1, Caption = "м/р 1", Latitude = 60.8705722222222, Longitude = 70.3811888888889 }); + + demoContext.Clusters.AddRange( + new Cluster { Id = 1, Caption = "к39.1", IdDeposit = 1, Latitude = 60.8705722222222, Longitude = 70.3811888888889 }, + new Cluster { Id = 2, Caption = "к151", IdDeposit = 1, Latitude = 60.8205750000000, Longitude = 70.1343833333334 }, + new Cluster { Id = 3, Caption = "к611", IdDeposit = 1, Latitude = 60.8100666666667, Longitude = 69.7778388888889 }, + new Cluster { Id = 4, Caption = "к203", IdDeposit = 1, Latitude = 60.8928805555556, Longitude = 70.3272055555556 }, + new Cluster { Id = 5, Caption = "к221", IdDeposit = 1, Latitude = 60.6672055555556, Longitude = 69.6603861111111 } + ); + + demoContext.Measures.AddRange( + new Measure { Id = 1, IdCategory = 1, IdWell = 1, Timestamp = DateTime.Now.AddHours(1), Data = new Dictionary { { "a", 1 } } }, + new Measure { Id = 2, IdCategory = 1, IdWell = 1, Timestamp = DateTime.Now.AddHours(2), Data = new Dictionary { { "a", 2 } } }, + new Measure { Id = 3, IdCategory = 2, IdWell = 1, Timestamp = DateTime.Now.AddHours(3), Data = new Dictionary { { "a", 3 } } } + ); + + demoContext.Telemetries.Add( + new Telemetry + { + Id = 1, + RemoteUid = "123", + Info = new TelemetryInfo + { + Well = "1", + Cluster = "1", + Comment = "", + Deposit = "1", + Customer = "1", + HmiVersion = "1", + PlcVersion = "1", + TimeZoneId = "1", + DrillingStartDate = DateTime.Parse("2021-06-29T12:01:19.000000"), + TimeZoneOffsetTotalHours = 5.0 + }, + } + ); + + demoContext.Wells.AddRange( + new Well { Id = 1, IdCluster = 1, IdWellType = 1, Caption = "скв 16314", Latitude = 60.8705722222222, Longitude = 70.3811888888889, IdTelemetry = 1, }, + new Well { Id = 2, IdCluster = 1, IdWellType = 2, Caption = "скв 16311", Latitude = 60.8705722222222, Longitude = 70.3811888888889 }, + new Well { Id = 3, IdCluster = 2, IdWellType = 1, Caption = "скв 16315", Latitude = 60.8205750000000, Longitude = 70.1343833333334 }, + new Well { Id = 4, IdCluster = 2, IdWellType = 1, Caption = "скв 16318", Latitude = 60.8205750000000, Longitude = 70.1343833333334 }, + new Well { Id = 5, IdCluster = 3, IdWellType = 1, Caption = "скв 16310", Latitude = 60.8100666666667, Longitude = 69.7778388888889 }, + new Well { Id = 6, IdCluster = 4, IdWellType = 1, Caption = "скв 16316", Latitude = 60.8928805555556, Longitude = 70.3272055555556 }, + new Well { Id = 7, IdCluster = 5, IdWellType = 1, Caption = "скв 16312", Latitude = 60.6672055555556, Longitude = 69.6603861111111 }, + new Well { Id = 8, IdCluster = 5, IdWellType = 1, Caption = "скв 16313", Latitude = 60.6672055555556, Longitude = 69.6603861111111 }, + new Well { Id = 9, IdCluster = 5, IdWellType = 1, Caption = "скв 42669", Latitude = 60.6672055555556, Longitude = 69.6603861111111 } + ); + + demoContext.AddRange( + new RelationCompanyWell { IdWell = 1, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 2, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 3, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 4, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 5, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 6, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 7, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 8, IdCompany = 1 }, + new RelationCompanyWell { IdWell = 9, IdCompany = 1 } + ); + + demoContext.WellOperations.AddRange( + new WellOperation { Id = 64049, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5 }, + new WellOperation { Id = 31502, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 1.16666666666667 }, + new WellOperation { Id = 1531, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 44572, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5 }, + new WellOperation { Id = 44514, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5 }, + new WellOperation { Id = 53383, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 3431, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5 }, + new WellOperation { Id = 21460, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5 }, + new WellOperation { Id = 30464, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5 }, + new WellOperation { Id = 73111, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5 }, + new WellOperation { Id = 81351, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5 }, + new WellOperation { Id = 24480, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5 }, + new WellOperation { Id = 19101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5 }, + new WellOperation { Id = 34738, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5 }, + new WellOperation { Id = 37606, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 71293, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5 }, + new WellOperation { Id = 91696, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5 }, + new WellOperation { Id = 77916, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5 }, + new WellOperation { Id = 93585, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 42016, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 90466, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5 }, + new WellOperation { Id = 15914, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5 }, + new WellOperation { Id = 63469, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 23659, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5 }, + new WellOperation { Id = 93508, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5 }, + new WellOperation { Id = 74346, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 3139, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5 }, + new WellOperation { Id = 11429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 14542, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5 }, + new WellOperation { Id = 70906, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 82194, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5 }, + new WellOperation { Id = 13578, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5 }, + new WellOperation { Id = 57798, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5 }, + new WellOperation { Id = 37277, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5 }, + new WellOperation { Id = 23233, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5 }, + new WellOperation { Id = 26075, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 8230, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5 }, + new WellOperation { Id = 26414, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5 }, + new WellOperation { Id = 92747, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5 }, + new WellOperation { Id = 89559, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5 }, + new WellOperation { Id = 99336, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5 }, + new WellOperation { Id = 80943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5 }, + new WellOperation { Id = 11934, IdWell = 1, IdWellSectionType = 1, IdCategory = 1006, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 2.33333333333333 }, + new WellOperation { Id = 88089, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5 }, + new WellOperation { Id = 57116, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5 }, + new WellOperation { Id = 57561, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 72783, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5 }, + new WellOperation { Id = 75549, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 60717, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 21171, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 13547, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 83361, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 58676, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 46864, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5 }, + new WellOperation { Id = 95276, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5 }, + new WellOperation { Id = 33478, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5 }, + new WellOperation { Id = 85086, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5 }, + new WellOperation { Id = 38808, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5 }, + new WellOperation { Id = 60045, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 82773, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 38025, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5 }, + new WellOperation { Id = 8312, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5 }, + new WellOperation { Id = 84440, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5 }, + new WellOperation { Id = 78963, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5 }, + new WellOperation { Id = 39690, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 88719, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 64890, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5 }, + new WellOperation { Id = 95476, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5 }, + new WellOperation { Id = 78257, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, + new WellOperation { Id = 41260, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5 }, + new WellOperation { Id = 41055, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 47051, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5 }, + new WellOperation { Id = 14068, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5 }, + new WellOperation { Id = 96039, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 34668, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 43146, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 15263, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, + new WellOperation { Id = 20802, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 81320, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, + new WellOperation { Id = 43902, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, + new WellOperation { Id = 62958, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, + new WellOperation { Id = 74174, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, + new WellOperation { Id = 76347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5 }, + new WellOperation { Id = 51329, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, + new WellOperation { Id = 76341, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5 } + ); + + demoContext.TelemetryAnalysis.AddRange( + new TelemetryAnalysis + { + Id = 1, + IdTelemetry = 1, + IdOperation = 17, + UnixDate = 1626870355, + DurationSec = 10, + OperationStartDepth = null, + OperationEndDepth = 206, + IsWellDepthIncreasing = false, + IsWellDepthDecreasing = false, + IsBitPositionIncreasing = false, + IsBitPositionDecreasing = false, + IsBitPositionLt20 = true, + IsBlockPositionIncreasing = false, + IsBlockPositionDecreasing = false, + IsRotorSpeedLt3 = true, + IsRotorSpeedGt3 = false, + IsPressureLt20 = true, + IsPressureGt20 = false, + IsHookWeightNotChanges = true, + IsHookWeightLt3 = true + }, + new TelemetryAnalysis + { + Id = 2, + IdTelemetry = 1, + IdOperation = 8, + UnixDate = 1626870364, + DurationSec = 6, + OperationStartDepth = 206, + OperationEndDepth = 206, + IsWellDepthIncreasing = false, + IsWellDepthDecreasing = false, + IsBitPositionIncreasing = true, + IsBitPositionDecreasing = false, + IsBitPositionLt20 = true, + IsBlockPositionIncreasing = true, + IsBlockPositionDecreasing = false, + IsRotorSpeedLt3 = true, + IsRotorSpeedGt3 = false, + IsPressureLt20 = true, + IsPressureGt20 = false, + IsHookWeightNotChanges = true, + IsHookWeightLt3 = true + }, + new TelemetryAnalysis + { + Id = 3, + IdTelemetry = 1, + IdOperation = 10, + UnixDate = 1626870370, + DurationSec = 2, + OperationStartDepth = 206, + OperationEndDepth = 206, + IsWellDepthIncreasing = false, + IsWellDepthDecreasing = false, + IsBitPositionIncreasing = false, + IsBitPositionDecreasing = true, + IsBitPositionLt20 = true, + IsBlockPositionIncreasing = false, + IsBlockPositionDecreasing = true, + IsRotorSpeedLt3 = true, + IsRotorSpeedGt3 = false, + IsPressureLt20 = true, + IsPressureGt20 = false, + IsHookWeightNotChanges = true, + IsHookWeightLt3 = true + }, + new TelemetryAnalysis + { + Id = 4, + IdTelemetry = 1, + IdOperation = 17, + UnixDate = 1626870372, + DurationSec = 7, + OperationStartDepth = 206, + OperationEndDepth = 206, + IsWellDepthIncreasing = false, + IsWellDepthDecreasing = false, + IsBitPositionIncreasing = false, + IsBitPositionDecreasing = false, + IsBitPositionLt20 = true, + IsBlockPositionIncreasing = false, + IsBlockPositionDecreasing = false, + IsRotorSpeedLt3 = true, + IsRotorSpeedGt3 = false, + IsPressureLt20 = true, + IsPressureGt20 = false, + IsHookWeightNotChanges = true, + IsHookWeightLt3 = true + }, + new TelemetryAnalysis + { + Id = 5, + IdTelemetry = 1, + IdOperation = 8, + UnixDate = 1626870379, + DurationSec = 7, + OperationStartDepth = 206, + OperationEndDepth = 206, + IsWellDepthIncreasing = false, + IsWellDepthDecreasing = false, + IsBitPositionIncreasing = true, + IsBitPositionDecreasing = false, + IsBitPositionLt20 = true, + IsBlockPositionIncreasing = true, + IsBlockPositionDecreasing = false, + IsRotorSpeedLt3 = true, + IsRotorSpeedGt3 = false, + IsPressureLt20 = true, + IsPressureGt20 = false, + IsHookWeightNotChanges = true, + IsHookWeightLt3 = true + } + ); + + int res = demoContext.SaveChanges(); + + if (res > 0) + Console.WriteLine("Даннные добавлены"); + else + Console.WriteLine("Ошибка при добавлении данных"); + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); + } + } + } +} diff --git a/AsbCloudDbDemoData/Program.cs b/AsbCloudDbDemoData/Program.cs index 33f07197..98bd3a87 100644 --- a/AsbCloudDbDemoData/Program.cs +++ b/AsbCloudDbDemoData/Program.cs @@ -1,6 +1,7 @@ using AsbCloudDb.Model; using Microsoft.EntityFrameworkCore; using System; +using System.Threading.Tasks; using System.Collections.Generic; namespace AsbCloudDbDemoData @@ -9,300 +10,13 @@ namespace AsbCloudDbDemoData { static void Main(string[] args) { - Console.WriteLine("Заполнить БД тестовыми данными? y/n"); - string result = Console.ReadLine(); + var controllerTester = new ControllerLoadTester(); - if (result != "y") - { - Console.WriteLine("Хорошо, в другой раз."); - return; - } + controllerTester.TestControllerRoute("api/telemetryDataSaub/123123_"); + //.GetAwaiter().GetResult(); - try - { - var options = new DbContextOptionsBuilder() - .UseNpgsql("Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True") - .Options; - using var demoContext = new AsbCloudDbContext(options); - - demoContext.Deposits.Add(new Deposit { Id = 1, Caption = "м/р 1", Latitude = 60.8705722222222, Longitude = 70.3811888888889 }); - - demoContext.Clusters.AddRange( - new Cluster { Id = 1, Caption = "к39.1", IdDeposit = 1, Latitude = 60.8705722222222, Longitude = 70.3811888888889 }, - new Cluster { Id = 2, Caption = "к151", IdDeposit = 1, Latitude = 60.8205750000000, Longitude = 70.1343833333334 }, - new Cluster { Id = 3, Caption = "к611", IdDeposit = 1, Latitude = 60.8100666666667, Longitude = 69.7778388888889 }, - new Cluster { Id = 4, Caption = "к203", IdDeposit = 1, Latitude = 60.8928805555556, Longitude = 70.3272055555556 }, - new Cluster { Id = 5, Caption = "к221", IdDeposit = 1, Latitude = 60.6672055555556, Longitude = 69.6603861111111 } - ); - - demoContext.Measures.AddRange( - new Measure { Id = 1, IdCategory = 1, IdWell = 1, Timestamp = DateTime.Now.AddHours(1), Data = new Dictionary { { "a", 1 } } }, - new Measure { Id = 2, IdCategory = 1, IdWell = 1, Timestamp = DateTime.Now.AddHours(2), Data = new Dictionary { { "a", 2 } } }, - new Measure { Id = 3, IdCategory = 2, IdWell = 1, Timestamp = DateTime.Now.AddHours(3), Data = new Dictionary { { "a", 3 } } } - ); - - demoContext.Telemetries.Add( - new Telemetry - { - Id = 1, - RemoteUid = "123", - Info = new TelemetryInfo - { - Well = "1", - Cluster = "1", - Comment = "", - Deposit = "1", - Customer = "1", - HmiVersion = "1", - PlcVersion = "1", - TimeZoneId = "1", - DrillingStartDate = DateTime.Parse("2021-06-29T12:01:19.000000"), - TimeZoneOffsetTotalHours = 5.0 - }, - } - ); - - demoContext.Wells.AddRange( - new Well { Id = 1, IdCluster = 1, IdWellType = 1, Caption = "скв 16314", Latitude = 60.8705722222222, Longitude = 70.3811888888889, IdTelemetry = 1, }, - new Well { Id = 2, IdCluster = 1, IdWellType = 2, Caption = "скв 16311", Latitude = 60.8705722222222, Longitude = 70.3811888888889 }, - new Well { Id = 3, IdCluster = 2, IdWellType = 1, Caption = "скв 16315", Latitude = 60.8205750000000, Longitude = 70.1343833333334 }, - new Well { Id = 4, IdCluster = 2, IdWellType = 1, Caption = "скв 16318", Latitude = 60.8205750000000, Longitude = 70.1343833333334 }, - new Well { Id = 5, IdCluster = 3, IdWellType = 1, Caption = "скв 16310", Latitude = 60.8100666666667, Longitude = 69.7778388888889 }, - new Well { Id = 6, IdCluster = 4, IdWellType = 1, Caption = "скв 16316", Latitude = 60.8928805555556, Longitude = 70.3272055555556 }, - new Well { Id = 7, IdCluster = 5, IdWellType = 1, Caption = "скв 16312", Latitude = 60.6672055555556, Longitude = 69.6603861111111 }, - new Well { Id = 8, IdCluster = 5, IdWellType = 1, Caption = "скв 16313", Latitude = 60.6672055555556, Longitude = 69.6603861111111 }, - new Well { Id = 9, IdCluster = 5, IdWellType = 1, Caption = "скв 42669", Latitude = 60.6672055555556, Longitude = 69.6603861111111 } - ); - - demoContext.AddRange( - new RelationCompanyWell { IdWell = 1, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 2, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 3, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 4, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 5, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 6, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 7, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 8, IdCompany = 1 }, - new RelationCompanyWell { IdWell = 9, IdCompany = 1 } - ); - - demoContext.WellOperations.AddRange( - new WellOperation { Id = 64049, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 15:30"), DurationHours = 3.5 }, - new WellOperation { Id = 31502, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 1.16666666666667 }, - new WellOperation { Id = 1531, IdWell = 5, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 44572, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 05:00"), DurationHours = 3.5 }, - new WellOperation { Id = 44514, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 19:00"), DurationHours = 3.5 }, - new WellOperation { Id = 53383, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 3431, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 15:40"), DurationHours = 3.5 }, - new WellOperation { Id = 21460, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 01:10"), DurationHours = 3.5 }, - new WellOperation { Id = 30464, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 12:30"), DurationHours = 3.5 }, - new WellOperation { Id = 73111, IdWell = 1, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 13:00"), DurationHours = 3.5 }, - new WellOperation { Id = 81351, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 05:10"), DurationHours = 3.5 }, - new WellOperation { Id = 24480, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-02 22:30"), DurationHours = 3.5 }, - new WellOperation { Id = 19101, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 21:30"), DurationHours = 3.5 }, - new WellOperation { Id = 34738, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 02:30"), DurationHours = 3.5 }, - new WellOperation { Id = 37606, IdWell = 5, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 71293, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 22:40"), DurationHours = 3.5 }, - new WellOperation { Id = 91696, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 18:30"), DurationHours = 3.5 }, - new WellOperation { Id = 77916, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 11:00"), DurationHours = 3.5 }, - new WellOperation { Id = 93585, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 42016, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 90466, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 09:10"), DurationHours = 3.5 }, - new WellOperation { Id = 15914, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-27 01:30"), DurationHours = 3.5 }, - new WellOperation { Id = 63469, IdWell = 4, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 23659, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-04 06:00"), DurationHours = 3.5 }, - new WellOperation { Id = 93508, IdWell = 1, IdWellSectionType = 2, IdCategory = 1027, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 23:00"), DurationHours = 3.5 }, - new WellOperation { Id = 74346, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 3139, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-24 22:10"), DurationHours = 3.5 }, - new WellOperation { Id = 11429, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 14542, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 21:00"), DurationHours = 3.5 }, - new WellOperation { Id = 70906, IdWell = 4, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 82194, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 02:00"), DurationHours = 3.5 }, - new WellOperation { Id = 13578, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 08:00"), DurationHours = 3.5 }, - new WellOperation { Id = 57798, IdWell = 1, IdWellSectionType = 1, IdCategory = 1033, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 14:30"), DurationHours = 3.5 }, - new WellOperation { Id = 37277, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-25 00:30"), DurationHours = 3.5 }, - new WellOperation { Id = 23233, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 07:30"), DurationHours = 3.5 }, - new WellOperation { Id = 26075, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 8230, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-26 12:40"), DurationHours = 3.5 }, - new WellOperation { Id = 26414, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 15:00"), DurationHours = 3.5 }, - new WellOperation { Id = 92747, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 22:00"), DurationHours = 3.5 }, - new WellOperation { Id = 89559, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-25 19:10"), DurationHours = 3.5 }, - new WellOperation { Id = 99336, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 3.5 }, - new WellOperation { Id = 80943, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 04:00"), DurationHours = 3.5 }, - new WellOperation { Id = 11934, IdWell = 1, IdWellSectionType = 1, IdCategory = 1006, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 08:10"), DurationHours = 2.33333333333333 }, - new WellOperation { Id = 88089, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 11:40"), DurationHours = 3.5 }, - new WellOperation { Id = 57116, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-25 18:00"), DurationHours = 3.5 }, - new WellOperation { Id = 57561, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 72783, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1110, StartDate = DateTime.Parse("2021-08-25 01:40"), DurationHours = 3.5 }, - new WellOperation { Id = 75549, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 60717, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 21171, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 13547, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 83361, IdWell = 5, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 58676, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 46864, IdWell = 1, IdWellSectionType = 2, IdCategory = 1025, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 16:00"), DurationHours = 3.5 }, - new WellOperation { Id = 95276, IdWell = 1, IdWellSectionType = 1, IdCategory = 1027, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 18:40"), DurationHours = 3.5 }, - new WellOperation { Id = 33478, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 3.5 }, - new WellOperation { Id = 85086, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-04 09:30"), DurationHours = 3.5 }, - new WellOperation { Id = 38808, IdWell = 1, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 05:30"), DurationHours = 3.5 }, - new WellOperation { Id = 60045, IdWell = 5, IdWellSectionType = 2, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 82773, IdWell = 2, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 38025, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 08:40"), DurationHours = 3.5 }, - new WellOperation { Id = 8312, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 02:10"), DurationHours = 3.5 }, - new WellOperation { Id = 84440, IdWell = 1, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1400, StartDate = DateTime.Parse("2021-09-03 19:30"), DurationHours = 3.5 }, - new WellOperation { Id = 78963, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-26 05:40"), DurationHours = 3.5 }, - new WellOperation { Id = 39690, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 88719, IdWell = 2, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 64890, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 15:10"), DurationHours = 3.5 }, - new WellOperation { Id = 95476, IdWell = 1, IdWellSectionType = 1, IdCategory = 1025, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 04:30"), DurationHours = 3.5 }, - new WellOperation { Id = 78257, IdWell = 4, IdWellSectionType = 2, IdCategory = 1027, IdType = 0, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 07:00"), DurationHours = 3.5 }, - new WellOperation { Id = 41260, IdWell = 1, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1500, StartDate = DateTime.Parse("2021-09-03 09:00"), DurationHours = 3.5 }, - new WellOperation { Id = 41055, IdWell = 5, IdWellSectionType = 2, IdCategory = 1047, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 47051, IdWell = 1, IdWellSectionType = 1, IdCategory = 1046, IdType = 1, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 04:40"), DurationHours = 3.5 }, - new WellOperation { Id = 14068, IdWell = 1, IdWellSectionType = 1, IdCategory = 1045, IdType = 1, WellDepth = 1300, StartDate = DateTime.Parse("2021-08-25 12:10"), DurationHours = 3.5 }, - new WellOperation { Id = 96039, IdWell = 4, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 34668, IdWell = 1, IdWellSectionType = 1, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 43146, IdWell = 2, IdWellSectionType = 2, IdCategory = 1026, IdType = 1, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 15263, IdWell = 2, IdWellSectionType = 2, IdCategory = 1046, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 03:30"), DurationHours = 3.5 }, - new WellOperation { Id = 20802, IdWell = 2, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 81320, IdWell = 4, IdWellSectionType = 2, IdCategory = 1001, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 14:00"), DurationHours = 3.5 }, - new WellOperation { Id = 43902, IdWell = 2, IdWellSectionType = 2, IdCategory = 1047, IdType = 0, WellDepth = 1100, StartDate = DateTime.Parse("2021-08-24 17:30"), DurationHours = 15 }, - new WellOperation { Id = 62958, IdWell = 4, IdWellSectionType = 2, IdCategory = 1025, IdType = 0, WellDepth = 1000, StartDate = DateTime.Parse("2021-08-24 00:00"), DurationHours = 3.5 }, - new WellOperation { Id = 74174, IdWell = 5, IdWellSectionType = 2, IdCategory = 1046, IdType = 1, WellDepth = 800, StartDate = DateTime.Parse("2021-08-24 10:30"), DurationHours = 3.5 }, - new WellOperation { Id = 76347, IdWell = 1, IdWellSectionType = 1, IdCategory = 1048, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 01:00"), DurationHours = 3.5 }, - new WellOperation { Id = 51329, IdWell = 1, IdWellSectionType = 1, IdCategory = 1026, IdType = 0, WellDepth = 1400, StartDate = DateTime.Parse("2021-08-27 08:30"), DurationHours = 3.5 }, - new WellOperation { Id = 76341, IdWell = 1, IdWellSectionType = 1, IdCategory = 1047, IdType = 0, WellDepth = 1250, StartDate = DateTime.Parse("2021-08-26 11:30"), DurationHours = 3.5 } - ); - - demoContext.TelemetryAnalysis.AddRange( - new TelemetryAnalysis - { - Id = 1, - IdTelemetry = 1, - IdOperation = 17, - UnixDate = 1626870355, - DurationSec = 10, - OperationStartDepth = null, - OperationEndDepth = 206, - IsWellDepthIncreasing = false, - IsWellDepthDecreasing = false, - IsBitPositionIncreasing = false, - IsBitPositionDecreasing = false, - IsBitPositionLt20 = true, - IsBlockPositionIncreasing = false, - IsBlockPositionDecreasing = false, - IsRotorSpeedLt3 = true, - IsRotorSpeedGt3 = false, - IsPressureLt20 = true, - IsPressureGt20 = false, - IsHookWeightNotChanges = true, - IsHookWeightLt3 = true - }, - new TelemetryAnalysis - { - Id = 2, - IdTelemetry = 1, - IdOperation = 8, - UnixDate = 1626870364, - DurationSec = 6, - OperationStartDepth = 206, - OperationEndDepth = 206, - IsWellDepthIncreasing = false, - IsWellDepthDecreasing = false, - IsBitPositionIncreasing = true, - IsBitPositionDecreasing = false, - IsBitPositionLt20 = true, - IsBlockPositionIncreasing = true, - IsBlockPositionDecreasing = false, - IsRotorSpeedLt3 = true, - IsRotorSpeedGt3 = false, - IsPressureLt20 = true, - IsPressureGt20 = false, - IsHookWeightNotChanges = true, - IsHookWeightLt3 = true - }, - new TelemetryAnalysis - { - Id = 3, - IdTelemetry = 1, - IdOperation = 10, - UnixDate = 1626870370, - DurationSec = 2, - OperationStartDepth = 206, - OperationEndDepth = 206, - IsWellDepthIncreasing = false, - IsWellDepthDecreasing = false, - IsBitPositionIncreasing = false, - IsBitPositionDecreasing = true, - IsBitPositionLt20 = true, - IsBlockPositionIncreasing = false, - IsBlockPositionDecreasing = true, - IsRotorSpeedLt3 = true, - IsRotorSpeedGt3 = false, - IsPressureLt20 = true, - IsPressureGt20 = false, - IsHookWeightNotChanges = true, - IsHookWeightLt3 = true - }, - new TelemetryAnalysis - { - Id = 4, - IdTelemetry = 1, - IdOperation = 17, - UnixDate = 1626870372, - DurationSec = 7, - OperationStartDepth = 206, - OperationEndDepth = 206, - IsWellDepthIncreasing = false, - IsWellDepthDecreasing = false, - IsBitPositionIncreasing = false, - IsBitPositionDecreasing = false, - IsBitPositionLt20 = true, - IsBlockPositionIncreasing = false, - IsBlockPositionDecreasing = false, - IsRotorSpeedLt3 = true, - IsRotorSpeedGt3 = false, - IsPressureLt20 = true, - IsPressureGt20 = false, - IsHookWeightNotChanges = true, - IsHookWeightLt3 = true - }, - new TelemetryAnalysis - { - Id = 5, - IdTelemetry = 1, - IdOperation = 8, - UnixDate = 1626870379, - DurationSec = 7, - OperationStartDepth = 206, - OperationEndDepth = 206, - IsWellDepthIncreasing = false, - IsWellDepthDecreasing = false, - IsBitPositionIncreasing = true, - IsBitPositionDecreasing = false, - IsBitPositionLt20 = true, - IsBlockPositionIncreasing = true, - IsBlockPositionDecreasing = false, - IsRotorSpeedLt3 = true, - IsRotorSpeedGt3 = false, - IsPressureLt20 = true, - IsPressureGt20 = false, - IsHookWeightNotChanges = true, - IsHookWeightLt3 = true - } - ); - - int res = demoContext.SaveChanges(); - - if (res > 0) - Console.WriteLine("Даннные добавлены"); - else - Console.WriteLine("Ошибка при добавлении данных"); - } - catch (Exception ex) - { - Console.WriteLine(ex.Message); - } + Console.WriteLine("End of Test"); + Console.ReadLine(); } } }