diff --git a/TransportCompany/TransportCompany/FormTimeCheck.Designer.cs b/TransportCompany/TransportCompany/FormTimeCheck.Designer.cs
new file mode 100644
index 0000000..0bde1a6
--- /dev/null
+++ b/TransportCompany/TransportCompany/FormTimeCheck.Designer.cs
@@ -0,0 +1,117 @@
+namespace TransportCompany
+{
+ partial class FormTimeCheck
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ buttonStartTest = new Button();
+ buttonCancel = new Button();
+ label1 = new Label();
+ textBoxCount = new TextBox();
+ label2 = new Label();
+ textBoxTimeWork = new TextBox();
+ SuspendLayout();
+ //
+ // buttonStartTest
+ //
+ buttonStartTest.Location = new Point(123, 22);
+ buttonStartTest.Name = "buttonStartTest";
+ buttonStartTest.Size = new Size(257, 75);
+ buttonStartTest.TabIndex = 0;
+ buttonStartTest.Text = "Запуск теста";
+ buttonStartTest.UseVisualStyleBackColor = true;
+ buttonStartTest.Click += ButtonStartTest_Click;
+ //
+ // buttonCancel
+ //
+ buttonCancel.Location = new Point(361, 241);
+ buttonCancel.Name = "buttonCancel";
+ buttonCancel.Size = new Size(94, 30);
+ buttonCancel.TabIndex = 1;
+ buttonCancel.Text = "Закрыть";
+ buttonCancel.UseVisualStyleBackColor = true;
+ buttonCancel.Click += ButtonCancel_Click;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.Location = new Point(25, 131);
+ label1.Name = "label1";
+ label1.Size = new Size(230, 20);
+ label1.TabIndex = 2;
+ label1.Text = "Кол-во считываемых значений:";
+ //
+ // textBoxCount
+ //
+ textBoxCount.Location = new Point(284, 128);
+ textBoxCount.Name = "textBoxCount";
+ textBoxCount.Size = new Size(171, 27);
+ textBoxCount.TabIndex = 3;
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.Location = new Point(25, 186);
+ label2.Name = "label2";
+ label2.Size = new Size(113, 20);
+ label2.TabIndex = 4;
+ label2.Text = "Время работы:";
+ //
+ // textBoxTimeWork
+ //
+ textBoxTimeWork.Location = new Point(284, 183);
+ textBoxTimeWork.Name = "textBoxTimeWork";
+ textBoxTimeWork.Size = new Size(171, 27);
+ textBoxTimeWork.TabIndex = 5;
+ //
+ // FormTimeCheck
+ //
+ AutoScaleDimensions = new SizeF(8F, 20F);
+ AutoScaleMode = AutoScaleMode.Font;
+ ClientSize = new Size(480, 285);
+ Controls.Add(textBoxTimeWork);
+ Controls.Add(label2);
+ Controls.Add(textBoxCount);
+ Controls.Add(label1);
+ Controls.Add(buttonCancel);
+ Controls.Add(buttonStartTest);
+ Name = "FormTimeCheck";
+ Text = "Тест скорости чтения записей перевозок";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ #endregion
+
+ private Button buttonStartTest;
+ private Button buttonCancel;
+ private Label label1;
+ private TextBox textBoxCount;
+ private Label label2;
+ private TextBox textBoxTimeWork;
+ }
+}
\ No newline at end of file
diff --git a/TransportCompany/TransportCompany/FormTimeCheck.cs b/TransportCompany/TransportCompany/FormTimeCheck.cs
new file mode 100644
index 0000000..11842b6
--- /dev/null
+++ b/TransportCompany/TransportCompany/FormTimeCheck.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using TransportCompanyBusinessLogic.BusinessLogic;
+using TransportCompanyContracts.BusinessLogicsContracts;
+
+namespace TransportCompany
+{
+ //форма за измерения времени считывания значений
+ public partial class FormTimeCheck : Form
+ {
+ private readonly ITruckingLogic _truckingLogic;
+
+ public FormTimeCheck(ITruckingLogic truckingLogic)
+ {
+ InitializeComponent();
+
+ _truckingLogic = truckingLogic;
+ }
+
+ private void ButtonStartTest_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ var result = _truckingLogic.TestReadList();
+
+ string[] parameters = result.Split(' ');
+
+ textBoxCount.Text = parameters[0];
+
+ textBoxTimeWork.Text = parameters[1];
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
+ }
+ }
+
+ private void ButtonCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+ }
+}
diff --git a/TransportCompany/TransportCompany/FormTimeCheck.resx b/TransportCompany/TransportCompany/FormTimeCheck.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/TransportCompany/TransportCompany/FormTimeCheck.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/TransportCompany/TransportCompany/FormTrucking.Designer.cs b/TransportCompany/TransportCompany/FormTrucking.Designer.cs
index 936c291..9d4abca 100644
--- a/TransportCompany/TransportCompany/FormTrucking.Designer.cs
+++ b/TransportCompany/TransportCompany/FormTrucking.Designer.cs
@@ -44,6 +44,7 @@
label1 = new Label();
checkBoxSorted = new CheckBox();
checkBoxForFilterMode = new CheckBox();
+ testTimeGetDataToolStripMenuItem = new ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
menuStrip.SuspendLayout();
SuspendLayout();
@@ -71,7 +72,7 @@
// menuStrip
//
menuStrip.ImageScalingSize = new Size(20, 20);
- menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, rndGenerationToolStripMenuItem });
+ menuStrip.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, rndGenerationToolStripMenuItem, testTimeGetDataToolStripMenuItem });
menuStrip.Location = new Point(0, 0);
menuStrip.Name = "menuStrip";
menuStrip.Padding = new Padding(6, 3, 0, 3);
@@ -184,6 +185,13 @@
checkBoxForFilterMode.Text = "Включить режим фильтра";
checkBoxForFilterMode.UseVisualStyleBackColor = true;
//
+ // testTimeGetDataToolStripMenuItem
+ //
+ testTimeGetDataToolStripMenuItem.Name = "testTimeGetDataToolStripMenuItem";
+ testTimeGetDataToolStripMenuItem.Size = new Size(227, 24);
+ testTimeGetDataToolStripMenuItem.Text = "Тест скорости чтения данных";
+ testTimeGetDataToolStripMenuItem.Click += TestTimeGetDataToolStripMenuItem_Click;
+ //
// FormTrucking
//
AutoScaleDimensions = new SizeF(8F, 20F);
@@ -239,5 +247,6 @@
private Label label1;
private CheckBox checkBoxSorted;
private CheckBox checkBoxForFilterMode;
+ private ToolStripMenuItem testTimeGetDataToolStripMenuItem;
}
}
\ No newline at end of file
diff --git a/TransportCompany/TransportCompany/FormTrucking.cs b/TransportCompany/TransportCompany/FormTrucking.cs
index 382a5e7..72f7a75 100644
--- a/TransportCompany/TransportCompany/FormTrucking.cs
+++ b/TransportCompany/TransportCompany/FormTrucking.cs
@@ -150,7 +150,7 @@ namespace TransportCompany
private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e)
{
- if(!checkBoxForFilterMode.Checked)
+ if (!checkBoxForFilterMode.Checked)
{
//dataGridView.DataSource = _truckingLogic.ReadList(null);
LoadData();
@@ -165,5 +165,16 @@ namespace TransportCompany
{
dataGridView.DataSource = _truckingLogic.ReadList(null).OrderByDescending(x => x.Price).ToList();
}
+
+ private void TestTimeGetDataToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormTimeCheck));
+
+ if (service is FormTimeCheck form)
+ {
+ form.ShowDialog();
+ LoadData();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/TransportCompany/TransportCompany/Program.cs b/TransportCompany/TransportCompany/Program.cs
index 5211704..47e8b58 100644
--- a/TransportCompany/TransportCompany/Program.cs
+++ b/TransportCompany/TransportCompany/Program.cs
@@ -61,6 +61,7 @@ namespace TransportCompany
services.AddTransient();
services.AddTransient();
services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/TruckingLogic.cs b/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/TruckingLogic.cs
index f048151..e5e47e9 100644
--- a/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/TruckingLogic.cs
+++ b/TransportCompany/TransportCompanyBusinessLogic/BusinessLogic/TruckingLogic.cs
@@ -44,7 +44,13 @@ namespace TransportCompanyBusinessLogic.BusinessLogic
return list;
}
- public TruckingViewModel? ReadElement(TruckingSearchModel model)
+ //для замера времени считывания значений
+ public string? TestReadList()
+ {
+ return _truckingStorage.TestGetFullList();
+ }
+
+ public TruckingViewModel? ReadElement(TruckingSearchModel model)
{
if (model == null)
{
diff --git a/TransportCompany/TransportCompanyContracts/BusinessLogicsContracts/ITruckingLogic.cs b/TransportCompany/TransportCompanyContracts/BusinessLogicsContracts/ITruckingLogic.cs
index dca9436..ab74567 100644
--- a/TransportCompany/TransportCompanyContracts/BusinessLogicsContracts/ITruckingLogic.cs
+++ b/TransportCompany/TransportCompanyContracts/BusinessLogicsContracts/ITruckingLogic.cs
@@ -13,7 +13,9 @@ namespace TransportCompanyContracts.BusinessLogicsContracts
{
List? ReadList(TruckingSearchModel? model);
- TruckingViewModel? ReadElement(TruckingSearchModel model);
+ string? TestReadList();
+
+ TruckingViewModel? ReadElement(TruckingSearchModel model);
bool Create(TruckingBindingModel model);
diff --git a/TransportCompany/TransportCompanyContracts/StoragesContracts/ITruckingStorage.cs b/TransportCompany/TransportCompanyContracts/StoragesContracts/ITruckingStorage.cs
index 0ca3d8a..6409ff9 100644
--- a/TransportCompany/TransportCompanyContracts/StoragesContracts/ITruckingStorage.cs
+++ b/TransportCompany/TransportCompanyContracts/StoragesContracts/ITruckingStorage.cs
@@ -13,7 +13,9 @@ namespace TransportCompanyContracts.StoragesContracts
{
List GetFullList();
- List GetFilteredList(TruckingSearchModel model);
+ string TestGetFullList();
+
+ List GetFilteredList(TruckingSearchModel model);
TruckingViewModel? GetElement(TruckingSearchModel model);
diff --git a/TransportCompany/TransportCompanyDatabaseImplements/Implements/TruckingStorage.cs b/TransportCompany/TransportCompanyDatabaseImplements/Implements/TruckingStorage.cs
index 32090c5..3ba48fe 100644
--- a/TransportCompany/TransportCompanyDatabaseImplements/Implements/TruckingStorage.cs
+++ b/TransportCompany/TransportCompanyDatabaseImplements/Implements/TruckingStorage.cs
@@ -75,7 +75,36 @@ namespace TransportCompanyDatabaseImplements.Implements
.ToList();
}
- public TruckingViewModel? Insert(TruckingBindingModel model)
+
+ public string TestGetFullList()
+ {
+ using var context = new ElegevContext();
+
+ string result = null;
+
+ //для замера времени считывания из бд
+ Stopwatch stopwatch = new();
+
+ stopwatch.Start();
+
+ List list = context.Truckings
+ .Include(x => x.Transport)
+ .Include(x => x.Cargo)
+ .Include(x => x.Transportation)
+ .Include(x => x.Client)
+ .Select(x => x.GetViewModel)
+ .ToList();
+
+ stopwatch.Stop();
+
+ result = list.Count.ToString();
+
+ list.Clear();
+
+ return result + " " + stopwatch.ElapsedMilliseconds.ToString();
+ }
+
+ public TruckingViewModel? Insert(TruckingBindingModel model)
{
using var context = new ElegevContext();