сделано работает
This commit is contained in:
parent
0bcba6c95f
commit
946c7cf048
@ -1,4 +1,9 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
|
using ConfectioneryContracts.SearchModels;
|
||||||
|
using ConfectioneryContracts.StoragesContracts;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -13,113 +13,144 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryBusinessLogic
|
namespace ConfectioneryBusinessLogic
|
||||||
{
|
{
|
||||||
public class OrderLogic : IOrderLogic
|
public class OrderLogic : IOrderLogic
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
static readonly object _locker = new object();
|
||||||
{
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage)
|
||||||
_logger = logger;
|
{
|
||||||
_orderStorage = orderStorage;
|
_logger = logger;
|
||||||
}
|
_orderStorage = orderStorage;
|
||||||
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
}
|
||||||
{
|
public List<OrderViewModel>? ReadList(OrderSearchModel? model)
|
||||||
_logger.LogInformation("ReadList. OrderId:{Id}", model?.Id);
|
{
|
||||||
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
_logger.LogInformation("ReadList. ClientId:{ClientId}.Status:{Status}.ImplementerId:{ImplementerId}.DateFrom:{DateFrom}.DateTo:{DateTo}OrderId:{Id}",
|
||||||
if (list == null)
|
model?.ClientId, model?.Status, model?.ImplementerId, model?.DateFrom, model?.DateTo, model?.Id);
|
||||||
{
|
var list = model == null ? _orderStorage.GetFullList() : _orderStorage.GetFilteredList(model);
|
||||||
_logger.LogWarning("ReadList return null list");
|
if (list == null)
|
||||||
return null;
|
{
|
||||||
}
|
_logger.LogWarning("ReadList return null list");
|
||||||
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
return null;
|
||||||
return list;
|
}
|
||||||
}
|
_logger.LogInformation("ReadList. Count:{Count}", list.Count);
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
return list;
|
||||||
{
|
}
|
||||||
CheckModel(model);
|
public bool CreateOrder(OrderBindingModel model)
|
||||||
if (model.Status != OrderStatus.Неизвестен)
|
{
|
||||||
return false;
|
CheckModel(model);
|
||||||
model.Status = OrderStatus.Принят;
|
if (model.Status != OrderStatus.Неизвестен)
|
||||||
if (_orderStorage.Insert(model) == null)
|
return false;
|
||||||
{
|
model.Status = OrderStatus.Принят;
|
||||||
_logger.LogWarning("Insert operation failed");
|
if (_orderStorage.Insert(model) == null)
|
||||||
return false;
|
{
|
||||||
}
|
_logger.LogWarning("Insert operation failed");
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public bool TakeOrderInWork(OrderBindingModel model)
|
public bool TakeOrderInWork(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Выполняется);
|
lock (_locker)
|
||||||
}
|
{
|
||||||
|
return ChangeStatus(model, OrderStatus.Выполняется);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public bool FinishOrder(OrderBindingModel model)
|
public bool FinishOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Готов);
|
return ChangeStatus(model, OrderStatus.Готов);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool DeliveryOrder(OrderBindingModel model)
|
public bool DeliveryOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
return ChangeStatus(model, OrderStatus.Выдан);
|
return ChangeStatus(model, OrderStatus.Выдан);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
private void CheckModel(OrderBindingModel model, bool withParams = true)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
throw new ArgumentNullException(nameof(model));
|
||||||
}
|
}
|
||||||
if (!withParams)
|
if (!withParams)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (model.Count <= 0)
|
if (model.Count <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Колличество кондитерских изделий в заказе не может быть меньше 1", nameof(model.Count));
|
throw new ArgumentException("Колличество суши в заказе не может быть меньше 1", nameof(model.Count));
|
||||||
}
|
}
|
||||||
if (model.Sum <= 0)
|
if (model.Sum <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentException("Стоимость заказа на может быть меньше 1", nameof(model.Sum));
|
throw new ArgumentException("Стоимость заказа на может быть меньше 1", nameof(model.Sum));
|
||||||
}
|
}
|
||||||
if (model.DateImplement.HasValue && model.DateImplement < model.DateCreate)
|
if (model.DateImplement.HasValue && model.DateImplement < model.DateCreate)
|
||||||
{
|
{
|
||||||
throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} не может быть раньше даты его создания {model.DateCreate}");
|
throw new ArithmeticException($"Дата выдачи заказа {model.DateImplement} не может быть раньше даты его создания {model.DateCreate}");
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Pastry. PastryId:{PastryId}.Count:{Count}.Sum:{Sum}Id:{Id}",
|
_logger.LogInformation("Sushi. SushiId:{SushiId}.Count:{Count}.Sum:{Sum}Id:{Id}",
|
||||||
model.PastryId, model.Count, model.Sum, model.Id);
|
model.PastryId, model.Count, model.Sum, model.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ChangeStatus(OrderBindingModel model, OrderStatus requiredStatus)
|
private bool ChangeStatus(OrderBindingModel model, OrderStatus requiredStatus)
|
||||||
{
|
{
|
||||||
CheckModel(model, false);
|
CheckModel(model, false);
|
||||||
var element = _orderStorage.GetElement(new OrderSearchModel()
|
var element = _orderStorage.GetElement(new OrderSearchModel()
|
||||||
{
|
{
|
||||||
Id = model.Id
|
Id = model.Id
|
||||||
});
|
});
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(element));
|
throw new InvalidOperationException(nameof(element));
|
||||||
}
|
}
|
||||||
model.DateCreate = element.DateCreate;
|
model.DateCreate = element.DateCreate;
|
||||||
model.PastryId = element.PastryId;
|
model.PastryId = element.PastryId;
|
||||||
model.DateImplement = element.DateImplement;
|
model.DateImplement = element.DateImplement;
|
||||||
model.Status = element.Status;
|
model.ClientId = element.ClientId;
|
||||||
model.Count = element.Count;
|
if (!model.ImplementerId.HasValue)
|
||||||
model.Sum = element.Sum;
|
{
|
||||||
if (requiredStatus - model.Status == 1)
|
model.ImplementerId = element.ImplementerId;
|
||||||
{
|
}
|
||||||
model.Status = requiredStatus;
|
model.Status = element.Status;
|
||||||
if (model.Status == OrderStatus.Выдан)
|
model.Count = element.Count;
|
||||||
model.DateImplement = DateTime.Now;
|
model.Sum = element.Sum;
|
||||||
if (_orderStorage.Update(model) == null)
|
if (requiredStatus - model.Status == 1)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Update operation failed");
|
model.Status = requiredStatus;
|
||||||
return false;
|
if (model.Status == OrderStatus.Готов)
|
||||||
}
|
{
|
||||||
return true;
|
model.DateImplement = DateTime.Now;
|
||||||
}
|
}
|
||||||
_logger.LogWarning("Changing status operation faled: Current-{Status}:required-{requiredStatus}.", model.Status, requiredStatus);
|
if (_orderStorage.Update(model) == null)
|
||||||
throw new ArgumentException($"Невозможно присвоить статус {requiredStatus} заказу с текущим статусом {model.Status}");
|
{
|
||||||
}
|
_logger.LogWarning("Update operation failed");
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
_logger.LogWarning("Changing status operation faled: Current-{Status}:required-{requiredStatus}.", model.Status, requiredStatus);
|
||||||
|
throw new InvalidOperationException($"Невозможно приствоить статус {requiredStatus} заказу с текущим статусом {model.Status}");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrderViewModel? ReadElement(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
if (model == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException(nameof(model));
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement. ClientId:{ClientId}.Status:{Status}.ImplementerId:{ImplementerId}.DateFrom:{DateFrom}.DateTo:{DateTo}OrderId:{Id}",
|
||||||
|
model.ClientId, model.Status, model.ImplementerId, model.DateFrom, model.DateTo, model.Id);
|
||||||
|
var element = _orderStorage.GetElement(model);
|
||||||
|
if (element == null)
|
||||||
|
{
|
||||||
|
_logger.LogWarning("ReadElement element not found");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("ReadElement find. Id:{Id}", element.Id);
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using ConfectioneryDataModels;
|
using ConfectioneryDataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -8,15 +8,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryContracts.BindingModels
|
namespace ConfectioneryContracts.BindingModels
|
||||||
{
|
{
|
||||||
public class OrderBindingModel : IOrderModel
|
public class OrderBindingModel : IOrderModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int PastryId { get; set; }
|
public int PastryId { get; set; }
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
public int Count { get; set; }
|
public int? ImplementerId { get; set; }
|
||||||
public double Sum { get; set; }
|
public int Count { get; set; }
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
public double Sum { get; set; }
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
}
|
public DateTime? DateImplement { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.SearchModels;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.SearchModels;
|
using ConfectioneryContracts.SearchModels;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using ConfectioneryDataModels;
|
using ConfectioneryDataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
@ -9,26 +9,29 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryContracts.ViewModels
|
namespace ConfectioneryContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class OrderViewModel : IOrderModel
|
public class OrderViewModel : IOrderModel
|
||||||
{
|
{
|
||||||
[DisplayName("Номер")]
|
[DisplayName("Номер")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
|
|
||||||
[DisplayName("ФИО клиента")]
|
[DisplayName("ФИО клиента")]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
public int PastryId { get; set; }
|
public int? ImplementerId { get; set; }
|
||||||
[DisplayName("Изделие")]
|
[DisplayName("Исполнитель")]
|
||||||
public string PastryName { get; set; } = string.Empty;
|
public string? ImplementerFIO { get; set; } = null;
|
||||||
[DisplayName("Количество")]
|
public int PastryId { get; set; }
|
||||||
public int Count { get; set; }
|
[DisplayName("Изделие")]
|
||||||
[DisplayName("Сумма")]
|
public string PastryName { get; set; } = string.Empty;
|
||||||
public double Sum { get; set; }
|
[DisplayName("Количество")]
|
||||||
[DisplayName("Статус")]
|
public int Count { get; set; }
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
[DisplayName("Сумма")]
|
||||||
[DisplayName("Дата создания")]
|
public double Sum { get; set; }
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
[DisplayName("Статус")]
|
||||||
[DisplayName("Дата выполнения")]
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
public DateTime? DateImplement { get; set; }
|
[DisplayName("Дата создания")]
|
||||||
}
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
|
[DisplayName("Дата выполнения")]
|
||||||
|
public DateTime? DateImplement { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,15 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryDataModels.Models
|
namespace ConfectioneryDataModels.Models
|
||||||
{
|
{
|
||||||
public interface IOrderModel : IId
|
public interface IOrderModel : IId
|
||||||
{
|
{
|
||||||
int PastryId { get; }
|
int PastryId { get; }
|
||||||
int ClientId { get; }
|
int ClientId { get; }
|
||||||
int Count { get; }
|
int? ImplementerId { get; }
|
||||||
double Sum { get; }
|
int Count { get; }
|
||||||
OrderStatus Status { get; }
|
double Sum { get; }
|
||||||
DateTime DateCreate { get; }
|
OrderStatus Status { get; }
|
||||||
DateTime? DateImplement { get; }
|
DateTime DateCreate { get; }
|
||||||
}
|
DateTime? DateImplement { get; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace ConfectioneryDatabaseImplement
|
|||||||
{
|
{
|
||||||
if (optionsBuilder.IsConfigured == false)
|
if (optionsBuilder.IsConfigured == false)
|
||||||
{
|
{
|
||||||
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ConfectioneryDatabaseNew;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
optionsBuilder.UseSqlServer(@"Data Source=localhost\SQLEXPRESS;Initial Catalog=ConfectioneryDatabase11;Integrated Security=True;MultipleActiveResultSets=True;;TrustServerCertificate=True");
|
||||||
}
|
}
|
||||||
base.OnConfiguring(optionsBuilder);
|
base.OnConfiguring(optionsBuilder);
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using System;
|
||||||
using ConfectioneryContracts.ViewModels;
|
|
||||||
using ConfectioneryDataModels.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
|
||||||
using System.ComponentModel.DataAnnotations;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
|
using ConfectioneryDataModels.Models;
|
||||||
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
namespace ConfectioneryDatabaseImplement
|
namespace ConfectioneryDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
public class Implementer : IImplementerModel
|
public class Implementer : IImplementerModel
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryDatabaseImplement
|
namespace ConfectioneryDatabaseImplement.Implements
|
||||||
{
|
{
|
||||||
public class ImplementerStorage : IImplementerStorage
|
public class ImplementerStorage : IImplementerStorage
|
||||||
{
|
{
|
||||||
|
257
Confectionery/ConfectioneryDatabaseImplement/Migrations/20240603191022_Implementers.Designer.cs
generated
Normal file
257
Confectionery/ConfectioneryDatabaseImplement/Migrations/20240603191022_Implementers.Designer.cs
generated
Normal file
@ -0,0 +1,257 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ConfectioneryDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ConfectioneryDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ConfectioneryDatabase))]
|
||||||
|
[Migration("20240603191022_Implementers")]
|
||||||
|
partial class Implementers
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.17")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.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("ConfectioneryDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.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("ConfectioneryDatabaseImplement.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>("PastryId")
|
||||||
|
.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("PastryId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Pastry", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("PastryName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.ToTable("Pastrys");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("PastryId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("PastryId");
|
||||||
|
|
||||||
|
b.ToTable("PastryComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Order")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("PastryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
|
b.Navigation("Pastry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.PastryComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("PastryComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("PastryId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Pastry");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("PastryComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Pastry", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,108 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ConfectioneryDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Implementers : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int",
|
||||||
|
oldNullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
type: "int",
|
||||||
|
nullable: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Implementers",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(type: "int", nullable: false)
|
||||||
|
.Annotation("SqlServer:Identity", "1, 1"),
|
||||||
|
ImplementerFIO = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
Password = table.Column<string>(type: "nvarchar(max)", nullable: false),
|
||||||
|
WorkExperience = table.Column<int>(type: "int", nullable: false),
|
||||||
|
Qualification = table.Column<int>(type: "int", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Implementers", x => x.Id);
|
||||||
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Orders_ImplementerId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ImplementerId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
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_Clients_ClientId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Orders_Implementers_ImplementerId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Implementers");
|
||||||
|
|
||||||
|
migrationBuilder.DropIndex(
|
||||||
|
name: "IX_Orders_ImplementerId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "ImplementerId",
|
||||||
|
table: "Orders");
|
||||||
|
|
||||||
|
migrationBuilder.AlterColumn<int>(
|
||||||
|
name: "ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
type: "int",
|
||||||
|
nullable: true,
|
||||||
|
oldClrType: typeof(int),
|
||||||
|
oldType: "int");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Orders_Clients_ClientId",
|
||||||
|
table: "Orders",
|
||||||
|
column: "ClientId",
|
||||||
|
principalTable: "Clients",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -67,6 +67,33 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
b.ToTable("Components");
|
b.ToTable("Components");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.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("ConfectioneryDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
@ -75,7 +102,7 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int?>("ClientId")
|
b.Property<int>("ClientId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("Count")
|
b.Property<int>("Count")
|
||||||
@ -87,6 +114,9 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ImplementerId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("PastryId")
|
b.Property<int>("PastryId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -100,6 +130,8 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ClientId");
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ImplementerId");
|
||||||
|
|
||||||
b.HasIndex("PastryId");
|
b.HasIndex("PastryId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
@ -153,9 +185,15 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ConfectioneryDatabaseImplement.Models.Client", null)
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Client", "Client")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("ClientId");
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Implementer", "Implementer")
|
||||||
|
.WithMany("Order")
|
||||||
|
.HasForeignKey("ImplementerId");
|
||||||
|
|
||||||
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
b.HasOne("ConfectioneryDatabaseImplement.Models.Pastry", "Pastry")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
@ -163,6 +201,10 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Implementer");
|
||||||
|
|
||||||
b.Navigation("Pastry");
|
b.Navigation("Pastry");
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -195,6 +237,11 @@ namespace ConfectioneryDatabaseImplement.Migrations
|
|||||||
b.Navigation("PastryComponents");
|
b.Navigation("PastryComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Implementer", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Pastry", b =>
|
modelBuilder.Entity("ConfectioneryDatabaseImplement.Models.Pastry", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
@ -11,72 +11,80 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryDatabaseImplement.Models
|
namespace ConfectioneryDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
|
|
||||||
public virtual Client Client { get; private set; } = new();
|
public virtual Client Client { get; private set; } = new();
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int PastryId { get; private set; }
|
public int PastryId { get; private set; }
|
||||||
|
|
||||||
public virtual Pastry Pastry { get; set; } = new();
|
public virtual Pastry Pastry { get; set; } = new();
|
||||||
|
public int? ImplementerId { get; private set; }
|
||||||
|
public virtual Implementer? Implementer { get; set; } = new();
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||||
|
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
public static Order Create(ConfectioneryDatabase context, OrderBindingModel model)
|
public static Order Create(ConfectioneryDatabase context, OrderBindingModel model)
|
||||||
{
|
{
|
||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
ClientId = model.ClientId,
|
ClientId = model.ClientId,
|
||||||
Client = context.Clients.First(x => x.Id == model.ClientId),
|
Client = context.Clients.First(x => x.Id == model.ClientId),
|
||||||
PastryId = model.PastryId,
|
PastryId = model.PastryId,
|
||||||
Pastry = context.Pastrys.First(x => x.Id == model.PastryId),
|
Pastry = context.Pastrys.First(x => x.Id == model.PastryId),
|
||||||
Count = model.Count,
|
ImplementerId = model.ImplementerId,
|
||||||
Sum = model.Sum,
|
Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null,
|
||||||
Status = model.Status,
|
Count = model.Count,
|
||||||
DateCreate = model.DateCreate,
|
Sum = model.Sum,
|
||||||
DateImplement = model.DateImplement,
|
Status = model.Status,
|
||||||
};
|
DateCreate = model.DateCreate,
|
||||||
}
|
DateImplement = model.DateImplement,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(OrderBindingModel? model)
|
public void Update(ConfectioneryDatabase context, OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
DateImplement = model.DateImplement;
|
DateImplement = model.DateImplement;
|
||||||
}
|
ImplementerId = model.ImplementerId;
|
||||||
|
Implementer = model.ImplementerId.HasValue ? context.Implementers.First(x => x.Id == model.ImplementerId) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
ClientFIO = Client.ClientFIO,
|
ClientFIO = Client.ClientFIO,
|
||||||
PastryId = PastryId,
|
PastryId = PastryId,
|
||||||
PastryName = Pastry.PastryName,
|
PastryName = Pastry.PastryName,
|
||||||
Count = Count,
|
ImplementerId = ImplementerId,
|
||||||
Sum = Sum,
|
ImplementerFIO = Implementer != null ? Implementer.ImplementerFIO : null,
|
||||||
Status = Status,
|
Count = Count,
|
||||||
DateCreate = DateCreate,
|
Sum = Sum,
|
||||||
DateImplement = DateImplement,
|
Status = Status,
|
||||||
};
|
DateCreate = DateCreate,
|
||||||
}
|
DateImplement = DateImplement,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,77 +12,80 @@ using Microsoft.EntityFrameworkCore;
|
|||||||
|
|
||||||
namespace ConfectioneryDatabaseImplement.Implements
|
namespace ConfectioneryDatabaseImplement.Implements
|
||||||
{
|
{
|
||||||
public class OrderStorage : IOrderStorage
|
public class OrderStorage : IOrderStorage
|
||||||
{
|
{
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
return context.Orders.Include(x => x.Pastry).Include(x => x.Client).Select(x => x.GetViewModel).ToList();
|
return context.Orders.Include(x => x.Pastry).Include(x => x.Client).Include(y => y.Implementer).Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
if (model.DateFrom.HasValue)
|
if ((!model.DateFrom.HasValue || !model.DateTo.HasValue) && !model.ClientId.HasValue && !model.Status.HasValue)
|
||||||
{
|
{
|
||||||
return context.Orders.Include(x => x.Pastry).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
|
return new();
|
||||||
}
|
}
|
||||||
if (model.ClientId.HasValue)
|
return context.Orders.Include(x => x.Pastry).Include(x => x.Client).Include(x => x.Implementer).Where(x =>
|
||||||
{
|
(model.DateFrom.HasValue && model.DateTo.HasValue && x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo) ||
|
||||||
return context.Orders.Include(x => x.Pastry).Where(x => x.ClientId == model.ClientId).Select(x => x.GetViewModel).ToList();
|
(model.ClientId.HasValue && x.ClientId == model.ClientId) ||
|
||||||
}
|
(model.Status.HasValue && x.Status == model.Status))
|
||||||
return context.Orders.Include(x => x.Pastry).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
|
.Select(x => x.GetViewModel).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue && (!model.ImplementerId.HasValue || !model.Status.HasValue))
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
return context.Orders.Include(x => x.Pastry).FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
return context.Orders.Include(x => x.Pastry).Include(x => x.Client).Include(x => x.Implementer).FirstOrDefault(x =>
|
||||||
}
|
(model.Id.HasValue && x.Id == model.Id) ||
|
||||||
|
(model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId && x.Status == model.Status))
|
||||||
|
?.GetViewModel;
|
||||||
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
if (model == null)
|
if (model == null)
|
||||||
return null;
|
return null;
|
||||||
var newOrder = Order.Create(context, model);
|
var newOrder = Order.Create(context, model);
|
||||||
if (newOrder == null)
|
if (newOrder == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
context.Orders.Add(newOrder);
|
context.Orders.Add(newOrder);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return newOrder.GetViewModel;
|
return newOrder.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
var order = context.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (order == null)
|
if (order == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
order.Update(model);
|
order.Update(context, model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return order.GetViewModel;
|
return order.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
using var context = new ConfectioneryDatabase();
|
using var context = new ConfectioneryDatabase();
|
||||||
var order = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
var order = context.Orders.FirstOrDefault(rec => rec.Id == model.Id);
|
||||||
if (order != null)
|
if (order != null)
|
||||||
{
|
{
|
||||||
context.Orders.Remove(order);
|
context.Orders.Remove(order);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return order.GetViewModel;
|
return order.GetViewModel;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,87 +13,81 @@ namespace ConfectioneryFileImplement.Implements
|
|||||||
{
|
{
|
||||||
public class ImplementerStorage : IImplementerStorage
|
public class ImplementerStorage : IImplementerStorage
|
||||||
{
|
{
|
||||||
private readonly DataFileSingleton _source;
|
private readonly DataFileSingleton source;
|
||||||
|
|
||||||
public ImplementerStorage()
|
public ImplementerStorage()
|
||||||
{
|
{
|
||||||
_source = DataFileSingleton.GetInstance();
|
source = DataFileSingleton.GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFullList()
|
public List<ImplementerViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
return _source.Implementers.Select(x => x.GetViewModel).ToList();
|
return source.Implementers
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
public List<ImplementerViewModel> GetFilteredList(ImplementerSearchModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (string.IsNullOrEmpty(model.ImplementerFIO))
|
||||||
{
|
{
|
||||||
return new();
|
return new();
|
||||||
}
|
}
|
||||||
if (model.Id.HasValue)
|
return source.Implementers
|
||||||
{
|
.Where(x => x.ImplementerFIO.Contains(model.ImplementerFIO))
|
||||||
var res = GetElement(model);
|
|
||||||
return res != null ? new() { res } : new();
|
|
||||||
}
|
|
||||||
if (model.ImplementerFIO != null)
|
|
||||||
{
|
|
||||||
return _source.Implementers
|
|
||||||
.Where(x => x.ImplementerFIO.Equals(model.ImplementerFIO))
|
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
|
||||||
return new();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
public ImplementerViewModel? GetElement(ImplementerSearchModel model)
|
||||||
{
|
{
|
||||||
if (model.Id.HasValue)
|
if (string.IsNullOrEmpty(model.ImplementerFIO) && string.IsNullOrEmpty(model.Password) && !model.Id.HasValue)
|
||||||
{
|
{
|
||||||
return _source.Implementers.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel;
|
return null;
|
||||||
}
|
}
|
||||||
if (model.ImplementerFIO != null && model.Password != null)
|
return source.Implementers
|
||||||
{
|
.FirstOrDefault(x =>
|
||||||
return _source.Implementers.FirstOrDefault(x => x.ImplementerFIO.Equals(model.ImplementerFIO) && x.Password.Equals(model.Password))?.GetViewModel;
|
(!string.IsNullOrEmpty(model.ImplementerFIO) && x.ImplementerFIO == model.ImplementerFIO
|
||||||
}
|
&& (string.IsNullOrEmpty(model.Password) || x.Password == model.Password))
|
||||||
if (model.ImplementerFIO != null)
|
|| (model.Id.HasValue && x.Id == model.Id))
|
||||||
{
|
?.GetViewModel;
|
||||||
return _source.Implementers.FirstOrDefault(x => x.ImplementerFIO.Equals(model.ImplementerFIO))?.GetViewModel;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
public ImplementerViewModel? Insert(ImplementerBindingModel model)
|
||||||
{
|
{
|
||||||
model.Id = _source.Implementers.Count > 0 ? _source.Implementers.Max(x => x.Id) + 1 : 1;
|
model.Id = source.Implementers.Count > 0 ? source.Implementers.Max(x => x.Id) + 1 : 1;
|
||||||
var res = Implementer.Create(model);
|
var newImplementer = Implementer.Create(model);
|
||||||
if (res != null)
|
if (newImplementer == null)
|
||||||
{
|
{
|
||||||
_source.Implementers.Add(res);
|
return null;
|
||||||
_source.SaveImplementers();
|
|
||||||
}
|
}
|
||||||
return res?.GetViewModel;
|
source.Implementers.Add(newImplementer);
|
||||||
|
source.SaveImplementers();
|
||||||
|
return newImplementer.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
public ImplementerViewModel? Update(ImplementerBindingModel model)
|
||||||
{
|
{
|
||||||
var res = _source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
var implementer = source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (res != null)
|
if (implementer == null)
|
||||||
{
|
{
|
||||||
res.Update(model);
|
return null;
|
||||||
_source.SaveImplementers();
|
|
||||||
}
|
}
|
||||||
return res?.GetViewModel;
|
implementer.Update(model);
|
||||||
|
source.SaveImplementers();
|
||||||
|
return implementer.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
public ImplementerViewModel? Delete(ImplementerBindingModel model)
|
||||||
{
|
{
|
||||||
var res = _source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
var element = source.Implementers.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (res != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
_source.Implementers.Remove(res);
|
source.Implementers.Remove(element);
|
||||||
_source.SaveImplementers();
|
source.SaveImplementers();
|
||||||
|
return element.GetViewModel;
|
||||||
}
|
}
|
||||||
return res?.GetViewModel;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,82 +6,91 @@ using System.Xml.Linq;
|
|||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
public int PastryId { get; private set; }
|
public int? ImplementerId { get; set; }
|
||||||
public int Count { get; private set; }
|
public int PastryId { get; private set; }
|
||||||
public double Sum { get; private set; }
|
public int Count { get; private set; }
|
||||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
public double Sum { get; private set; }
|
||||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||||
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
PastryId = model.PastryId,
|
PastryId = model.PastryId,
|
||||||
Count = model.Count,
|
ClientId = model.ClientId,
|
||||||
Sum = model.Sum,
|
ImplementerId = model.ImplementerId,
|
||||||
Status = model.Status,
|
Count = model.Count,
|
||||||
DateCreate = model.DateCreate,
|
Sum = model.Sum,
|
||||||
DateImplement = model.DateImplement,
|
Status = model.Status,
|
||||||
};
|
DateCreate = model.DateCreate,
|
||||||
}
|
DateImplement = model.DateImplement,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static Order? Create(XElement element)
|
public static Order? Create(XElement element)
|
||||||
{
|
{
|
||||||
if (element == null)
|
if (element == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
string dateImplement = element.Element("DateImplement")!.Value;
|
string dateImplement = element.Element("DateImplement")!.Value;
|
||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
Id = Convert.ToInt32(element.Attribute("Id")!.Value),
|
||||||
PastryId = Convert.ToInt32(element.Element("PastryId")!.Value),
|
PastryId = Convert.ToInt32(element.Element("PastryId")!.Value),
|
||||||
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
ClientId = Convert.ToInt32(element.Element("ClientId")!.Value),
|
||||||
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
ImplementerId = Convert.ToInt32(element.Element("ImplementerId")!.Value),
|
||||||
Status = (OrderStatus)(Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value)),
|
Count = Convert.ToInt32(element.Element("Count")!.Value),
|
||||||
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
|
Sum = Convert.ToDouble(element.Element("Sum")!.Value),
|
||||||
DateImplement = (dateImplement == "" || dateImplement is null) ? Convert.ToDateTime(null) : Convert.ToDateTime(dateImplement)
|
Status = (OrderStatus)(Enum.Parse(typeof(OrderStatus), element.Element("Status")!.Value)),
|
||||||
};
|
DateCreate = Convert.ToDateTime(element.Element("DateCreate")!.Value),
|
||||||
}
|
DateImplement = (dateImplement == "" || dateImplement is null) ? Convert.ToDateTime(null) : Convert.ToDateTime(dateImplement)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(OrderBindingModel? model)
|
public void Update(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
if (model.Status == OrderStatus.Выдан) DateImplement = model.DateImplement;
|
if (model.Status == OrderStatus.Выдан) DateImplement = model.DateImplement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
PastryId = PastryId,
|
PastryId = PastryId,
|
||||||
Count = Count,
|
ClientId = ClientId,
|
||||||
Sum = Sum,
|
ImplementerId = ImplementerId,
|
||||||
Status = Status,
|
Count = Count,
|
||||||
DateCreate = DateCreate,
|
Sum = Sum,
|
||||||
DateImplement = DateImplement,
|
Status = Status,
|
||||||
};
|
DateCreate = DateCreate,
|
||||||
|
DateImplement = DateImplement,
|
||||||
|
};
|
||||||
|
|
||||||
public XElement GetXElement => new("Order",
|
public XElement GetXElement => new("Order",
|
||||||
new XAttribute("Id", Id),
|
new XAttribute("Id", Id),
|
||||||
new XElement("PastryId", PastryId.ToString()),
|
new XElement("PastryId", PastryId.ToString()),
|
||||||
new XElement("Count", Count.ToString()),
|
new XElement("ClientId", ClientId.ToString()),
|
||||||
new XElement("Sum", Sum.ToString()),
|
new XElement("ImplementerId", ImplementerId),
|
||||||
new XElement("Status", Status.ToString()),
|
new XElement("Count", Count.ToString()),
|
||||||
new XElement("DateCreate", DateCreate.ToString()),
|
new XElement("Sum", Sum.ToString()),
|
||||||
new XElement("DateImplement", DateImplement.ToString()));
|
new XElement("Status", Status.ToString()),
|
||||||
}
|
new XElement("DateCreate", DateCreate.ToString()),
|
||||||
|
new XElement("DateImplement", DateImplement.ToString()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,94 +1,129 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using System;
|
||||||
using ConfectioneryContracts.SearchModels;
|
|
||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using ConfectioneryContracts.ViewModels;
|
|
||||||
using ConfectioneryFileImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.SearchModels;
|
||||||
|
using ConfectioneryContracts.StoragesContracts;
|
||||||
|
using ConfectioneryContracts.ViewModels;
|
||||||
|
using ConfectioneryFileImplement.Models;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Implements
|
namespace ConfectioneryFileImplement.Implements
|
||||||
{
|
{
|
||||||
public class OrderStorage : IOrderStorage
|
public class OrderStorage : IOrderStorage
|
||||||
{
|
{
|
||||||
private readonly DataFileSingleton source;
|
private readonly DataFileSingleton source;
|
||||||
|
|
||||||
public OrderStorage()
|
public OrderStorage()
|
||||||
{
|
{
|
||||||
source = DataFileSingleton.GetInstance();
|
source = DataFileSingleton.GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList() => source.Orders.Select(x => AttachPastryName(x.GetViewModel)).ToList();
|
public List<OrderViewModel> GetFullList()
|
||||||
|
{
|
||||||
|
return source.Orders
|
||||||
|
.Select(x => AddInfo(x.GetViewModel))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (model.Id.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return source.Orders
|
||||||
}
|
.Where(x => x.Id == model.Id)
|
||||||
return source.Orders.Where(x => x.Id == model.Id).Select(x => AttachPastryName(x.GetViewModel)).ToList();
|
.Select(x => AddInfo(x.GetViewModel))
|
||||||
}
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
|
{
|
||||||
|
return source.Orders
|
||||||
|
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||||
|
.Select(x => AddInfo(x.GetViewModel))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (model.ClientId.HasValue)
|
||||||
|
{
|
||||||
|
return source.Orders
|
||||||
|
.Where(x => x.ClientId == model.ClientId)
|
||||||
|
.Select(x => AddInfo(x.GetViewModel))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (model.ImplementerId.HasValue)
|
||||||
|
{
|
||||||
|
return source.Orders
|
||||||
|
.Where(x => x.ImplementerId == model.ImplementerId)
|
||||||
|
.Select(x => AddInfo(x.GetViewModel))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
else if (model.Status != null)
|
||||||
|
{
|
||||||
|
return source.Orders
|
||||||
|
.Where(x => x.Status.Equals(model.Status))
|
||||||
|
.Select(x => AddInfo(x.GetViewModel))
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue && !model.ImplementerId.HasValue)
|
||||||
{
|
{
|
||||||
return new();
|
return null;
|
||||||
}
|
}
|
||||||
return AttachPastryName(source.Orders.FirstOrDefault(x => x.Id == model.Id)?.GetViewModel);
|
var order = source.Orders.FirstOrDefault(x =>
|
||||||
}
|
model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId && model.Status != null && x.Status.Equals(model.Status)
|
||||||
|
|| model.Status == null && model.ImplementerId.HasValue && x.ImplementerId == model.ImplementerId
|
||||||
|
|| model.Id.HasValue && x.Id == model.Id);
|
||||||
|
return order?.GetViewModel != null ? AddInfo(order.GetViewModel) : null;
|
||||||
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
model.Id = source.Orders.Count > 0 ? source.Orders.Max(x => x.Id) + 1 : 1;
|
model.Id = source.Orders.Count > 0 ? source.Orders.Max(x => x.Id) + 1 : 1;
|
||||||
var newOrder = Order.Create(model);
|
var newOrder = Order.Create(model);
|
||||||
if (newOrder == null)
|
if (newOrder == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
source.Orders.Add(newOrder);
|
source.Orders.Add(newOrder);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return AttachPastryName(newOrder.GetViewModel);
|
return AddInfo(newOrder.GetViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
var order = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
var order = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (order == null)
|
if (order == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return AttachPastryName(order.GetViewModel);
|
return AddInfo(order.GetViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
var order = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
var element = source.Orders.FirstOrDefault(x => x.Id == model.Id);
|
||||||
if (order != null)
|
if (element != null)
|
||||||
{
|
{
|
||||||
source.Orders.Remove(order);
|
source.Orders.Remove(element);
|
||||||
source.SaveOrders();
|
source.SaveOrders();
|
||||||
return AttachPastryName(order.GetViewModel);
|
return AddInfo(element.GetViewModel);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OrderViewModel? AttachPastryName(OrderViewModel? model)
|
private OrderViewModel AddInfo(OrderViewModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
var selectedPastry = source.Pastrys.FirstOrDefault(x => x.Id == model.PastryId);
|
||||||
{
|
model.PastryName = selectedPastry?.PastryName ?? string.Empty;
|
||||||
return null;
|
var selectedClient = source.Clients.FirstOrDefault(x => x.Id == model.ClientId);
|
||||||
}
|
model.ClientFIO = selectedClient?.ClientFIO ?? string.Empty;
|
||||||
var pastry = source.Pastrys.FirstOrDefault(x => x.Id == model.PastryId);
|
return model;
|
||||||
if (pastry != null)
|
}
|
||||||
{
|
}
|
||||||
model.PastryName = pastry.PastryName;
|
}
|
||||||
}
|
|
||||||
return model;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,27 +7,29 @@ using ConfectioneryListImplement.Models;
|
|||||||
|
|
||||||
namespace ConfectioneryListImplement
|
namespace ConfectioneryListImplement
|
||||||
{
|
{
|
||||||
public class DataListSingleton
|
public class DataListSingleton
|
||||||
{
|
{
|
||||||
private static DataListSingleton? _instance;
|
private static DataListSingleton? _instance;
|
||||||
public List<Component> Components { get; set; }
|
public List<Component> Components { get; set; }
|
||||||
public List<Order> Orders { get; set; }
|
public List<Order> Orders { get; set; }
|
||||||
public List<Pastry> Pastrys { get; set; }
|
public List<Pastry> Pastrys { get; set; }
|
||||||
public List<Client> Clients { get; set; }
|
public List<Client> Clients { get; set; }
|
||||||
private DataListSingleton()
|
public List<Implementer> Implementers { get; set; }
|
||||||
{
|
private DataListSingleton()
|
||||||
Components = new List<Component>();
|
{
|
||||||
Orders = new List<Order>();
|
Components = new List<Component>();
|
||||||
Pastrys = new List<Pastry>();
|
Orders = new List<Order>();
|
||||||
Clients = new List<Client>();
|
Pastrys = new List<Pastry>();
|
||||||
}
|
Clients = new List<Client>();
|
||||||
public static DataListSingleton GetInstance()
|
Implementers = new List<Implementer>();
|
||||||
{
|
}
|
||||||
if (_instance == null)
|
public static DataListSingleton GetInstance()
|
||||||
{
|
{
|
||||||
_instance = new DataListSingleton();
|
if (_instance == null)
|
||||||
}
|
{
|
||||||
return _instance;
|
_instance = new DataListSingleton();
|
||||||
}
|
}
|
||||||
}
|
return _instance;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using ConfectioneryContracts.SearchModels;
|
using ConfectioneryContracts.SearchModels;
|
||||||
using ConfectioneryContracts.StoragesContracts;
|
using ConfectioneryContracts.StoragesContracts;
|
||||||
using ConfectioneryContracts.ViewModels;
|
using ConfectioneryContracts.ViewModels;
|
||||||
|
using ConfectioneryListImplement.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@ -119,4 +120,4 @@ namespace ConfectioneryListImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,54 +10,59 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryListImplement.Models
|
namespace ConfectioneryListImplement.Models
|
||||||
{
|
{
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
public int PastryId { get; private set; }
|
public int PastryId { get; private set; }
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
public int Count { get; private set; }
|
public int? ImplementerId { get; private set; }
|
||||||
public double Sum { get; private set; }
|
public int Count { get; private set; }
|
||||||
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
public double Sum { get; private set; }
|
||||||
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
public OrderStatus Status { get; private set; } = OrderStatus.Неизвестен;
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime DateCreate { get; private set; } = DateTime.Now;
|
||||||
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
PastryId = model.PastryId,
|
PastryId = model.PastryId,
|
||||||
Count = model.Count,
|
ClientId = model.ClientId,
|
||||||
Sum = model.Sum,
|
ImplementerId = model.ImplementerId,
|
||||||
Status = model.Status,
|
Count = model.Count,
|
||||||
DateCreate = model.DateCreate,
|
Sum = model.Sum,
|
||||||
DateImplement = model.DateImplement,
|
Status = model.Status,
|
||||||
};
|
DateCreate = model.DateCreate,
|
||||||
}
|
DateImplement = model.DateImplement,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public void Update(OrderBindingModel? model)
|
public void Update(OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Status = model.Status;
|
Status = model.Status;
|
||||||
if (model.Status == OrderStatus.Выдан) DateImplement = model.DateImplement;
|
if (model.Status == OrderStatus.Выдан) DateImplement = model.DateImplement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel GetViewModel => new()
|
public OrderViewModel GetViewModel => new()
|
||||||
{
|
{
|
||||||
Id = Id,
|
Id = Id,
|
||||||
PastryId = PastryId,
|
PastryId = PastryId,
|
||||||
Count = Count,
|
ClientId = ClientId,
|
||||||
Sum = Sum,
|
ImplementerId = ImplementerId,
|
||||||
Status = Status,
|
Count = Count,
|
||||||
DateCreate = DateCreate,
|
Sum = Sum,
|
||||||
DateImplement = DateImplement,
|
Status = Status,
|
||||||
};
|
DateCreate = DateCreate,
|
||||||
}
|
DateImplement = DateImplement,
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,117 +9,169 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryListImplement
|
namespace ConfectioneryListImplement.Implements
|
||||||
{
|
{
|
||||||
public class OrderStorage : IOrderStorage
|
public class OrderStorage : IOrderStorage
|
||||||
{
|
{
|
||||||
private readonly DataListSingleton _source;
|
private readonly DataListSingleton _source;
|
||||||
|
|
||||||
public OrderStorage()
|
public OrderStorage()
|
||||||
{
|
{
|
||||||
_source = DataListSingleton.GetInstance();
|
_source = DataListSingleton.GetInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
result.Add(AttachPastryName(order.GetViewModel));
|
result.Add(AddInfo(order.GetViewModel));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
var result = new List<OrderViewModel>();
|
var result = new List<OrderViewModel>();
|
||||||
if (model == null || !model.Id.HasValue)
|
if (model.Id.HasValue)
|
||||||
{
|
{
|
||||||
return result;
|
foreach (var order in _source.Orders)
|
||||||
}
|
{
|
||||||
foreach (var order in _source.Orders)
|
if (order.Id == model.Id)
|
||||||
{
|
{
|
||||||
if (order.Id == model.Id)
|
result.Add(AddInfo(order.GetViewModel));
|
||||||
{
|
}
|
||||||
result.Add(AttachPastryName(order.GetViewModel));
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (model.DateFrom.HasValue && model.DateTo.HasValue)
|
||||||
return result;
|
{
|
||||||
}
|
foreach (var order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (order.DateCreate >= model.DateFrom && order.DateCreate <= model.DateTo)
|
||||||
|
{
|
||||||
|
result.Add(AddInfo(order.GetViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (model.ClientId.HasValue)
|
||||||
|
{
|
||||||
|
foreach (var order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (order.ClientId == model.ClientId)
|
||||||
|
{
|
||||||
|
result.Add(AddInfo(order.GetViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (model.ImplementerId.HasValue)
|
||||||
|
{
|
||||||
|
foreach (var order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (order.ImplementerId == model.ImplementerId)
|
||||||
|
{
|
||||||
|
result.Add(AddInfo(order.GetViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (model.Status != null)
|
||||||
|
{
|
||||||
|
foreach (var order in _source.Orders)
|
||||||
|
{
|
||||||
|
if (order.Status.Equals(model.Status))
|
||||||
|
{
|
||||||
|
result.Add(AddInfo(order.GetViewModel));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public OrderViewModel? GetElement(OrderSearchModel model)
|
public OrderViewModel? GetElement(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
if (!model.Id.HasValue)
|
if (!model.Id.HasValue && !model.ImplementerId.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (model.Id.HasValue && order.Id == model.Id)
|
if (order.Id == model.Id)
|
||||||
{
|
{
|
||||||
return AttachPastryName(order.GetViewModel);
|
return AddInfo(order.GetViewModel);
|
||||||
}
|
}
|
||||||
}
|
if (model.ImplementerId.HasValue && model.Status != null && order.ImplementerId == model.ImplementerId && order.Status.Equals(model.Status))
|
||||||
return null;
|
{
|
||||||
}
|
return AddInfo(order.GetViewModel);
|
||||||
|
}
|
||||||
|
if (model.ImplementerId.HasValue && model.Status == null && order.ImplementerId == model.ImplementerId)
|
||||||
|
{
|
||||||
|
return AddInfo(order.GetViewModel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
model.Id = 1;
|
model.Id = 1;
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (model.Id <= order.Id)
|
if (model.Id <= order.Id)
|
||||||
{
|
{
|
||||||
model.Id = order.Id + 1;
|
model.Id = order.Id + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var newOrder = Order.Create(model);
|
var newOrder = Order.Create(model);
|
||||||
if (newOrder == null)
|
if (newOrder == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
_source.Orders.Add(newOrder);
|
_source.Orders.Add(newOrder);
|
||||||
return AttachPastryName(newOrder.GetViewModel);
|
return AddInfo(newOrder.GetViewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
foreach (var order in _source.Orders)
|
foreach (var order in _source.Orders)
|
||||||
{
|
{
|
||||||
if (order.Id == model.Id)
|
if (order.Id == model.Id)
|
||||||
{
|
{
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
return AttachPastryName(order.GetViewModel);
|
return AddInfo(order.GetViewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Delete(OrderBindingModel model)
|
public OrderViewModel? Delete(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < _source.Orders.Count; ++i)
|
for (int i = 0; i < _source.Orders.Count; ++i)
|
||||||
{
|
{
|
||||||
if (_source.Orders[i].Id == model.Id)
|
if (_source.Orders[i].Id == model.Id)
|
||||||
{
|
{
|
||||||
var element = _source.Orders[i];
|
var element = _source.Orders[i];
|
||||||
_source.Orders.RemoveAt(i);
|
_source.Orders.RemoveAt(i);
|
||||||
return AttachPastryName(element.GetViewModel);
|
return AddInfo(element.GetViewModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OrderViewModel AttachPastryName(OrderViewModel model)
|
private OrderViewModel AddInfo(OrderViewModel model)
|
||||||
{
|
{
|
||||||
foreach (var Pastry in _source.Pastrys)
|
var selectedPastry = _source.Pastrys.Find(pastry => pastry.Id == model.PastryId);
|
||||||
{
|
if (selectedPastry != null)
|
||||||
if (Pastry.Id == model.PastryId)
|
{
|
||||||
{
|
model.PastryName = selectedPastry.PastryName;
|
||||||
model.PastryName = Pastry.PastryName;
|
}
|
||||||
return model;
|
foreach (var client in _source.Clients)
|
||||||
}
|
{
|
||||||
}
|
if (client.Id == model.ClientId)
|
||||||
return model;
|
{
|
||||||
}
|
model.ClientFIO = client.ClientFIO;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return model;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,8 @@ builder.Services.AddTransient<IPastryStorage, PastryStorage>();
|
|||||||
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
builder.Services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
builder.Services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
builder.Services.AddTransient<IPastryLogic, PastryLogic>();
|
builder.Services.AddTransient<IPastryLogic, PastryLogic>();
|
||||||
|
builder.Services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
builder.Services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
// Learn more about configuring Swagger/OpenAPI at
|
// Learn more about configuring Swagger/OpenAPI at
|
||||||
|
113
Confectionery/ConfectioneryView/FormImplementers.Designer.cs
generated
Normal file
113
Confectionery/ConfectioneryView/FormImplementers.Designer.cs
generated
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
namespace ConfectioneryView
|
||||||
|
{
|
||||||
|
partial class FormImplementers
|
||||||
|
{
|
||||||
|
/// <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()
|
||||||
|
{
|
||||||
|
dataGridView = new DataGridView();
|
||||||
|
buttonAdd = new Button();
|
||||||
|
buttonUpd = new Button();
|
||||||
|
buttonDel = new Button();
|
||||||
|
buttonRef = new Button();
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
|
SuspendLayout();
|
||||||
|
//
|
||||||
|
// dataGridView
|
||||||
|
//
|
||||||
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
|
dataGridView.Location = new Point(12, 12);
|
||||||
|
dataGridView.Name = "dataGridView";
|
||||||
|
dataGridView.RowHeadersWidth = 62;
|
||||||
|
dataGridView.Size = new Size(768, 492);
|
||||||
|
dataGridView.TabIndex = 0;
|
||||||
|
//
|
||||||
|
// buttonAdd
|
||||||
|
//
|
||||||
|
buttonAdd.Location = new Point(849, 59);
|
||||||
|
buttonAdd.Name = "buttonAdd";
|
||||||
|
buttonAdd.Size = new Size(112, 34);
|
||||||
|
buttonAdd.TabIndex = 1;
|
||||||
|
buttonAdd.Text = "Добавить";
|
||||||
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
|
//
|
||||||
|
// buttonUpd
|
||||||
|
//
|
||||||
|
buttonUpd.Location = new Point(849, 137);
|
||||||
|
buttonUpd.Name = "buttonUpd";
|
||||||
|
buttonUpd.Size = new Size(112, 34);
|
||||||
|
buttonUpd.TabIndex = 2;
|
||||||
|
buttonUpd.Text = "Изменить";
|
||||||
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
|
buttonUpd.Click += buttonUpd_Click;
|
||||||
|
//
|
||||||
|
// buttonDel
|
||||||
|
//
|
||||||
|
buttonDel.Location = new Point(849, 218);
|
||||||
|
buttonDel.Name = "buttonDel";
|
||||||
|
buttonDel.Size = new Size(112, 34);
|
||||||
|
buttonDel.TabIndex = 3;
|
||||||
|
buttonDel.Text = "Удалить";
|
||||||
|
buttonDel.UseVisualStyleBackColor = true;
|
||||||
|
buttonDel.Click += buttonDel_Click;
|
||||||
|
//
|
||||||
|
// buttonRef
|
||||||
|
//
|
||||||
|
buttonRef.Location = new Point(849, 296);
|
||||||
|
buttonRef.Name = "buttonRef";
|
||||||
|
buttonRef.Size = new Size(112, 34);
|
||||||
|
buttonRef.TabIndex = 4;
|
||||||
|
buttonRef.Text = "Обновить";
|
||||||
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
|
buttonRef.Click += buttonRef_Click;
|
||||||
|
//
|
||||||
|
// FormImplementers
|
||||||
|
//
|
||||||
|
AutoScaleDimensions = new SizeF(10F, 25F);
|
||||||
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
|
ClientSize = new Size(1028, 516);
|
||||||
|
Controls.Add(buttonRef);
|
||||||
|
Controls.Add(buttonDel);
|
||||||
|
Controls.Add(buttonUpd);
|
||||||
|
Controls.Add(buttonAdd);
|
||||||
|
Controls.Add(dataGridView);
|
||||||
|
Name = "FormImplementers";
|
||||||
|
Text = "Исполнители";
|
||||||
|
Load += FormImplementers_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private DataGridView dataGridView;
|
||||||
|
private Button buttonAdd;
|
||||||
|
private Button buttonUpd;
|
||||||
|
private Button buttonDel;
|
||||||
|
private Button buttonRef;
|
||||||
|
}
|
||||||
|
}
|
118
Confectionery/ConfectioneryView/FormImplementers.cs
Normal file
118
Confectionery/ConfectioneryView/FormImplementers.cs
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
using ConfectioneryContracts.BindingModels;
|
||||||
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
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;
|
||||||
|
|
||||||
|
namespace ConfectioneryView
|
||||||
|
{
|
||||||
|
public partial class FormImplementers : Form
|
||||||
|
{
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
private readonly IImplementerLogic _logic;
|
||||||
|
|
||||||
|
public FormImplementers(ILogger<FormImplementers> logger, IImplementerLogic implementerLogic)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_logic = implementerLogic;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerFIO"].AutoSizeMode =
|
||||||
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка исполнителей");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||||
|
MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FormImplementers_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||||
|
if (service is FormImplementer form)
|
||||||
|
{
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonUpd_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||||
|
if (service is FormImplementer form)
|
||||||
|
{
|
||||||
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||||
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Удаление исполнителя");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!_logic.Delete(new ImplementerBindingModel
|
||||||
|
{
|
||||||
|
Id = id
|
||||||
|
}))
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка удаления исполнителя");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка",
|
||||||
|
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buttonRef_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
120
Confectionery/ConfectioneryView/FormImplementers.resx
Normal file
120
Confectionery/ConfectioneryView/FormImplementers.resx
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 2.0
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">2.0</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||||
|
<comment>This is a comment</comment>
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
<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>
|
23
Confectionery/ConfectioneryView/FormMain.Designer.cs
generated
23
Confectionery/ConfectioneryView/FormMain.Designer.cs
generated
@ -38,12 +38,13 @@
|
|||||||
pastrysListToolStripMenuItem = new ToolStripMenuItem();
|
pastrysListToolStripMenuItem = new ToolStripMenuItem();
|
||||||
componentPastryToolStripMenuItem = new ToolStripMenuItem();
|
componentPastryToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ordersListToolStripMenuItem = new ToolStripMenuItem();
|
ordersListToolStripMenuItem = new ToolStripMenuItem();
|
||||||
|
startWorkToolStripMenuItem = new ToolStripMenuItem();
|
||||||
buttonCreateOrder = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonTakeOrderInWork = new Button();
|
buttonTakeOrderInWork = new Button();
|
||||||
buttonOrderReady = new Button();
|
buttonOrderReady = new Button();
|
||||||
buttonIssuedOrder = new Button();
|
buttonIssuedOrder = new Button();
|
||||||
buttonRef = new Button();
|
buttonRef = new Button();
|
||||||
startWorkToolStripMenuItem = new ToolStripMenuItem();
|
implementersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
menuStrip.SuspendLayout();
|
menuStrip.SuspendLayout();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@ -70,7 +71,7 @@
|
|||||||
//
|
//
|
||||||
// toolStripMenuItem
|
// toolStripMenuItem
|
||||||
//
|
//
|
||||||
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastryToolStripMenuItem, clientsToolStripMenuItem });
|
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, pastryToolStripMenuItem, clientsToolStripMenuItem, implementersToolStripMenuItem });
|
||||||
toolStripMenuItem.Name = "toolStripMenuItem";
|
toolStripMenuItem.Name = "toolStripMenuItem";
|
||||||
toolStripMenuItem.Size = new Size(139, 29);
|
toolStripMenuItem.Size = new Size(139, 29);
|
||||||
toolStripMenuItem.Text = "Справочники";
|
toolStripMenuItem.Text = "Справочники";
|
||||||
@ -124,6 +125,13 @@
|
|||||||
ordersListToolStripMenuItem.Text = "Список заказов";
|
ordersListToolStripMenuItem.Text = "Список заказов";
|
||||||
ordersListToolStripMenuItem.Click += ordersListToolStripMenuItem_Click;
|
ordersListToolStripMenuItem.Click += ordersListToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// startWorkToolStripMenuItem
|
||||||
|
//
|
||||||
|
startWorkToolStripMenuItem.Name = "startWorkToolStripMenuItem";
|
||||||
|
startWorkToolStripMenuItem.Size = new Size(136, 29);
|
||||||
|
startWorkToolStripMenuItem.Text = "Запуск работ";
|
||||||
|
startWorkToolStripMenuItem.Click += startWorkToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// buttonCreateOrder
|
// buttonCreateOrder
|
||||||
//
|
//
|
||||||
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
@ -179,12 +187,12 @@
|
|||||||
buttonRef.UseVisualStyleBackColor = true;
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
buttonRef.Click += buttonRef_Click;
|
buttonRef.Click += buttonRef_Click;
|
||||||
//
|
//
|
||||||
// startWorkToolStripMenuItem
|
// implementersToolStripMenuItem
|
||||||
//
|
//
|
||||||
startWorkToolStripMenuItem.Name = "startWorkToolStripMenuItem";
|
implementersToolStripMenuItem.Name = "implementersToolStripMenuItem";
|
||||||
startWorkToolStripMenuItem.Size = new Size(136, 29);
|
implementersToolStripMenuItem.Size = new Size(298, 34);
|
||||||
startWorkToolStripMenuItem.Text = "Запуск работ";
|
implementersToolStripMenuItem.Text = "Исполнители";
|
||||||
startWorkToolStripMenuItem.Click += startWorkToolStripMenuItem_Click;
|
implementersToolStripMenuItem.Click += implementersToolStripMenuItem_Click_1;
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
@ -227,5 +235,6 @@
|
|||||||
private ToolStripMenuItem ordersListToolStripMenuItem;
|
private ToolStripMenuItem ordersListToolStripMenuItem;
|
||||||
private ToolStripMenuItem clientsToolStripMenuItem;
|
private ToolStripMenuItem clientsToolStripMenuItem;
|
||||||
private ToolStripMenuItem startWorkToolStripMenuItem;
|
private ToolStripMenuItem startWorkToolStripMenuItem;
|
||||||
|
private ToolStripMenuItem implementersToolStripMenuItem;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,6 +43,7 @@ namespace ConfectioneryView
|
|||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["PastryId"].Visible = false;
|
dataGridView.Columns["PastryId"].Visible = false;
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
dataGridView.Columns["PastryName"].AutoSizeMode =
|
dataGridView.Columns["PastryName"].AutoSizeMode =
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
@ -211,5 +212,14 @@ namespace ConfectioneryView
|
|||||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void implementersToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||||
|
if (service is FormImplementers form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,55 +7,63 @@ using ConfectioneryDatabaseImplement.Implements;
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
|
using ConfectioneryBusinessLogic.BusinessLogics;
|
||||||
|
using Microsoft.EntityFrameworkCore.Design;
|
||||||
|
|
||||||
namespace ConfectioneryView
|
namespace ConfectioneryView
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
private static ServiceProvider? _serviceProvider;
|
private static ServiceProvider? _serviceProvider;
|
||||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main()
|
static void Main()
|
||||||
{
|
{
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
ConfigureServices(services);
|
ConfigureServices(services);
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
}
|
}
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
services.AddLogging(option =>
|
services.AddLogging(option =>
|
||||||
{
|
{
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
option.AddNLog("nlog.config");
|
option.AddNLog("nlog.config");
|
||||||
});
|
});
|
||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
services.AddTransient<IComponentStorage, ComponentStorage>();
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
services.AddTransient<IPastryStorage, PastryStorage>();
|
services.AddTransient<IPastryStorage, PastryStorage>();
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
|
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
|
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IPastryLogic, PastryLogic>();
|
services.AddTransient<IPastryLogic, PastryLogic>();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
services.AddTransient<FormComponent>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormComponents>();
|
services.AddTransient<FormComponent>();
|
||||||
services.AddTransient<FormCreateOrder>();
|
services.AddTransient<FormComponents>();
|
||||||
services.AddTransient<FormPastry>();
|
services.AddTransient<FormCreateOrder>();
|
||||||
services.AddTransient<FormPastryComponent>();
|
services.AddTransient<FormPastry>();
|
||||||
services.AddTransient<FormPastrys>();
|
services.AddTransient<FormPastryComponent>();
|
||||||
services.AddTransient<FormReportPastryComponents>();
|
services.AddTransient<FormPastrys>();
|
||||||
services.AddTransient<FormReportOrders>();
|
services.AddTransient<FormReportPastryComponents>();
|
||||||
|
services.AddTransient<FormReportOrders>();
|
||||||
services.AddTransient<FormClients>();
|
services.AddTransient<FormClients>();
|
||||||
|
services.AddTransient<FormImplementers>();
|
||||||
|
services.AddTransient<FormImplementer>();
|
||||||
|
services.AddTransient<EntityFrameworkDesignServicesBuilder>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user