done! now i can play pubg with my dear friends
This commit is contained in:
parent
cbd936027a
commit
c0c09b59ab
@ -63,13 +63,12 @@ namespace AbstractSoftwareInstallationBusinessLogic.BusinessLogic
|
||||
{
|
||||
CheckModel(model);
|
||||
if (model.Status != OrderStatus.Неизвестен)
|
||||
{
|
||||
{
|
||||
_logger.LogWarning("Order status is incorrect");
|
||||
return false;
|
||||
}
|
||||
model.Status = OrderStatus.Принят;
|
||||
model.DateCreate = DateTime.Now;
|
||||
if (_orderStorage.Insert(model) == null)
|
||||
if (_orderStorage.Insert(model) == null)
|
||||
{
|
||||
model.Status = OrderStatus.Неизвестен;
|
||||
_logger.LogWarning("Failed to insert order into a storage");
|
||||
@ -77,28 +76,44 @@ namespace AbstractSoftwareInstallationBusinessLogic.BusinessLogic
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public bool StatusUpdate(OrderBindingModel model, OrderStatus _newStatus)
|
||||
public bool StatusUpdate(OrderBindingModel rawModel, OrderStatus _newStatus)
|
||||
{
|
||||
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = model.Id });
|
||||
var viewModel = _orderStorage.GetElement(new OrderSearchModel { Id = rawModel.Id });
|
||||
if (viewModel == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(model));
|
||||
_logger.LogWarning("Order model not found");
|
||||
return false;
|
||||
}
|
||||
OrderBindingModel model = new OrderBindingModel
|
||||
{
|
||||
Id = viewModel.Id,
|
||||
PackageId = viewModel.PackageId,
|
||||
Status = viewModel.Status,
|
||||
DateCreate = viewModel.DateCreate,
|
||||
DateImplement = viewModel.DateImplement,
|
||||
Count = viewModel.Count,
|
||||
Sum = viewModel.Sum,
|
||||
ImplementerId = viewModel.ImplementerId
|
||||
};
|
||||
if (rawModel.ImplementerId.HasValue)
|
||||
{
|
||||
model.ImplementerId = rawModel.ImplementerId;
|
||||
}
|
||||
if (viewModel.Status + 1 != _newStatus)
|
||||
{
|
||||
_logger.LogWarning("Status update to " + _newStatus.ToString() + " operation failed. Order status incorrect.");
|
||||
return false;
|
||||
}
|
||||
model.Status = _newStatus;
|
||||
if (model.Status == OrderStatus.Выдан) model.DateImplement = DateTime.Now;
|
||||
rawModel.Status = _newStatus;
|
||||
if (rawModel.Status == OrderStatus.Выдан) rawModel.DateImplement = DateTime.Now;
|
||||
else
|
||||
{
|
||||
model.DateImplement = viewModel.DateImplement;
|
||||
rawModel.DateImplement = viewModel.DateImplement;
|
||||
}
|
||||
CheckModel(model, false);
|
||||
if (_orderStorage.Update(model) == null)
|
||||
CheckModel(rawModel, false);
|
||||
if (_orderStorage.Update(rawModel) == null)
|
||||
{
|
||||
model.Status--;
|
||||
rawModel.Status--;
|
||||
_logger.LogWarning("Update operation failed");
|
||||
return false;
|
||||
}
|
||||
|
@ -12,126 +12,138 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace AbstractSoftwareInstallationBusinessLogic.BusinessLogic
|
||||
{
|
||||
public class WorkModeling : IWorkProcess
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
public class WorkModeling : IWorkProcess
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly Random _rnd;
|
||||
private IOrderLogic? _orderLogic;
|
||||
|
||||
private readonly Random _rnd;
|
||||
public WorkModeling(ILogger<WorkModeling> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_rnd = new Random(1000);
|
||||
}
|
||||
|
||||
private IOrderLogic? _orderLogic;
|
||||
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
|
||||
{
|
||||
_orderLogic = orderLogic;
|
||||
var implementers = implementerLogic.ReadList(null);
|
||||
if (implementers == null)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Implementers is null");
|
||||
return;
|
||||
}
|
||||
var orders = _orderLogic.ReadList(new OrderSearchModel
|
||||
{
|
||||
Status = OrderStatus.Принят
|
||||
});
|
||||
if (orders == null || orders.Count == 0)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Orders is null or empty");
|
||||
return;
|
||||
}
|
||||
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
||||
foreach (var implementer in implementers)
|
||||
{
|
||||
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
||||
}
|
||||
}
|
||||
|
||||
public WorkModeling(ILogger<WorkModeling> logger)
|
||||
{
|
||||
_logger = logger;
|
||||
_rnd = new Random(1000);
|
||||
}
|
||||
/// <summary>
|
||||
/// Иммитация работы исполнителя
|
||||
/// </summary>
|
||||
/// <param name="implementer"></param>
|
||||
/// <param name="orders"></param>
|
||||
private async Task WorkerWorkAsync(ImplementerViewModel implementer, List<OrderViewModel> orders)
|
||||
{
|
||||
if (_orderLogic == null || implementer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
await RunOrderInWork(implementer);
|
||||
await Task.Run(() =>
|
||||
{
|
||||
foreach (var order in orders)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogDebug("DoWork. Worker {Id} try get order {Order} ", implementer.Id, order.Id);
|
||||
// пытаемся назначить заказ на исполнителя
|
||||
_orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||
{
|
||||
Id = order.Id,
|
||||
ImplementerId = implementer.Id
|
||||
});
|
||||
// делаем работу
|
||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(1000, 10000) * order.Count);
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
|
||||
_orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = order.Id,
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Error try get work");
|
||||
}
|
||||
// заканчиваем выполнение имитации в случае иной ошибки
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while do work");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void DoWork(IImplementerLogic implementerLogic, IOrderLogic orderLogic)
|
||||
{
|
||||
_orderLogic = orderLogic;
|
||||
var implementers = implementerLogic.ReadList(null);
|
||||
if (implementers == null)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Implementers is null");
|
||||
return;
|
||||
}
|
||||
var orders = _orderLogic.ReadList(new OrderSearchModel { Statuses = new() { OrderStatus.Принят, OrderStatus.Выполняется } });
|
||||
if (orders == null || orders.Count == 0)
|
||||
{
|
||||
_logger.LogWarning("DoWork. Orders is null or empty");
|
||||
return;
|
||||
}
|
||||
_logger.LogDebug("DoWork for {Count} orders", orders.Count);
|
||||
foreach (var implementer in implementers)
|
||||
{
|
||||
Task.Run(() => WorkerWorkAsync(implementer, orders));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Ищем заказ, которые уже в работе (вдруг исполнителя прервали)
|
||||
/// </summary>
|
||||
/// <param name="implementer"></param>
|
||||
/// <returns></returns>
|
||||
private async Task RunOrderInWork(ImplementerViewModel implementer)
|
||||
{
|
||||
if (_orderLogic == null || implementer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
var runOrder = await Task.Run(() => _orderLogic.ReadElement(new OrderSearchModel
|
||||
{
|
||||
ImplementerId = implementer.Id,
|
||||
Status = OrderStatus.Выполняется
|
||||
}));
|
||||
if (runOrder == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
||||
// доделываем работу
|
||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, runOrder.Id);
|
||||
_orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = runOrder.Id
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
// заказа может не быть, просто игнорируем ошибку
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Error try get work");
|
||||
}
|
||||
// а может возникнуть иная ошибка, тогда просто заканчиваем выполнение имитации
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while do work");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task WorkerWorkAsync(ImplementerViewModel implementer, List<OrderViewModel> orders)
|
||||
{
|
||||
if (_orderLogic == null || implementer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
await RunOrderInWork(implementer, orders);
|
||||
|
||||
await Task.Run(() =>
|
||||
{
|
||||
foreach (var order in orders)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogDebug("DoWork. Worker {Id} try get order {Order}", implementer.Id, order.Id);
|
||||
// пытаемся назначить заказ на исполнителя
|
||||
_orderLogic.TakeOrderInWork(new OrderBindingModel
|
||||
{
|
||||
Id = order.Id,
|
||||
ImplementerId = implementer.Id
|
||||
});
|
||||
// делаем работу
|
||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 1000) * order.Count);
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, order.Id);
|
||||
_orderLogic.DeliveryOrder(new OrderBindingModel
|
||||
{
|
||||
Id = order.Id,
|
||||
ImplementerId = implementer.Id
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
// кто-то мог уже перехватить заказ, игнорируем ошибку
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Error try get work");
|
||||
}
|
||||
// заканчиваем выполнение имитации в случае иной ошибки
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while do work");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private async Task RunOrderInWork(ImplementerViewModel implementer, List<OrderViewModel> allOrders)
|
||||
{
|
||||
if (_orderLogic == null || implementer == null || allOrders == null || allOrders.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
// Выбираем из всех заказов тот, который выполняется данным исполнителем
|
||||
var runOrder = await Task.Run(() => allOrders.FirstOrDefault(x => x.ImplementerId == implementer.Id && x.Status == OrderStatus.Выполняется));
|
||||
if (runOrder == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_logger.LogDebug("DoWork. Worker {Id} back to order {Order}", implementer.Id, runOrder.Id);
|
||||
// доделываем работу
|
||||
Thread.Sleep(implementer.WorkExperience * _rnd.Next(100, 300) * runOrder.Count);
|
||||
_logger.LogDebug("DoWork. Worker {Id} finish order {Order}", implementer.Id, runOrder.Id);
|
||||
_orderLogic.FinishOrder(new OrderBindingModel
|
||||
{
|
||||
Id = runOrder.Id
|
||||
});
|
||||
// отдыхаем
|
||||
Thread.Sleep(implementer.Qualification * _rnd.Next(10, 100));
|
||||
}
|
||||
// заказа может не быть, просто игнорируем ошибку
|
||||
catch (InvalidOperationException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "Error try get work");
|
||||
}
|
||||
// а может возникнуть иная ошибка, тогда просто заканчиваем выполнение имитации
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Error while do work");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace AbstractSoftwareInstallationContracts.BindingModels
|
||||
public int Id { get; set; }
|
||||
public int PackageId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int ImplementerId { get; set; }
|
||||
public int? ImplementerId { get; set; }
|
||||
public int Count { get; set; }
|
||||
public double Sum { get; set; }
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
@ -14,6 +14,6 @@ namespace AbstractSoftwareInstallationContracts.SearchModels
|
||||
public DateTime? DateTo { get; set; }
|
||||
public int? ClientId { get; set; }
|
||||
public int? ImplementerId { get; set; }
|
||||
public List<OrderStatus>? Statuses { get; set; }
|
||||
public OrderStatus? Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace AbstractSoftwareInstallationContracts.ViewModels
|
||||
public int Id { get; set; }
|
||||
public int PackageId { get; set; }
|
||||
public int ClientId { get; set; }
|
||||
public int ImplementerId { get; set; }
|
||||
public int? ImplementerId { get; set; }
|
||||
[DisplayName("Пакет")]
|
||||
public string PackageName { get; set; } = string.Empty;
|
||||
|
||||
|
@ -10,7 +10,7 @@ namespace AbstractSoftwareInstallationDataModels.Models
|
||||
{
|
||||
int PackageId { get; }
|
||||
int ClientId { get; }
|
||||
int ImplementerId { get; }
|
||||
int? ImplementerId { get; }
|
||||
int Count { get; }
|
||||
double Sum { get; }
|
||||
OrderStatus Status { get; }
|
||||
|
@ -16,7 +16,7 @@ optionsBuilder)
|
||||
{
|
||||
if (optionsBuilder.IsConfigured == false)
|
||||
{
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-QA8P9OJ;Initial Catalog=SoftwareInstallation;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
|
||||
optionsBuilder.UseSqlServer(@"Data Source=DESKTOP-QA8P9OJ;Initial Catalog=SoftwareInstallation1;Integrated Security=True;MultipleActiveResultSets=True;TrustServerCertificate=True");
|
||||
}
|
||||
base.OnConfiguring(optionsBuilder);
|
||||
}
|
||||
|
@ -29,35 +29,51 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Implements
|
||||
|
||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
return context.Orders.Include(x => x.Package).Include(x => x.Client).Include(x => x.Implementer).FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.FirstOrDefault(x =>
|
||||
(model.Status == null || model.Status != null && model.Status.Equals(x.Status)) &&
|
||||
model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId ||
|
||||
model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
{
|
||||
if (!model.Id.HasValue && !model.DateFrom.HasValue && !model.DateTo.HasValue && !model.ClientId.HasValue && model.Status == null)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new AbstractSoftwareInstallationDatabase();
|
||||
|
||||
if (model.ClientId.HasValue)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Include(x => x.Package)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
if (model.Status != null)
|
||||
{
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => model.Status.Equals(x.Status))
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
return context.Orders
|
||||
.Include(x => x.Package)
|
||||
.Include(x => x.Client)
|
||||
.Include(x => x.Implementer)
|
||||
.Where(x => x.ClientId == model.ClientId)
|
||||
.Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
return context.Orders
|
||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||
.Include(x => x.Package).Include(x => x.Client).Include(x => x.Implementer)
|
||||
.Select(x => x.GetViewModel)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
|
||||
public List<OrderViewModel> GetFullList()
|
||||
|
@ -0,0 +1,257 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using AbstractSoftwareInstallationDatabaseImplement;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
{
|
||||
[DbContext(typeof(AbstractSoftwareInstallationDatabase))]
|
||||
[Migration("20230531115553_lab6")]
|
||||
partial class lab6
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("ProductVersion", "7.0.4")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||
|
||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||
|
||||
modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("ClientId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateImplement")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<int?>("ImplementerId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("Status")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<double>("Sum")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ClientId");
|
||||
|
||||
b.HasIndex("ImplementerId");
|
||||
|
||||
b.HasIndex("PackageId");
|
||||
|
||||
b.ToTable("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ClientFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Clients");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("ImplementerFIO")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Password")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Qualification")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("WorkExperience")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Implementers");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<string>("PackageName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<double>("Price")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Packages");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("PackageId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("SoftwareId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("PackageId");
|
||||
|
||||
b.HasIndex("SoftwareId");
|
||||
|
||||
b.ToTable("PackageSoftwares");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b =>
|
||||
{
|
||||
b.Property<int>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int");
|
||||
|
||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||
|
||||
b.Property<double>("Cost")
|
||||
.HasColumnType("float");
|
||||
|
||||
b.Property<string>("SoftwareName")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Softwares");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractPackageInstallationDatabaseImplement.Models.Order", b =>
|
||||
{
|
||||
b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Client", "Client")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ClientId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", "Implementer")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("ImplementerId");
|
||||
|
||||
b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
||||
.WithMany("Orders")
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Client");
|
||||
|
||||
b.Navigation("Implementer");
|
||||
|
||||
b.Navigation("Package");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.PackageSoftware", b =>
|
||||
{
|
||||
b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Package", "Package")
|
||||
.WithMany("Softwares")
|
||||
.HasForeignKey("PackageId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("AbstractSoftwareInstallationDatabaseImplement.Models.Software", "Software")
|
||||
.WithMany("PackageSoftwares")
|
||||
.HasForeignKey("SoftwareId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Package");
|
||||
|
||||
b.Navigation("Software");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Client", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Implementer", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Package", b =>
|
||||
{
|
||||
b.Navigation("Orders");
|
||||
|
||||
b.Navigation("Softwares");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("AbstractSoftwareInstallationDatabaseImplement.Models.Software", b =>
|
||||
{
|
||||
b.Navigation("PackageSoftwares");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace AbstractSoftwareInstallationDatabaseImplement.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class lab6 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "ImplementerId",
|
||||
table: "Orders",
|
||||
type: "int",
|
||||
nullable: true,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerId",
|
||||
table: "Orders",
|
||||
column: "ImplementerId",
|
||||
principalTable: "Implementers",
|
||||
principalColumn: "Id");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerId",
|
||||
table: "Orders");
|
||||
|
||||
migrationBuilder.AlterColumn<int>(
|
||||
name: "ImplementerId",
|
||||
table: "Orders",
|
||||
type: "int",
|
||||
nullable: false,
|
||||
defaultValue: 0,
|
||||
oldClrType: typeof(int),
|
||||
oldType: "int",
|
||||
oldNullable: true);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Orders_Implementers_ImplementerId",
|
||||
table: "Orders",
|
||||
column: "ImplementerId",
|
||||
principalTable: "Implementers",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
}
|
||||
}
|
@ -15,18 +15,14 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Models
|
||||
public class Implementer : IImplementerModel
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
[Required]
|
||||
public int Qualification { get; private set; }
|
||||
[Required]
|
||||
public string ImplementerFIO { get; private set; } = string.Empty;
|
||||
[Required]
|
||||
public int WorkExperience { get; private set; }
|
||||
[Required]
|
||||
public string Password { get; private set; } = string.Empty;
|
||||
[ForeignKey("ImplementerId")]
|
||||
public virtual List<Order> Orders { get; set; } = new();
|
||||
|
||||
public static Implementer? Create(ImplementerBindingModel? model)
|
||||
public static Implementer? Create(ImplementerBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@ -41,7 +37,7 @@ namespace AbstractSoftwareInstallationDatabaseImplement.Models
|
||||
Password = model.Password
|
||||
};
|
||||
}
|
||||
public void Update(ImplementerBindingModel? model)
|
||||
public void Update(ImplementerBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
|
@ -20,8 +20,7 @@ namespace AbstractPackageInstallationDatabaseImplement.Models
|
||||
public int PackageId { get; private set; }
|
||||
[Required]
|
||||
public int ClientId { get; private set; }
|
||||
[Required]
|
||||
public int ImplementerId { get; private set; }
|
||||
public int? ImplementerId { get; private set; }
|
||||
[Required]
|
||||
public int Count { get; private set; }
|
||||
[Required]
|
||||
@ -34,7 +33,7 @@ namespace AbstractPackageInstallationDatabaseImplement.Models
|
||||
public DateTime? DateImplement { get; private set; }
|
||||
public virtual Package Package { get; set; }
|
||||
public virtual Client Client { get; set; }
|
||||
public virtual Implementer Implementer { get; set; }
|
||||
public virtual Implementer? Implementer { get; set; }
|
||||
public static Order? Create(OrderBindingModel? model)
|
||||
{
|
||||
if (model == null)
|
||||
@ -63,6 +62,7 @@ namespace AbstractPackageInstallationDatabaseImplement.Models
|
||||
}
|
||||
Status = model.Status;
|
||||
DateImplement = model.DateImplement;
|
||||
ImplementerId = model.ImplementerId;
|
||||
}
|
||||
|
||||
public OrderViewModel GetViewModel => new()
|
||||
@ -78,7 +78,7 @@ namespace AbstractPackageInstallationDatabaseImplement.Models
|
||||
DateImplement = DateImplement,
|
||||
PackageName = Package.PackageName,
|
||||
Email = Client.Email,
|
||||
ImplementerFIO = Implementer.ImplementerFIO
|
||||
ImplementerFIO = Implementer?.ImplementerFIO ?? string.Empty,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace AbstractSoftwareInstallationFileImplement.Models
|
||||
{
|
||||
public int PackageId { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
public int ImplementerId { get; private set; }
|
||||
public int? ImplementerId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public double Sum { get; private set; }
|
||||
|
@ -9,7 +9,7 @@ namespace AbstractSoftwareInstallationListImplement.Models
|
||||
{
|
||||
public int PackageId { get; private set; }
|
||||
public int ClientId { get; private set; }
|
||||
public int ImplementerId { get; private set; }
|
||||
public int? ImplementerId { get; private set; }
|
||||
public int Count { get; private set; }
|
||||
|
||||
public double Sum { get; private set; }
|
||||
@ -47,6 +47,7 @@ namespace AbstractSoftwareInstallationListImplement.Models
|
||||
}
|
||||
Status = model.Status;
|
||||
DateImplement = model.DateImplement;
|
||||
ImplementerId = model.ImplementerId;
|
||||
}
|
||||
public OrderViewModel GetViewModel => new()
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ namespace AbstractSoftwareInstallationRestApi.Controllers
|
||||
{
|
||||
return _order.ReadList(new OrderSearchModel
|
||||
{
|
||||
Statuses = new() { OrderStatus.Принят }
|
||||
Status = OrderStatus.Принят
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -102,5 +102,6 @@ namespace AbstractSoftwareInstallationRestApi.Controllers
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -36,13 +36,15 @@
|
||||
this.labelSum = new System.Windows.Forms.Label();
|
||||
this.buttonSave = new System.Windows.Forms.Button();
|
||||
this.buttonCancel = new System.Windows.Forms.Button();
|
||||
this.labelClient = new System.Windows.Forms.Label();
|
||||
this.comboBoxClient = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// comboBoxPackage
|
||||
//
|
||||
this.comboBoxPackage.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.comboBoxPackage.FormattingEnabled = true;
|
||||
this.comboBoxPackage.Location = new System.Drawing.Point(110, 24);
|
||||
this.comboBoxPackage.Location = new System.Drawing.Point(110, 55);
|
||||
this.comboBoxPackage.Name = "comboBoxPackage";
|
||||
this.comboBoxPackage.Size = new System.Drawing.Size(310, 23);
|
||||
this.comboBoxPackage.TabIndex = 0;
|
||||
@ -50,7 +52,7 @@
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
this.textBoxCount.Location = new System.Drawing.Point(110, 62);
|
||||
this.textBoxCount.Location = new System.Drawing.Point(110, 90);
|
||||
this.textBoxCount.Name = "textBoxCount";
|
||||
this.textBoxCount.Size = new System.Drawing.Size(310, 23);
|
||||
this.textBoxCount.TabIndex = 1;
|
||||
@ -58,7 +60,7 @@
|
||||
//
|
||||
// textBoxSum
|
||||
//
|
||||
this.textBoxSum.Location = new System.Drawing.Point(110, 101);
|
||||
this.textBoxSum.Location = new System.Drawing.Point(110, 122);
|
||||
this.textBoxSum.Name = "textBoxSum";
|
||||
this.textBoxSum.Size = new System.Drawing.Size(310, 23);
|
||||
this.textBoxSum.TabIndex = 2;
|
||||
@ -66,7 +68,7 @@
|
||||
// labelPackage
|
||||
//
|
||||
this.labelPackage.AutoSize = true;
|
||||
this.labelPackage.Location = new System.Drawing.Point(29, 27);
|
||||
this.labelPackage.Location = new System.Drawing.Point(29, 55);
|
||||
this.labelPackage.Name = "labelPackage";
|
||||
this.labelPackage.Size = new System.Drawing.Size(42, 15);
|
||||
this.labelPackage.TabIndex = 3;
|
||||
@ -75,7 +77,7 @@
|
||||
// labelCount
|
||||
//
|
||||
this.labelCount.AutoSize = true;
|
||||
this.labelCount.Location = new System.Drawing.Point(29, 65);
|
||||
this.labelCount.Location = new System.Drawing.Point(29, 87);
|
||||
this.labelCount.Name = "labelCount";
|
||||
this.labelCount.Size = new System.Drawing.Size(75, 15);
|
||||
this.labelCount.TabIndex = 4;
|
||||
@ -84,7 +86,7 @@
|
||||
// labelSum
|
||||
//
|
||||
this.labelSum.AutoSize = true;
|
||||
this.labelSum.Location = new System.Drawing.Point(29, 104);
|
||||
this.labelSum.Location = new System.Drawing.Point(29, 122);
|
||||
this.labelSum.Name = "labelSum";
|
||||
this.labelSum.Size = new System.Drawing.Size(48, 15);
|
||||
this.labelSum.TabIndex = 5;
|
||||
@ -92,7 +94,7 @@
|
||||
//
|
||||
// buttonSave
|
||||
//
|
||||
this.buttonSave.Location = new System.Drawing.Point(247, 132);
|
||||
this.buttonSave.Location = new System.Drawing.Point(250, 151);
|
||||
this.buttonSave.Name = "buttonSave";
|
||||
this.buttonSave.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonSave.TabIndex = 6;
|
||||
@ -102,7 +104,7 @@
|
||||
//
|
||||
// buttonCancel
|
||||
//
|
||||
this.buttonCancel.Location = new System.Drawing.Point(345, 132);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(345, 151);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 7;
|
||||
@ -110,11 +112,31 @@
|
||||
this.buttonCancel.UseVisualStyleBackColor = true;
|
||||
this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
|
||||
//
|
||||
// labelClient
|
||||
//
|
||||
this.labelClient.AutoSize = true;
|
||||
this.labelClient.Location = new System.Drawing.Point(29, 21);
|
||||
this.labelClient.Name = "labelClient";
|
||||
this.labelClient.Size = new System.Drawing.Size(49, 15);
|
||||
this.labelClient.TabIndex = 8;
|
||||
this.labelClient.Text = "Клиент:";
|
||||
//
|
||||
// comboBoxClient
|
||||
//
|
||||
this.comboBoxClient.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.comboBoxClient.FormattingEnabled = true;
|
||||
this.comboBoxClient.Location = new System.Drawing.Point(110, 18);
|
||||
this.comboBoxClient.Name = "comboBoxClient";
|
||||
this.comboBoxClient.Size = new System.Drawing.Size(310, 23);
|
||||
this.comboBoxClient.TabIndex = 9;
|
||||
//
|
||||
// FormCreateOrder
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(450, 167);
|
||||
this.ClientSize = new System.Drawing.Size(450, 186);
|
||||
this.Controls.Add(this.comboBoxClient);
|
||||
this.Controls.Add(this.labelClient);
|
||||
this.Controls.Add(this.buttonCancel);
|
||||
this.Controls.Add(this.buttonSave);
|
||||
this.Controls.Add(this.labelSum);
|
||||
@ -125,9 +147,9 @@
|
||||
this.Controls.Add(this.comboBoxPackage);
|
||||
this.Name = "FormCreateOrder";
|
||||
this.Text = "Заказ";
|
||||
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
this.Load += new System.EventHandler(this.FormCreateOrder_Load);
|
||||
|
||||
}
|
||||
|
||||
@ -141,5 +163,7 @@
|
||||
private Label labelSum;
|
||||
private Button buttonSave;
|
||||
private Button buttonCancel;
|
||||
private Label labelClient;
|
||||
private ComboBox comboBoxClient;
|
||||
}
|
||||
}
|
@ -10,12 +10,14 @@ namespace SoftwareInstallationView
|
||||
private readonly ILogger _logger;
|
||||
private readonly IPackageLogic _logicP;
|
||||
private readonly IOrderLogic _logicO;
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPackageLogic logicP, IOrderLogic logicO)
|
||||
private readonly IClientLogic _logicC;
|
||||
public FormCreateOrder(ILogger<FormCreateOrder> logger, IPackageLogic logicP, IOrderLogic logicO, IClientLogic logicC)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_logicP = logicP;
|
||||
_logicO = logicO;
|
||||
_logicC = logicC;
|
||||
LoadData();
|
||||
}
|
||||
private void LoadData()
|
||||
@ -38,6 +40,24 @@ namespace SoftwareInstallationView
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
_logger.LogInformation("Загрузка клиентов для заказа");
|
||||
try
|
||||
{
|
||||
var list = _logicC.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
comboBoxClient.DisplayMember = "ClientFIO";
|
||||
comboBoxClient.ValueMember = "Id";
|
||||
comboBoxClient.DataSource = list;
|
||||
comboBoxClient.SelectedItem = null;
|
||||
}
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки списка клиентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -97,7 +117,7 @@ namespace SoftwareInstallationView
|
||||
var operationResult = _logicO.CreateOrder(new OrderBindingModel
|
||||
{
|
||||
PackageId = Convert.ToInt32(comboBoxPackage.SelectedValue),
|
||||
//ClientId = Convert.ToInt32(comboBoxPackage.SelectedValue),
|
||||
ClientId = Convert.ToInt32(comboBoxClient.SelectedValue),
|
||||
Count = Convert.ToInt32(textBoxCount.Text),
|
||||
Sum = Convert.ToDouble(textBoxSum.Text)
|
||||
});
|
||||
@ -123,7 +143,6 @@ namespace SoftwareInstallationView
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -32,7 +32,6 @@ namespace SoftwareInstallationView
|
||||
{
|
||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||
this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
|
||||
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
||||
this.buttonRef = new System.Windows.Forms.Button();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
@ -46,7 +45,6 @@ namespace SoftwareInstallationView
|
||||
this.packageSoftwaresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ordersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.startWorksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buttonOrderReady = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@ -58,12 +56,12 @@ namespace SoftwareInstallationView
|
||||
this.dataGridView.Location = new System.Drawing.Point(1, 31);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.RowTemplate.Height = 25;
|
||||
this.dataGridView.Size = new System.Drawing.Size(602, 230);
|
||||
this.dataGridView.Size = new System.Drawing.Size(890, 230);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
//
|
||||
// buttonCreateOrder
|
||||
//
|
||||
this.buttonCreateOrder.Location = new System.Drawing.Point(628, 31);
|
||||
this.buttonCreateOrder.Location = new System.Drawing.Point(915, 31);
|
||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
||||
this.buttonCreateOrder.Size = new System.Drawing.Size(153, 23);
|
||||
this.buttonCreateOrder.TabIndex = 2;
|
||||
@ -71,16 +69,9 @@ namespace SoftwareInstallationView
|
||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||
this.buttonCreateOrder.Click += new System.EventHandler(this.buttonCreateOrder_Click);
|
||||
//
|
||||
// buttonTakeOrderInWork
|
||||
//
|
||||
this.buttonTakeOrderInWork.Location = new System.Drawing.Point(628, 121);
|
||||
this.buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||
this.buttonTakeOrderInWork.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonTakeOrderInWork.TabIndex = 8;
|
||||
//
|
||||
// buttonIssuedOrder
|
||||
//
|
||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(628, 171);
|
||||
this.buttonIssuedOrder.Location = new System.Drawing.Point(915, 60);
|
||||
this.buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||
this.buttonIssuedOrder.Size = new System.Drawing.Size(153, 23);
|
||||
this.buttonIssuedOrder.TabIndex = 5;
|
||||
@ -90,7 +81,7 @@ namespace SoftwareInstallationView
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
this.buttonRef.Location = new System.Drawing.Point(628, 219);
|
||||
this.buttonRef.Location = new System.Drawing.Point(915, 89);
|
||||
this.buttonRef.Name = "buttonRef";
|
||||
this.buttonRef.Size = new System.Drawing.Size(153, 23);
|
||||
this.buttonRef.TabIndex = 6;
|
||||
@ -106,7 +97,7 @@ namespace SoftwareInstallationView
|
||||
this.startWorksToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Size = new System.Drawing.Size(803, 24);
|
||||
this.menuStrip1.Size = new System.Drawing.Size(1098, 24);
|
||||
this.menuStrip1.TabIndex = 1;
|
||||
this.menuStrip1.Text = "Справочники";
|
||||
//
|
||||
@ -187,22 +178,13 @@ namespace SoftwareInstallationView
|
||||
this.startWorksToolStripMenuItem.Text = "Запуск работ";
|
||||
this.startWorksToolStripMenuItem.Click += new System.EventHandler(this.startWorksToolStripMenuItem_Click);
|
||||
//
|
||||
// buttonOrderReady
|
||||
//
|
||||
this.buttonOrderReady.Location = new System.Drawing.Point(628, 76);
|
||||
this.buttonOrderReady.Name = "buttonOrderReady";
|
||||
this.buttonOrderReady.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonOrderReady.TabIndex = 7;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(803, 263);
|
||||
this.ClientSize = new System.Drawing.Size(1098, 263);
|
||||
this.Controls.Add(this.buttonRef);
|
||||
this.Controls.Add(this.buttonIssuedOrder);
|
||||
this.Controls.Add(this.buttonOrderReady);
|
||||
this.Controls.Add(this.buttonTakeOrderInWork);
|
||||
this.Controls.Add(this.buttonCreateOrder);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Controls.Add(this.menuStrip1);
|
||||
@ -222,7 +204,6 @@ namespace SoftwareInstallationView
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button buttonCreateOrder;
|
||||
private Button buttonTakeOrderInWork;
|
||||
private Button buttonIssuedOrder;
|
||||
private Button buttonRef;
|
||||
private MenuStrip menuStrip1;
|
||||
@ -236,6 +217,5 @@ namespace SoftwareInstallationView
|
||||
private ToolStripMenuItem ordersToolStripMenuItem;
|
||||
private ToolStripMenuItem implementerToolStripMenuItem;
|
||||
private ToolStripMenuItem startWorksToolStripMenuItem;
|
||||
private Button buttonOrderReady;
|
||||
}
|
||||
}
|
@ -19,13 +19,15 @@ namespace SoftwareInstallationView
|
||||
private readonly ILogger _logger;
|
||||
private readonly IOrderLogic _orderLogic;
|
||||
private readonly IReportLogic _reportLogic;
|
||||
private readonly IWorkProcess _workProcess;
|
||||
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic , IReportLogic reportLogic)
|
||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic , IReportLogic reportLogic, IWorkProcess workProcess)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_orderLogic = orderLogic;
|
||||
_reportLogic = reportLogic;
|
||||
_workProcess = workProcess;
|
||||
}
|
||||
private void FormMain_Load(object sender, EventArgs e)
|
||||
{
|
||||
@ -160,8 +162,8 @@ namespace SoftwareInstallationView
|
||||
}
|
||||
private void startWorksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
//_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||
//MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user