Testing time
This commit is contained in:
parent
a56de95ee0
commit
b3ae7e1f76
@ -34,7 +34,7 @@ namespace ConstructionCompanyBusinessLogic.BusinessLogics
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
return list;
|
return list.OrderBy(x => x.Id).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? ReadElement(OrderSearchModel model)
|
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||||
|
@ -0,0 +1,84 @@
|
|||||||
|
using ConstructionCompanyContracts.BindingModels;
|
||||||
|
using ConstructionCompanyContracts.BusinessLogicContracts;
|
||||||
|
using ConstructionCompanyDataModels.Enums;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ConstructionCompanyBusinessLogic.BusinessLogics
|
||||||
|
{
|
||||||
|
public class RandomGeneratorLogic : IRandomGeneratorLogic
|
||||||
|
{
|
||||||
|
private readonly IMaterialLogic _material;
|
||||||
|
private readonly IEmployeeLogic _employee;
|
||||||
|
private readonly IPositionLogic _position;
|
||||||
|
private readonly IOrderLogic _order;
|
||||||
|
private readonly IMaterialOrderLogic _materialOrder;
|
||||||
|
private readonly IEmployeeOrderLogic _employeeOrder;
|
||||||
|
|
||||||
|
public RandomGeneratorLogic(IMaterialLogic material, IEmployeeLogic employee, IPositionLogic position, IOrderLogic order, IMaterialOrderLogic materialOrder, IEmployeeOrderLogic employeeOrder)
|
||||||
|
{
|
||||||
|
_material = material;
|
||||||
|
_employee = employee;
|
||||||
|
_position = position;
|
||||||
|
_order = order;
|
||||||
|
_materialOrder = materialOrder;
|
||||||
|
_employeeOrder = employeeOrder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateEmployees()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 70; i++)
|
||||||
|
{
|
||||||
|
_employee.Create(new EmployeeBindingModel { EmployeeName = "testEmp", PositionID = 1 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateEmployeesOrders()
|
||||||
|
{
|
||||||
|
for (int i = 2; i < 50; i++)
|
||||||
|
{
|
||||||
|
_employeeOrder.Create(new EmployeeOrderBindingModel { EmployeeId = i, OrderId = i });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateMaterialOrders()
|
||||||
|
{
|
||||||
|
for (int i = 2; i < 40; i++)
|
||||||
|
{
|
||||||
|
_materialOrder.Create(new MaterialOrderBindingModel { MaterialId = i, OrderId = i, Quantity = 1});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateMaterials()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 100; i++)
|
||||||
|
{
|
||||||
|
_material.Create(new MaterialBindingModel { MaterialName = "testMat", Quantity = 2000 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GenerateOrders()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 2000; i++)
|
||||||
|
{
|
||||||
|
if (i == 733)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
_order.CreateOrder(new OrderBindingModel { Description = "snfjknfjksfns", Adress = "dsdsdssd", Price=20000, Status=OrderStatus.Неизвестен, CustomerNumber="+7838347475"});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void GeneratePositions()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 15; i++)
|
||||||
|
{
|
||||||
|
_position.Create(new PositionBindingModel { PositionName = "testPos", Salary = 20000 });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ConstructionCompanyContracts.BusinessLogicContracts
|
||||||
|
{
|
||||||
|
public interface IRandomGeneratorLogic
|
||||||
|
{
|
||||||
|
public void GenerateMaterials();
|
||||||
|
public void GenerateOrders();
|
||||||
|
public void GeneratePositions();
|
||||||
|
public void GenerateEmployees();
|
||||||
|
public void GenerateEmployeesOrders();
|
||||||
|
public void GenerateMaterialOrders();
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ namespace ConstructionCompanyPsqlImplement
|
|||||||
{
|
{
|
||||||
public class ConstructionCompanyDatabase
|
public class ConstructionCompanyDatabase
|
||||||
{
|
{
|
||||||
static string connectionString = "Server=192.168.1.35;Port=5432;Database=ConstructionCompanyForwardEngineerd;User Id=postgres;Password=postgres;";
|
static string connectionString = "Server=172.20.10.10;Port=5432;Database=ConstructionCompanyForwardEngineerd;User Id=postgres;Password=postgres;";
|
||||||
|
|
||||||
private static ConstructionCompanyDatabase? _instance;
|
private static ConstructionCompanyDatabase? _instance;
|
||||||
private List<Material> _materials = new List<Material>();
|
private List<Material> _materials = new List<Material>();
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
this.buttonWarehouse = new System.Windows.Forms.Button();
|
this.buttonWarehouse = new System.Windows.Forms.Button();
|
||||||
this.buttonManager = new System.Windows.Forms.Button();
|
this.buttonManager = new System.Windows.Forms.Button();
|
||||||
this.buttonHR = new System.Windows.Forms.Button();
|
this.buttonHR = new System.Windows.Forms.Button();
|
||||||
|
this.buttonGenerate = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// label1
|
// label1
|
||||||
@ -74,12 +75,23 @@
|
|||||||
this.buttonHR.UseVisualStyleBackColor = true;
|
this.buttonHR.UseVisualStyleBackColor = true;
|
||||||
this.buttonHR.Click += new System.EventHandler(this.buttonHR_Click);
|
this.buttonHR.Click += new System.EventHandler(this.buttonHR_Click);
|
||||||
//
|
//
|
||||||
|
// buttonGenerate
|
||||||
|
//
|
||||||
|
this.buttonGenerate.Location = new System.Drawing.Point(12, 309);
|
||||||
|
this.buttonGenerate.Name = "buttonGenerate";
|
||||||
|
this.buttonGenerate.Size = new System.Drawing.Size(154, 29);
|
||||||
|
this.buttonGenerate.TabIndex = 4;
|
||||||
|
this.buttonGenerate.Text = "Создать компанию";
|
||||||
|
this.buttonGenerate.UseVisualStyleBackColor = true;
|
||||||
|
this.buttonGenerate.Click += new System.EventHandler(this.buttonGenerate_Click);
|
||||||
|
//
|
||||||
// FormLogin
|
// FormLogin
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
this.BackColor = System.Drawing.SystemColors.ActiveCaption;
|
||||||
this.ClientSize = new System.Drawing.Size(784, 350);
|
this.ClientSize = new System.Drawing.Size(784, 350);
|
||||||
|
this.Controls.Add(this.buttonGenerate);
|
||||||
this.Controls.Add(this.buttonHR);
|
this.Controls.Add(this.buttonHR);
|
||||||
this.Controls.Add(this.buttonManager);
|
this.Controls.Add(this.buttonManager);
|
||||||
this.Controls.Add(this.buttonWarehouse);
|
this.Controls.Add(this.buttonWarehouse);
|
||||||
@ -97,5 +109,6 @@
|
|||||||
private Button buttonWarehouse;
|
private Button buttonWarehouse;
|
||||||
private Button buttonManager;
|
private Button buttonManager;
|
||||||
private Button buttonHR;
|
private Button buttonHR;
|
||||||
|
private Button buttonGenerate;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,10 @@
|
|||||||
using System;
|
using ConstructionCompanyContracts.BusinessLogicContracts;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Diagnostics.Eventing.Reader;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -12,9 +15,11 @@ namespace ConstructionCompanyView
|
|||||||
{
|
{
|
||||||
public partial class FormLogin : Form
|
public partial class FormLogin : Form
|
||||||
{
|
{
|
||||||
public FormLogin()
|
private readonly IRandomGeneratorLogic _random;
|
||||||
|
public FormLogin(IRandomGeneratorLogic random)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
_random = random;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonWarehouse_Click(object sender, EventArgs e)
|
private void buttonWarehouse_Click(object sender, EventArgs e)
|
||||||
@ -49,5 +54,34 @@ namespace ConstructionCompanyView
|
|||||||
this.Show();
|
this.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void buttonGenerate_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Stopwatch stopwatch = new Stopwatch();
|
||||||
|
stopwatch.Start();
|
||||||
|
_random.GenerateMaterials();
|
||||||
|
stopwatch.Stop();
|
||||||
|
long materials = stopwatch.ElapsedMilliseconds;
|
||||||
|
stopwatch.Restart();
|
||||||
|
_random.GeneratePositions();
|
||||||
|
stopwatch.Stop();
|
||||||
|
long positions = stopwatch.ElapsedMilliseconds;
|
||||||
|
stopwatch.Restart();
|
||||||
|
_random.GenerateEmployees();
|
||||||
|
stopwatch.Stop();
|
||||||
|
long employees = stopwatch.ElapsedMilliseconds;
|
||||||
|
stopwatch.Restart();
|
||||||
|
_random.GenerateOrders();
|
||||||
|
stopwatch.Stop();
|
||||||
|
long orders = stopwatch.ElapsedMilliseconds;
|
||||||
|
stopwatch.Restart();
|
||||||
|
_random.GenerateEmployeesOrders();
|
||||||
|
long employeesOrders = stopwatch.ElapsedMilliseconds;
|
||||||
|
stopwatch.Restart();
|
||||||
|
_random.GenerateMaterialOrders();
|
||||||
|
stopwatch.Stop();
|
||||||
|
long materialOrders = stopwatch.ElapsedMilliseconds;
|
||||||
|
MessageBox.Show($"materials={materials}, positions={positions}, employees={employees}, orders={orders}, materialOrders={materialOrders}, employeeOrders={employeesOrders}", "Результаты");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -47,6 +47,7 @@ namespace ConstructionCompanyView
|
|||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IEmployeeOrderLogic, EmployeeOrderLogic>();
|
services.AddTransient<IEmployeeOrderLogic, EmployeeOrderLogic>();
|
||||||
services.AddTransient<IMaterialOrderLogic, MaterialOrderLogic>();
|
services.AddTransient<IMaterialOrderLogic, MaterialOrderLogic>();
|
||||||
|
services.AddTransient<IRandomGeneratorLogic, RandomGeneratorLogic>();
|
||||||
|
|
||||||
services.AddTransient<FormMaterials>();
|
services.AddTransient<FormMaterials>();
|
||||||
services.AddTransient<FormMaterial>();
|
services.AddTransient<FormMaterial>();
|
||||||
|
Loading…
Reference in New Issue
Block a user