Ну теперь точно финалочка.
This commit is contained in:
parent
2c7e9230ff
commit
a8f37756f5
117
TransportCompany/TransportCompany/FormTimeCheck.Designer.cs
generated
Normal file
117
TransportCompany/TransportCompany/FormTimeCheck.Designer.cs
generated
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
namespace TransportCompany
|
||||||
|
{
|
||||||
|
partial class FormTimeCheck
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
51
TransportCompany/TransportCompany/FormTimeCheck.cs
Normal file
51
TransportCompany/TransportCompany/FormTimeCheck.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
TransportCompany/TransportCompany/FormTimeCheck.resx
Normal file
60
TransportCompany/TransportCompany/FormTimeCheck.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -44,6 +44,7 @@
|
|||||||
label1 = new Label();
|
label1 = new Label();
|
||||||
checkBoxSorted = new CheckBox();
|
checkBoxSorted = new CheckBox();
|
||||||
checkBoxForFilterMode = new CheckBox();
|
checkBoxForFilterMode = new CheckBox();
|
||||||
|
testTimeGetDataToolStripMenuItem = new ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
menuStrip.SuspendLayout();
|
menuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -71,7 +72,7 @@
|
|||||||
// menuStrip
|
// menuStrip
|
||||||
//
|
//
|
||||||
menuStrip.ImageScalingSize = new Size(20, 20);
|
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.Location = new Point(0, 0);
|
||||||
menuStrip.Name = "menuStrip";
|
menuStrip.Name = "menuStrip";
|
||||||
menuStrip.Padding = new Padding(6, 3, 0, 3);
|
menuStrip.Padding = new Padding(6, 3, 0, 3);
|
||||||
@ -184,6 +185,13 @@
|
|||||||
checkBoxForFilterMode.Text = "Включить режим фильтра";
|
checkBoxForFilterMode.Text = "Включить режим фильтра";
|
||||||
checkBoxForFilterMode.UseVisualStyleBackColor = true;
|
checkBoxForFilterMode.UseVisualStyleBackColor = true;
|
||||||
//
|
//
|
||||||
|
// testTimeGetDataToolStripMenuItem
|
||||||
|
//
|
||||||
|
testTimeGetDataToolStripMenuItem.Name = "testTimeGetDataToolStripMenuItem";
|
||||||
|
testTimeGetDataToolStripMenuItem.Size = new Size(227, 24);
|
||||||
|
testTimeGetDataToolStripMenuItem.Text = "Тест скорости чтения данных";
|
||||||
|
testTimeGetDataToolStripMenuItem.Click += TestTimeGetDataToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// FormTrucking
|
// FormTrucking
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
@ -239,5 +247,6 @@
|
|||||||
private Label label1;
|
private Label label1;
|
||||||
private CheckBox checkBoxSorted;
|
private CheckBox checkBoxSorted;
|
||||||
private CheckBox checkBoxForFilterMode;
|
private CheckBox checkBoxForFilterMode;
|
||||||
|
private ToolStripMenuItem testTimeGetDataToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -150,7 +150,7 @@ namespace TransportCompany
|
|||||||
|
|
||||||
private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e)
|
private void ComboBoxEmails_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if(!checkBoxForFilterMode.Checked)
|
if (!checkBoxForFilterMode.Checked)
|
||||||
{
|
{
|
||||||
//dataGridView.DataSource = _truckingLogic.ReadList(null);
|
//dataGridView.DataSource = _truckingLogic.ReadList(null);
|
||||||
LoadData();
|
LoadData();
|
||||||
@ -165,5 +165,16 @@ namespace TransportCompany
|
|||||||
{
|
{
|
||||||
dataGridView.DataSource = _truckingLogic.ReadList(null).OrderByDescending(x => x.Price).ToList();
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -61,6 +61,7 @@ namespace TransportCompany
|
|||||||
services.AddTransient<FormCreateTypeTransportation>();
|
services.AddTransient<FormCreateTypeTransportation>();
|
||||||
services.AddTransient<FormRandomCreateClient>();
|
services.AddTransient<FormRandomCreateClient>();
|
||||||
services.AddTransient<FormRandomCreateTrucking>();
|
services.AddTransient<FormRandomCreateTrucking>();
|
||||||
|
services.AddTransient<FormTimeCheck>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -44,7 +44,13 @@ namespace TransportCompanyBusinessLogic.BusinessLogic
|
|||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TruckingViewModel? ReadElement(TruckingSearchModel model)
|
//для замера времени считывания значений
|
||||||
|
public string? TestReadList()
|
||||||
|
{
|
||||||
|
return _truckingStorage.TestGetFullList();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TruckingViewModel? ReadElement(TruckingSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,9 @@ namespace TransportCompanyContracts.BusinessLogicsContracts
|
|||||||
{
|
{
|
||||||
List<TruckingViewModel>? ReadList(TruckingSearchModel? model);
|
List<TruckingViewModel>? ReadList(TruckingSearchModel? model);
|
||||||
|
|
||||||
TruckingViewModel? ReadElement(TruckingSearchModel model);
|
string? TestReadList();
|
||||||
|
|
||||||
|
TruckingViewModel? ReadElement(TruckingSearchModel model);
|
||||||
|
|
||||||
bool Create(TruckingBindingModel model);
|
bool Create(TruckingBindingModel model);
|
||||||
|
|
||||||
|
@ -13,7 +13,9 @@ namespace TransportCompanyContracts.StoragesContracts
|
|||||||
{
|
{
|
||||||
List<TruckingViewModel> GetFullList();
|
List<TruckingViewModel> GetFullList();
|
||||||
|
|
||||||
List<TruckingViewModel> GetFilteredList(TruckingSearchModel model);
|
string TestGetFullList();
|
||||||
|
|
||||||
|
List<TruckingViewModel> GetFilteredList(TruckingSearchModel model);
|
||||||
|
|
||||||
TruckingViewModel? GetElement(TruckingSearchModel model);
|
TruckingViewModel? GetElement(TruckingSearchModel model);
|
||||||
|
|
||||||
|
@ -75,7 +75,36 @@ namespace TransportCompanyDatabaseImplements.Implements
|
|||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public TruckingViewModel? Insert(TruckingBindingModel model)
|
|
||||||
|
public string TestGetFullList()
|
||||||
|
{
|
||||||
|
using var context = new ElegevContext();
|
||||||
|
|
||||||
|
string result = null;
|
||||||
|
|
||||||
|
//для замера времени считывания из бд
|
||||||
|
Stopwatch stopwatch = new();
|
||||||
|
|
||||||
|
stopwatch.Start();
|
||||||
|
|
||||||
|
List<TruckingViewModel> 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();
|
using var context = new ElegevContext();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user