PIbd-23_Abazov_A.A._Constru.../ConstructionCompany/ConstructionCompanyBusiness/BusinessLogics/RandomGeneratorLogic.cs

85 lines
2.7 KiB
C#
Raw Normal View History

2023-04-10 14:24:22 +04:00
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 });
}
}
}
}