гиперфиксация
This commit is contained in:
parent
96037fbe66
commit
0cb59e78e9
@ -17,12 +17,12 @@ namespace ComputerShopBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
private readonly IAssemblyStorage _assemblyStorage;
|
private readonly IComponentStorage _componentStorage;
|
||||||
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IAssemblyStorage assemblyStorage)
|
public OrderLogic(ILogger<OrderLogic> logger, IOrderStorage orderStorage, IComponentStorage componentStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
_assemblyStorage = assemblyStorage;
|
_componentStorage = componentStorage;
|
||||||
}
|
}
|
||||||
public bool CreateOrder(OrderBindingModel model)
|
public bool CreateOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -99,22 +99,17 @@ namespace ComputerShopBusinessLogic.BusinessLogics
|
|||||||
_logger.LogWarning("Order model not found");
|
_logger.LogWarning("Order model not found");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
OrderBindingModel model = new OrderBindingModel
|
|
||||||
{
|
|
||||||
Id = viewModel.Id,
|
|
||||||
ClientId = viewModel.ClientId,
|
|
||||||
Status = viewModel.Status,
|
|
||||||
DateCreate = viewModel.DateCreate,
|
|
||||||
DateImplement = viewModel.DateImplement,
|
|
||||||
Sum = viewModel.Sum
|
|
||||||
};
|
|
||||||
CheckModel(rawModel, false);
|
CheckModel(rawModel, false);
|
||||||
if (rawModel.Status + 1 != _newStatus)
|
if (rawModel.Status + 1 != _newStatus)
|
||||||
{
|
{
|
||||||
_logger.LogWarning("Status update to " + _newStatus.ToString() + " operation failed. Order status incorrect.");
|
_logger.LogWarning("Status update to " + _newStatus.ToString() + " operation failed. Order status incorrect.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (rawModel.Status == OrderStatus.Выдан) rawModel.DateImplement = DateTime.Now;
|
rawModel.Status = _newStatus;
|
||||||
|
if (rawModel.Status == OrderStatus.Выдан)
|
||||||
|
rawModel.DateImplement = DateTime.Now;
|
||||||
|
|
||||||
if (_orderStorage.Update(rawModel) == null)
|
if (_orderStorage.Update(rawModel) == null)
|
||||||
{
|
{
|
||||||
rawModel.Status--;
|
rawModel.Status--;
|
||||||
@ -139,39 +134,39 @@ namespace ComputerShopBusinessLogic.BusinessLogics
|
|||||||
}
|
}
|
||||||
if (model.Sum <= 0)
|
if (model.Sum <= 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("Сумма заказа должна быть больше 0", nameof(model.Sum));
|
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Order. OrderID:{Id}. Sum:{ Sum}. ClientId: { ClientId}", model.Id, model.Sum, model.ClientId);
|
_logger.LogInformation("Order. OrderID:{Id}. Sum:{ Sum}. ClientId: { ClientId}", model.Id, model.Sum, model.ClientId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddAssembly(OrderSearchModel model, AssemblySearchModel assemblymodel, int amount)
|
public bool AddComponent(OrderSearchModel model, ComponentSearchModel componentmodel, int amount)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException(nameof(model));
|
throw new ArgumentNullException(nameof(model));
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("AddAssemblyToOrder. AssemblyName:{AssemblyName}.Id:{ Id}", assemblymodel.AssemblyName, model.Id);
|
_logger.LogInformation("AddComponentToOrder. AssemblyName:{AssemblyName}.Id:{ Id}", componentmodel.ComponentName, model.Id);
|
||||||
var order = _orderStorage.GetElement(model);
|
var order = _orderStorage.GetElement(model);
|
||||||
var assembly = _assemblyStorage.GetElement(assemblymodel);
|
var component = _componentStorage.GetElement(componentmodel);
|
||||||
|
|
||||||
if (order == null || assembly == null)
|
if (order == null || component == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("AddAssemblyToOrder find. Id:{Id}", order.Id);
|
_logger.LogInformation("AddComponentToOrder find. Id:{Id}", order.Id);
|
||||||
|
|
||||||
order.OrderAssemblies[assembly.Id] = (assembly, amount);
|
order.OrderComponents[component.Id] = (component, amount);
|
||||||
|
|
||||||
_orderStorage.Update(new()
|
_orderStorage.Update(new()
|
||||||
{
|
{
|
||||||
Id = order.Id,
|
Id = order.Id,
|
||||||
Status = order.Status,
|
Status = order.Status,
|
||||||
Sum = order.Sum + assembly.Price * amount,
|
Sum = order.Sum + component.Cost * amount,
|
||||||
ClientId = order.ClientId,
|
ClientId = order.ClientId,
|
||||||
AssemblyOrders = order.OrderAssemblies
|
OrderComponents = order.OrderComponents
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -18,10 +18,5 @@ namespace ComputerShopContracts.BindingModels
|
|||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
} = new();
|
} = new();
|
||||||
public Dictionary<int, (IOrderModel, int)> AssemblyOrders
|
|
||||||
{
|
|
||||||
get;
|
|
||||||
set;
|
|
||||||
} = new();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,12 +15,12 @@ namespace ComputerShopContracts.BindingModels
|
|||||||
|
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
|
|
||||||
public DateTime DateCreate { get; set; }
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
public DateTime? DateImplement { get; set; } = DateTime.Now;
|
public DateTime? DateImplement { get; set; }
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
public Dictionary<int, (IAssemblyModel, int)> AssemblyOrders
|
public Dictionary<int, (IComponentModel, int)> OrderComponents
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
} = new();
|
} = new();
|
||||||
|
@ -18,6 +18,6 @@ namespace ComputerShopContracts.BusinessLogicContracts
|
|||||||
bool TakeOrderInWork(OrderBindingModel model);
|
bool TakeOrderInWork(OrderBindingModel model);
|
||||||
bool FinishOrder(OrderBindingModel model);
|
bool FinishOrder(OrderBindingModel model);
|
||||||
bool DeliveryOrder(OrderBindingModel model);
|
bool DeliveryOrder(OrderBindingModel model);
|
||||||
bool AddAssembly(OrderSearchModel ordermodel, AssemblySearchModel model, int amount);
|
bool AddComponent(OrderSearchModel ordermodel, ComponentSearchModel model, int amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,5 +11,6 @@ namespace ComputerShopContracts.SearchModels
|
|||||||
public int? Id { get; set; }
|
public int? Id { get; set; }
|
||||||
public string? ComponentName { get; set; }
|
public string? ComponentName { get; set; }
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
|
public int? OrderId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,5 +17,6 @@ namespace ComputerShopContracts.StorageContracts
|
|||||||
OrderViewModel? Insert(OrderBindingModel model);
|
OrderViewModel? Insert(OrderBindingModel model);
|
||||||
OrderViewModel? Update(OrderBindingModel model);
|
OrderViewModel? Update(OrderBindingModel model);
|
||||||
OrderViewModel? Delete(OrderBindingModel model);
|
OrderViewModel? Delete(OrderBindingModel model);
|
||||||
}
|
ComponentViewModel? GetComponentsByOrder(OrderSearchModel model);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,8 +19,8 @@ namespace ComputerShopContracts.ViewModels
|
|||||||
|
|
||||||
[DisplayName("Дата создания")]
|
[DisplayName("Дата создания")]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
public Dictionary<int, (IAssemblyModel, int)> OrderAssemblies
|
public Dictionary<int, (IComponentModel, int)> OrderComponents
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
} = new();
|
} = new();
|
||||||
|
@ -8,5 +8,6 @@ namespace ComputerShopDataModels.Models
|
|||||||
OrderStatus Status { get; }
|
OrderStatus Status { get; }
|
||||||
DateTime DateCreate { get; }
|
DateTime DateCreate { get; }
|
||||||
DateTime? DateImplement { get; }
|
DateTime? DateImplement { get; }
|
||||||
}
|
Dictionary<int, (IComponentModel, int)> OrderComponents { get; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ namespace ComputerShopDataModels.Models
|
|||||||
DateTime DateCreate { get; }
|
DateTime DateCreate { get; }
|
||||||
DateTime? DateImplement { get; }
|
DateTime? DateImplement { get; }
|
||||||
int? ReceivingId { get; }
|
int? ReceivingId { get; }
|
||||||
int? ComponentId { get; }
|
|
||||||
Dictionary<int, IOrderModel> SupplyOrders { get; }
|
Dictionary<int, IOrderModel> SupplyOrders { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ namespace ComputerShopDatabaseImplement
|
|||||||
public virtual DbSet<SupplyOrder> SupplyOrders { set; get; }
|
public virtual DbSet<SupplyOrder> SupplyOrders { set; get; }
|
||||||
public virtual DbSet<EquipmentReceiving> EquipmentReceivings { set; get; }
|
public virtual DbSet<EquipmentReceiving> EquipmentReceivings { set; get; }
|
||||||
public virtual DbSet<ComponentSupply> ComponentSupplies { set; get; }
|
public virtual DbSet<ComponentSupply> ComponentSupplies { set; get; }
|
||||||
public virtual DbSet<OrderAssembly> AssemblyOrders { set; get; }
|
public virtual DbSet<OrderComponent> OrderComponents { set; get; }
|
||||||
public virtual DbSet<Client> Clients { set; get; }
|
public virtual DbSet<Client> Clients { set; get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,8 +34,7 @@ namespace ComputerShopDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new ComputerShopDatabase();
|
using var context = new ComputerShopDatabase();
|
||||||
return context.EquipmentReceivings
|
return context.EquipmentReceivings.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
||||||
.FirstOrDefault(x => (model.Id.HasValue && x.Id == model.Id))?.GetViewModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<EquipmentReceivingViewModel> GetFilteredList(EquipmentReceivingSearchModel model)
|
public List<EquipmentReceivingViewModel> GetFilteredList(EquipmentReceivingSearchModel model)
|
||||||
|
@ -35,54 +35,57 @@ namespace ComputerShopDatabaseImplement.Implements
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new ComputerShopDatabase();
|
using var context = new ComputerShopDatabase();
|
||||||
return context.Orders
|
return context.Orders.FirstOrDefault(x => model.Id.HasValue && x.Id == model.Id)?.GetViewModel;
|
||||||
.FirstOrDefault(x =>
|
|
||||||
(model.Id.HasValue && x.Id == model.Id))
|
|
||||||
?.GetViewModel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
using var context = new ComputerShopDatabase();
|
|
||||||
if (model.ClientId.HasValue)
|
if (!model.ClientId.HasValue)
|
||||||
{
|
{
|
||||||
return context.Orders
|
return new();
|
||||||
.Include(x => x.Assemblies)
|
}
|
||||||
.Include(x => x.Client)
|
using var context = new ComputerShopDatabase();
|
||||||
|
if (model.DateFrom.HasValue & model.DateTo.HasValue)
|
||||||
|
{
|
||||||
|
return context.Orders
|
||||||
|
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
||||||
|
.Include(x => x.OrderComponents).Include(x => x.Client)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.Orders
|
||||||
|
.Include(x => x.Components)
|
||||||
|
.ThenInclude(x => x.Component)
|
||||||
.Where(x => x.ClientId == model.ClientId)
|
.Where(x => x.ClientId == model.ClientId)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
|
||||||
|
|
||||||
return context.Orders
|
|
||||||
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
|
|
||||||
.Include(x => x.Assemblies).Include(x => x.Client)
|
|
||||||
.Select(x => x.GetViewModel)
|
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<OrderViewModel> GetFullList()
|
public List<OrderViewModel> GetFullList()
|
||||||
{
|
{
|
||||||
using var context = new ComputerShopDatabase();
|
using var context = new ComputerShopDatabase();
|
||||||
return context.Orders
|
return context.Orders
|
||||||
.Include(x => x.Assemblies).Include(x => x.Client)
|
.Include(x => x.OrderComponents).Include(x => x.Client)
|
||||||
.Select(x => x.GetViewModel)
|
.Select(x => x.GetViewModel)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Insert(OrderBindingModel model)
|
public OrderViewModel? Insert(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
var newOrder = Order.Create(model);
|
using var context = new ComputerShopDatabase();
|
||||||
|
var newOrder = Order.Create(context, model);
|
||||||
|
|
||||||
if (newOrder == null)
|
if (newOrder == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
using var context = new ComputerShopDatabase();
|
|
||||||
context.Orders.Add(newOrder);
|
context.Orders.Add(newOrder);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return context.Orders.Include(x => x.Assemblies).Include(x => x.Client).FirstOrDefault(x => x.Id == newOrder.Id)?.GetViewModel;
|
return newOrder.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OrderViewModel? Update(OrderBindingModel model)
|
public OrderViewModel? Update(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
@ -94,7 +97,23 @@ namespace ComputerShopDatabaseImplement.Implements
|
|||||||
}
|
}
|
||||||
order.Update(model);
|
order.Update(model);
|
||||||
context.SaveChanges();
|
context.SaveChanges();
|
||||||
return context.Orders.Include(x => x.Assemblies).FirstOrDefault(x => x.Id == order.Id)?.GetViewModel;
|
return order.GetViewModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ComponentViewModel? GetComponentsByOrder(OrderSearchModel model)
|
||||||
|
{
|
||||||
|
using var context = new ComputerShopDatabase();
|
||||||
|
var order_components = context.OrderComponents.FirstOrDefault(x => x.OrderId == model.Id);
|
||||||
|
if (order_components == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
var components = context.Components.FirstOrDefault(x => x.Id == order_components.Id);
|
||||||
|
if (components == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return components.GetViewModel;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
550
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240516194435_1605.Designer.cs
generated
Normal file
550
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240516194435_1605.Designer.cs
generated
Normal file
@ -0,0 +1,550 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ComputerShopDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ComputerShopDatabase))]
|
||||||
|
[Migration("20240516194435_1605")]
|
||||||
|
partial class _1605
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("AssemblyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Assemblies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("AssemblyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AssemblyId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("AssemblyComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.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("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", 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>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("ComponentSupplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("EquipmentReceivings");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderAssembly", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("AssemblyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AssemblyId");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("AssemblyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("Purchases");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("ReceivingId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("ReceivingId");
|
||||||
|
|
||||||
|
b.ToTable("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("SupplyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Assemblies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("AssemblyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("AssemblyComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Assembly");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("EquipmentReceivings")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderAssembly", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("AssemblyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("Assemblies")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Assembly");
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ComponentId");
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ReceivingId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Receiving");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("SupplyOrders")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Assemblies");
|
||||||
|
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("EquipmentReceivings");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AssemblyComponents");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Assemblies");
|
||||||
|
|
||||||
|
b.Navigation("SupplyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class _1605 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
548
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240517100456_component.Designer.cs
generated
Normal file
548
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240517100456_component.Designer.cs
generated
Normal file
@ -0,0 +1,548 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ComputerShopDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ComputerShopDatabase))]
|
||||||
|
[Migration("20240517100456_component")]
|
||||||
|
partial class component
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("AssemblyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Assemblies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("AssemblyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AssemblyId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("AssemblyComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.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("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", 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>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("ComponentSupplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("EquipmentReceivings");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", 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>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("AssemblyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("Purchases");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ReceivingId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ReceivingId");
|
||||||
|
|
||||||
|
b.ToTable("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("SupplyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Assemblies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("AssemblyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("AssemblyComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Assembly");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("EquipmentReceivings")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", null)
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("OrderId");
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ReceivingId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Receiving");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Assemblies");
|
||||||
|
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("EquipmentReceivings");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AssemblyComponents");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class component : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_AssemblyOrders_Assemblies_AssemblyId",
|
||||||
|
table: "AssemblyOrders");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Supplies_Components_ComponentId",
|
||||||
|
table: "Supplies");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ComponentId",
|
||||||
|
table: "Supplies",
|
||||||
|
newName: "OrderId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_Supplies_ComponentId",
|
||||||
|
table: "Supplies",
|
||||||
|
newName: "IX_Supplies_OrderId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "AssemblyId",
|
||||||
|
table: "AssemblyOrders",
|
||||||
|
newName: "ComponentId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_AssemblyOrders_AssemblyId",
|
||||||
|
table: "AssemblyOrders",
|
||||||
|
newName: "IX_AssemblyOrders_ComponentId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AssemblyOrders_Components_ComponentId",
|
||||||
|
table: "AssemblyOrders",
|
||||||
|
column: "ComponentId",
|
||||||
|
principalTable: "Components",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Supplies_Orders_OrderId",
|
||||||
|
table: "Supplies",
|
||||||
|
column: "OrderId",
|
||||||
|
principalTable: "Orders",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_AssemblyOrders_Components_ComponentId",
|
||||||
|
table: "AssemblyOrders");
|
||||||
|
|
||||||
|
migrationBuilder.DropForeignKey(
|
||||||
|
name: "FK_Supplies_Orders_OrderId",
|
||||||
|
table: "Supplies");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "OrderId",
|
||||||
|
table: "Supplies",
|
||||||
|
newName: "ComponentId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_Supplies_OrderId",
|
||||||
|
table: "Supplies",
|
||||||
|
newName: "IX_Supplies_ComponentId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameColumn(
|
||||||
|
name: "ComponentId",
|
||||||
|
table: "AssemblyOrders",
|
||||||
|
newName: "AssemblyId");
|
||||||
|
|
||||||
|
migrationBuilder.RenameIndex(
|
||||||
|
name: "IX_AssemblyOrders_ComponentId",
|
||||||
|
table: "AssemblyOrders",
|
||||||
|
newName: "IX_AssemblyOrders_AssemblyId");
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_AssemblyOrders_Assemblies_AssemblyId",
|
||||||
|
table: "AssemblyOrders",
|
||||||
|
column: "AssemblyId",
|
||||||
|
principalTable: "Assemblies",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
|
||||||
|
migrationBuilder.AddForeignKey(
|
||||||
|
name: "FK_Supplies_Components_ComponentId",
|
||||||
|
table: "Supplies",
|
||||||
|
column: "ComponentId",
|
||||||
|
principalTable: "Components",
|
||||||
|
principalColumn: "Id");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
548
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240517104817_component1.Designer.cs
generated
Normal file
548
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240517104817_component1.Designer.cs
generated
Normal file
@ -0,0 +1,548 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ComputerShopDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ComputerShopDatabase))]
|
||||||
|
[Migration("20240517104817_component1")]
|
||||||
|
partial class component1
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("AssemblyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Assemblies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("AssemblyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AssemblyId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("AssemblyComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.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("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", 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>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("ComponentSupplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("EquipmentReceivings");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", 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>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("AssemblyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("Purchases");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ReceivingId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ReceivingId");
|
||||||
|
|
||||||
|
b.ToTable("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("SupplyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Assemblies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("AssemblyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("AssemblyComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Assembly");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("EquipmentReceivings")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", null)
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("OrderId");
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ReceivingId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Receiving");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Assemblies");
|
||||||
|
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("EquipmentReceivings");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AssemblyComponents");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,22 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class component1 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
548
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240517112046_component2.Designer.cs
generated
Normal file
548
ComputerShopProvider/ComputerShopDatabaseImplement/Migrations/20240517112046_component2.Designer.cs
generated
Normal file
@ -0,0 +1,548 @@
|
|||||||
|
// <auto-generated />
|
||||||
|
using System;
|
||||||
|
using ComputerShopDatabaseImplement;
|
||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
[DbContext(typeof(ComputerShopDatabase))]
|
||||||
|
[Migration("20240517112046_component2")]
|
||||||
|
partial class component2
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
|
{
|
||||||
|
#pragma warning disable 612, 618
|
||||||
|
modelBuilder
|
||||||
|
.HasAnnotation("ProductVersion", "7.0.4")
|
||||||
|
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
||||||
|
|
||||||
|
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<string>("AssemblyName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Price")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Assemblies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("AssemblyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("AssemblyId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("AssemblyComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.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("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<double>("Cost")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", 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>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("ComponentSupplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("EquipmentReceivings");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.ToTable("Orders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", 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>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.ToTable("OrderComponents");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("ComponentId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<string>("ComponentName")
|
||||||
|
.IsRequired()
|
||||||
|
.HasColumnType("nvarchar(max)");
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<double>("Sum")
|
||||||
|
.HasColumnType("float");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
|
b.ToTable("Purchases");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("ClientId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<DateTime>("DateCreate")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<DateTime?>("DateImplement")
|
||||||
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int?>("ReceivingId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("Status")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("ReceivingId");
|
||||||
|
|
||||||
|
b.ToTable("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.Property<int>("Id")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
|
b.Property<int>("Count")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.Property<int>("SupplyId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
|
b.HasIndex("SupplyId");
|
||||||
|
|
||||||
|
b.ToTable("SupplyOrders");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Assemblies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.AssemblyComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("AssemblyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("AssemblyComponents")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Assembly");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.ComponentSupply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("EquipmentReceivings")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany("Components")
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
|
.WithMany("Purchases")
|
||||||
|
.HasForeignKey("ComponentId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Component");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ClientId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", null)
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("OrderId");
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
|
||||||
|
.WithMany("Supplies")
|
||||||
|
.HasForeignKey("ReceivingId");
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
|
|
||||||
|
b.Navigation("Receiving");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
|
.WithMany()
|
||||||
|
.HasForeignKey("OrderId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.HasOne("ComputerShopDatabaseImplement.Models.Supply", "Supply")
|
||||||
|
.WithMany("Orders")
|
||||||
|
.HasForeignKey("SupplyId")
|
||||||
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Supply");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Assemblies");
|
||||||
|
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("EquipmentReceivings");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Component", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("AssemblyComponents");
|
||||||
|
|
||||||
|
b.Navigation("Purchases");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.EquipmentReceiving", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Supplies");
|
||||||
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
{
|
||||||
|
b.Navigation("Components");
|
||||||
|
|
||||||
|
b.Navigation("Orders");
|
||||||
|
});
|
||||||
|
#pragma warning restore 612, 618
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Metadata;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace ComputerShopDatabaseImplement.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class component2 : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "OrderComponents",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<int>(nullable: false)
|
||||||
|
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
|
||||||
|
OrderId = table.Column<int>(nullable: false),
|
||||||
|
ComponentId = table.Column<int>(nullable: false),
|
||||||
|
Count = table.Column<int>(nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_OrderComponents", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrderComponents_Orders_OrderId",
|
||||||
|
column: x => x.OrderId,
|
||||||
|
principalTable: "Orders",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_OrderComponents_Components_ComponentId",
|
||||||
|
column: x => x.ComponentId,
|
||||||
|
principalTable: "Components",
|
||||||
|
principalColumn: "Id",
|
||||||
|
onDelete: ReferentialAction.Cascade);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "OrderComponents");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -203,7 +203,7 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
b.ToTable("Orders");
|
b.ToTable("Orders");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderAssembly", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", b =>
|
||||||
{
|
{
|
||||||
b.Property<int>("Id")
|
b.Property<int>("Id")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@ -211,7 +211,7 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
||||||
|
|
||||||
b.Property<int>("AssemblyId")
|
b.Property<int>("ComponentId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("Count")
|
b.Property<int>("Count")
|
||||||
@ -222,11 +222,11 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.HasIndex("AssemblyId");
|
b.HasIndex("ComponentId");
|
||||||
|
|
||||||
b.HasIndex("OrderId");
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
b.ToTable("AssemblyOrders");
|
b.ToTable("OrderComponents");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Purchase", b =>
|
||||||
@ -282,15 +282,15 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
b.Property<int>("ClientId")
|
b.Property<int>("ClientId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int?>("ComponentId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
b.Property<DateTime>("DateCreate")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<DateTime?>("DateImplement")
|
b.Property<DateTime?>("DateImplement")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
|
b.Property<int?>("OrderId")
|
||||||
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int?>("ReceivingId")
|
b.Property<int?>("ReceivingId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
@ -301,7 +301,7 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ClientId");
|
b.HasIndex("ClientId");
|
||||||
|
|
||||||
b.HasIndex("ComponentId");
|
b.HasIndex("OrderId");
|
||||||
|
|
||||||
b.HasIndex("ReceivingId");
|
b.HasIndex("ReceivingId");
|
||||||
|
|
||||||
@ -405,28 +405,30 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
.WithMany("Orders")
|
.WithMany("Orders")
|
||||||
.HasForeignKey("ClientId")
|
.HasForeignKey("ClientId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
|
b.Navigation("Client");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderAssembly", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.OrderComponent", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ComputerShopDatabaseImplement.Models.Assembly", "Assembly")
|
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
||||||
.WithMany("Orders")
|
.WithMany()
|
||||||
.HasForeignKey("AssemblyId")
|
.HasForeignKey("ComponentId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
.WithMany("Assemblies")
|
.WithMany("Components")
|
||||||
.HasForeignKey("OrderId")
|
.HasForeignKey("OrderId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.Navigation("Assembly");
|
b.Navigation("Component");
|
||||||
|
|
||||||
b.Navigation("Order");
|
b.Navigation("Order");
|
||||||
});
|
});
|
||||||
@ -452,21 +454,21 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ComputerShopDatabaseImplement.Models.Client", null)
|
b.HasOne("ComputerShopDatabaseImplement.Models.Client", "Client")
|
||||||
.WithMany("Supplies")
|
.WithMany("Supplies")
|
||||||
.HasForeignKey("ClientId")
|
.HasForeignKey("ClientId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
|
|
||||||
b.HasOne("ComputerShopDatabaseImplement.Models.Component", "Component")
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", null)
|
||||||
.WithMany()
|
.WithMany("Supplies")
|
||||||
.HasForeignKey("ComponentId");
|
.HasForeignKey("OrderId");
|
||||||
|
|
||||||
b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
|
b.HasOne("ComputerShopDatabaseImplement.Models.EquipmentReceiving", "Receiving")
|
||||||
.WithMany("Supplies")
|
.WithMany("Supplies")
|
||||||
.HasForeignKey("ReceivingId");
|
.HasForeignKey("ReceivingId");
|
||||||
|
|
||||||
b.Navigation("Component");
|
b.Navigation("Client");
|
||||||
|
|
||||||
b.Navigation("Receiving");
|
b.Navigation("Receiving");
|
||||||
});
|
});
|
||||||
@ -474,7 +476,7 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.SupplyOrder", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
b.HasOne("ComputerShopDatabaseImplement.Models.Order", "Order")
|
||||||
.WithMany("SupplyOrders")
|
.WithMany()
|
||||||
.HasForeignKey("OrderId")
|
.HasForeignKey("OrderId")
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
.OnDelete(DeleteBehavior.Cascade)
|
||||||
.IsRequired();
|
.IsRequired();
|
||||||
@ -493,8 +495,6 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Assembly", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Components");
|
b.Navigation("Components");
|
||||||
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Client", b =>
|
||||||
@ -528,9 +528,9 @@ namespace ComputerShopDatabaseImplement.Migrations
|
|||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Order", b =>
|
||||||
{
|
{
|
||||||
b.Navigation("Assemblies");
|
b.Navigation("Components");
|
||||||
|
|
||||||
b.Navigation("SupplyOrders");
|
b.Navigation("Supplies");
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
modelBuilder.Entity("ComputerShopDatabaseImplement.Models.Supply", b =>
|
||||||
|
@ -22,7 +22,6 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
[Required]
|
[Required]
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
private Dictionary<int, (IComponentModel, int)>? _assemblyComponents = null;
|
private Dictionary<int, (IComponentModel, int)>? _assemblyComponents = null;
|
||||||
[NotMapped]
|
|
||||||
public Dictionary<int, (IComponentModel, int)> AssemblyComponents
|
public Dictionary<int, (IComponentModel, int)> AssemblyComponents
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -38,8 +37,6 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
}
|
}
|
||||||
|
|
||||||
public virtual List<AssemblyComponent> Components { get; set; } = new();
|
public virtual List<AssemblyComponent> Components { get; set; } = new();
|
||||||
[ForeignKey("AssemblyId")]
|
|
||||||
public virtual List<OrderAssembly> Orders { get; set; } = new();
|
|
||||||
public virtual Client Client { get; set; }
|
public virtual Client Client { get; set; }
|
||||||
public static Assembly Create(ComputerShopDatabase context, AssemblyBindingModel model)
|
public static Assembly Create(ComputerShopDatabase context, AssemblyBindingModel model)
|
||||||
{
|
{
|
||||||
@ -55,12 +52,6 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
Component = context.Components.First(y => y.Id == x.Key),
|
Component = context.Components.First(y => y.Id == x.Key),
|
||||||
Count = x.Value.Item2
|
Count = x.Value.Item2
|
||||||
}).ToList(),
|
}).ToList(),
|
||||||
Orders = model.AssemblyOrders.Select(x => new
|
|
||||||
OrderAssembly
|
|
||||||
{
|
|
||||||
Order = context.Orders.First(y => y.Id == x.Key),
|
|
||||||
Count = x.Value.Item2
|
|
||||||
}).ToList()
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
public void Update(AssemblyBindingModel model)
|
public void Update(AssemblyBindingModel model)
|
||||||
|
@ -25,7 +25,7 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
[ForeignKey("ComponentId")]
|
[ForeignKey("ComponentId")]
|
||||||
public virtual List<Purchase> Purchases { get; set; } = new();
|
public virtual List<Purchase> Purchases { get; set; } = new();
|
||||||
[ForeignKey("ComponentId")]
|
[ForeignKey("ComponentId")]
|
||||||
public virtual List<ComponentSupply> Supplies { get; set; } = new();
|
public virtual List<ComponentSupply> Supplies { get; set; } = new();
|
||||||
public static Component? Create(ComponentBindingModel model)
|
public static Component? Create(ComponentBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
|
@ -23,37 +23,46 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
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; }
|
||||||
[ForeignKey("OrderId")]
|
|
||||||
public virtual List<SupplyOrder>? SupplyOrders { get; set; } = new();
|
|
||||||
|
|
||||||
[ForeignKey("OrderId")]
|
[ForeignKey("OrderId")]
|
||||||
public virtual List<OrderAssembly>? Assemblies { get; set; } = new();
|
private Dictionary<int, (IComponentModel, int)>? _orderComponents = null;
|
||||||
private Dictionary<int, (IOrderModel, int)>? _assemblyOrders = null;
|
|
||||||
|
|
||||||
[NotMapped]
|
public Dictionary<int, (IComponentModel, int)> OrderComponents
|
||||||
public Dictionary<int, (IOrderModel, int)> AssemblyOrders
|
{
|
||||||
{
|
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_assemblyOrders == null)
|
if (_orderComponents == null)
|
||||||
{
|
{
|
||||||
_assemblyOrders = Assemblies
|
_orderComponents = Components
|
||||||
.ToDictionary(recPC => recPC.AssemblyId, recPC =>
|
.ToDictionary(recPC => recPC.ComponentId, recPC =>
|
||||||
(recPC.Order as IOrderModel, recPC.Count));
|
(recPC.Component as IComponentModel, recPC.Count));
|
||||||
}
|
}
|
||||||
return _assemblyOrders;
|
return _orderComponents;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Required]
|
[ForeignKey("OrderId")]
|
||||||
|
public virtual List<OrderComponent> Components { get; set; } = new();
|
||||||
|
[ForeignKey("OrderId")]
|
||||||
|
public virtual List<Supply>? Supplies { get; set; } = new();
|
||||||
|
|
||||||
|
[Required]
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
public virtual Client? Client { get; set; }
|
public virtual Client? Client { get; set; }
|
||||||
public static Order? Create(OrderBindingModel model)
|
public static Order? Create(ComputerShopDatabase context, OrderBindingModel model)
|
||||||
{
|
{
|
||||||
if (model == null)
|
if (model == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
var order_comp = model.OrderComponents.Select(x => new
|
||||||
|
OrderComponent
|
||||||
|
{
|
||||||
|
Component = context.Components.First(y => y.Id == x.Key),
|
||||||
|
Count = x.Value.Item2
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
return new Order()
|
return new Order()
|
||||||
{
|
{
|
||||||
Id = model.Id,
|
Id = model.Id,
|
||||||
@ -61,7 +70,8 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
Status = model.Status,
|
Status = model.Status,
|
||||||
DateCreate = model.DateCreate,
|
DateCreate = model.DateCreate,
|
||||||
DateImplement = model.DateImplement,
|
DateImplement = model.DateImplement,
|
||||||
ClientId = model.ClientId
|
ClientId = model.ClientId,
|
||||||
|
Components = order_comp
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,6 +91,7 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
Status = Status,
|
Status = Status,
|
||||||
DateCreate = DateCreate,
|
DateCreate = DateCreate,
|
||||||
DateImplement = DateImplement,
|
DateImplement = DateImplement,
|
||||||
|
OrderComponents = OrderComponents,
|
||||||
ClientId = ClientId
|
ClientId = ClientId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,16 +7,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ComputerShopDatabaseImplement.Models
|
namespace ComputerShopDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
internal class OrderAssembly
|
internal class OrderComponent
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int AssemblyId { get; set; }
|
public int OrderId { get; set; }
|
||||||
[Required]
|
|
||||||
public int OrderId { get; set; }
|
|
||||||
[Required]
|
[Required]
|
||||||
|
public int ComponentId { get; set; }
|
||||||
|
[Required]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public virtual Order Order { get; set; } = new();
|
public virtual Order Order { get; set; } = new();
|
||||||
public virtual Assembly Assembly { get; set; } = new();
|
public virtual Component Component { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -26,8 +26,6 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
public virtual Client? Client { get; set; }
|
public virtual Client? Client { get; set; }
|
||||||
public int? ReceivingId { get; set; }
|
public int? ReceivingId { get; set; }
|
||||||
public virtual EquipmentReceiving? Receiving { get; set; }
|
public virtual EquipmentReceiving? Receiving { get; set; }
|
||||||
public int? ComponentId { get; set; }
|
|
||||||
public virtual Component? Component { get; set; }
|
|
||||||
|
|
||||||
private Dictionary<int, IOrderModel>? _supplyOrders =
|
private Dictionary<int, IOrderModel>? _supplyOrders =
|
||||||
null;
|
null;
|
||||||
@ -59,7 +57,6 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
DateCreate = model.DateCreate,
|
DateCreate = model.DateCreate,
|
||||||
DateImplement = model.DateImplement,
|
DateImplement = model.DateImplement,
|
||||||
ReceivingId = model.ReceivingId,
|
ReceivingId = model.ReceivingId,
|
||||||
ComponentId = model.ComponentId,
|
|
||||||
Orders = model.SupplyOrders.Select(x => new
|
Orders = model.SupplyOrders.Select(x => new
|
||||||
SupplyOrder
|
SupplyOrder
|
||||||
{
|
{
|
||||||
@ -85,7 +82,6 @@ namespace ComputerShopDatabaseImplement.Models
|
|||||||
SupplyOrders = SupplyOrders,
|
SupplyOrders = SupplyOrders,
|
||||||
ReceivingId = ReceivingId,
|
ReceivingId = ReceivingId,
|
||||||
ClientId = ClientId,
|
ClientId = ClientId,
|
||||||
ComponentId = ComponentId,
|
|
||||||
};
|
};
|
||||||
public void UpdateOrders(ComputerShopDatabase context, SupplyBindingModel model)
|
public void UpdateOrders(ComputerShopDatabase context, SupplyBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -7,16 +7,16 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ComputerShopDatabaseImplement.Models
|
namespace ComputerShopDatabaseImplement.Models
|
||||||
{
|
{
|
||||||
internal class SupplyOrder
|
internal class SupplyOrder
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int OrderId { get; set; }
|
public int SupplyId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int SupplyId { get; set; }
|
public int OrderId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
public virtual Order Order { get; set; } = new();
|
public virtual Supply Supply { get; set; } = new();
|
||||||
public virtual Supply Supply { get; set; } = new();
|
public virtual Order Order { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,5 +88,6 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,9 @@ using ComputerShopContracts.BusinessLogicContracts;
|
|||||||
using ComputerShopContracts.SearchModels;
|
using ComputerShopContracts.SearchModels;
|
||||||
using ComputerShopContracts.StorageContracts;
|
using ComputerShopContracts.StorageContracts;
|
||||||
using ComputerShopContracts.ViewModels;
|
using ComputerShopContracts.ViewModels;
|
||||||
|
using ComputerShopDatabaseImplement.Implements;
|
||||||
|
using DocumentFormat.OpenXml.Bibliography;
|
||||||
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@ -17,10 +20,12 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
private readonly IOrderLogic _order;
|
private readonly IOrderLogic _order;
|
||||||
private readonly IOrderStorage _orderStorage;
|
private readonly IOrderStorage _orderStorage;
|
||||||
|
|
||||||
public OrderController(ILogger<MainController> logger, IOrderLogic order, ISupplyLogic supply)
|
public OrderController(ILogger<MainController> logger, IOrderLogic order, ISupplyLogic supply, IOrderStorage orderStorage)
|
||||||
{
|
{
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_order = order;
|
_order = order;
|
||||||
|
_orderStorage = orderStorage;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -38,7 +43,22 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
|
public List<OrderViewModel>? GetOrder(int id)
|
||||||
|
{
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _order.ReadList(new OrderSearchModel { Id = id });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения заказа");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
public List<OrderViewModel>? GetOrders(int clientId)
|
public List<OrderViewModel>? GetOrders(int clientId)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -65,7 +85,7 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[HttpDelete]
|
[HttpPost]
|
||||||
public void DeleteOrder(OrderBindingModel model)
|
public void DeleteOrder(OrderBindingModel model)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -127,6 +147,7 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var order = _orderStorage.GetElement(new() { Id = id });
|
var order = _orderStorage.GetElement(new() { Id = id });
|
||||||
|
|
||||||
OrderBindingModel model = new OrderBindingModel()
|
OrderBindingModel model = new OrderBindingModel()
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
@ -138,17 +159,17 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка изменения закупки");
|
_logger.LogError(ex, "Ошибка изменения получения техники");
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void AddAssembly(Tuple<OrderSearchModel, AssemblySearchModel, int> model)
|
public void AddComponent(Tuple<OrderSearchModel, ComponentSearchModel, int> model)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_order.AddAssembly(model.Item1, model.Item2, model.Item3);
|
_order.AddComponent(model.Item1, model.Item2, model.Item3);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -156,5 +177,32 @@ namespace ComputerShopRestApi.Controllers
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void EditOrder(OrderBindingModel model)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_order.Update(model);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка обновления заказа.");
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[HttpGet]
|
||||||
|
public ComponentViewModel? GetComponentsByOrder(int orderId)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return _orderStorage.GetComponentsByOrder(new OrderSearchModel(){ Id = orderId });
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка получения компонента по orderid={Id}", orderId);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
using ComputerShopContracts.BindingModels;
|
using ComputerShopContracts.BindingModels;
|
||||||
using ComputerShopContracts.SearchModels;
|
using ComputerShopContracts.SearchModels;
|
||||||
using ComputerShopContracts.ViewModels;
|
using ComputerShopContracts.ViewModels;
|
||||||
|
using DocumentFormat.OpenXml.Drawing.Charts;
|
||||||
using DocumentFormat.OpenXml.Office2010.Excel;
|
using DocumentFormat.OpenXml.Office2010.Excel;
|
||||||
|
using Microsoft.AspNetCore.Components;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using OrdererClientApp.Models;
|
using OrdererClientApp.Models;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
namespace OrdererClientApp.Controllers
|
namespace OrdererClientApp.Controllers
|
||||||
{
|
{
|
||||||
@ -18,7 +21,16 @@ namespace OrdererClientApp.Controllers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult Index()
|
public IActionResult Index()
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
return View(APIClient.GetRequest<List<EquipmentReceivingViewModel>>($"api/equipmentreceiving/getreceivings?clientId={APIClient.Client.Id}"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public IActionResult Receivings()
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
{
|
{
|
||||||
@ -33,7 +45,7 @@ namespace OrdererClientApp.Controllers
|
|||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
return View(APIClient.GetRequest<List<OrderViewModel>>($"api/order/GetOrderList?clientId={APIClient.Client.Id}"));
|
return View(APIClient.GetRequest<List<OrderViewModel>>($"api/order/getorderlist?clientId={APIClient.Client.Id}"));
|
||||||
}
|
}
|
||||||
public IActionResult Supply()
|
public IActionResult Supply()
|
||||||
{
|
{
|
||||||
@ -76,7 +88,7 @@ namespace OrdererClientApp.Controllers
|
|||||||
APIClient.Client.ClientFIO = fio;
|
APIClient.Client.ClientFIO = fio;
|
||||||
APIClient.Client.Email = login;
|
APIClient.Client.Email = login;
|
||||||
APIClient.Client.Password = password;
|
APIClient.Client.Password = password;
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Receivings");
|
||||||
}
|
}
|
||||||
|
|
||||||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
|
||||||
@ -103,7 +115,7 @@ namespace OrdererClientApp.Controllers
|
|||||||
{
|
{
|
||||||
throw new Exception("Неверный логин/пароль");
|
throw new Exception("Неверный логин/пароль");
|
||||||
}
|
}
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Receivings");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -142,7 +154,7 @@ namespace OrdererClientApp.Controllers
|
|||||||
{
|
{
|
||||||
ClientId = APIClient.Client.Id
|
ClientId = APIClient.Client.Id
|
||||||
});
|
});
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Receivings");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
@ -153,82 +165,91 @@ namespace OrdererClientApp.Controllers
|
|||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest($"api/equipmentreceiving/setfinish?id={id}", id);
|
APIClient.PostRequest($"api/equipmentreceiving/setfinish?id={id}", id);
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Receivings");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void DeleteReceiving(int receiving)
|
public void DeleteReceiving(int id)
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest($"api/equipmentreceiving/deletereceiving?id={receiving}", receiving);
|
APIClient.PostRequest($"api/equipmentreceiving/deletereceiving?id={id}", id);
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Receivings");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult CreateOrder()
|
public IActionResult CreateOrder()
|
||||||
{
|
{
|
||||||
return View();
|
ViewBag.Components = APIClient.GetRequest<List<ComponentViewModel>>($"api/component/getcomponentlist?clientId={APIClient.Client.Id}");
|
||||||
|
return View();
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void CreateOrder(int sum)
|
public void CreateOrder(int sum, int component_id, int amount)
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest("api/order/createorder", new OrderBindingModel
|
OrderBindingModel order = new OrderBindingModel
|
||||||
{
|
{
|
||||||
ClientId = APIClient.Client.Id,
|
ClientId = APIClient.Client.Id,
|
||||||
Sum = sum
|
Sum = sum
|
||||||
});
|
};
|
||||||
Response.Redirect("Order");
|
|
||||||
|
APIClient.PostRequest("api/order/createorder", order);
|
||||||
|
APIClient.PostRequest("api/order/addcomponent", Tuple.Create(
|
||||||
|
new OrderSearchModel() { Id = order.Id },
|
||||||
|
new ComponentSearchModel() { Id = component_id },
|
||||||
|
amount
|
||||||
|
));
|
||||||
|
|
||||||
|
Response.Redirect("Order");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
public IActionResult DeleteOrder()
|
public IActionResult DeleteOrder()
|
||||||
{
|
{
|
||||||
ViewBag.Components = APIClient.GetRequest<List<ComponentViewModel>>("api/main/getorderlist");
|
ViewBag.Orders = APIClient.GetRequest<List<OrderViewModel>>($"api/main/getorderlist/?clientId={APIClient.Client.Id}");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
[HttpDelete]
|
[HttpPost]
|
||||||
public void DeleteOrder(int order)
|
public void DeleteOrder(int id)
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest("api/order/deleteorder", new ComponentBindingModel
|
APIClient.PostRequest($"api/order/deleteorder", new ComponentBindingModel
|
||||||
{
|
{
|
||||||
Id = order
|
Id = id
|
||||||
});
|
});
|
||||||
Response.Redirect("Index");
|
Response.Redirect("Order");
|
||||||
}
|
}
|
||||||
|
|
||||||
public IActionResult AddAssembly()
|
public IActionResult AddComponent()
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
{
|
{
|
||||||
return Redirect("~/Home/Enter");
|
return Redirect("~/Home/Enter");
|
||||||
}
|
}
|
||||||
ViewBag.Assemblies = APIClient.GetRequest<List<AssemblyViewModel>>($"api/assembly/getassemblylist?clientId={APIClient.Client.Id}");
|
ViewBag.Components = APIClient.GetRequest<List<ComponentViewModel>>($"api/component/getcomponentlist?clientId={APIClient.Client.Id}");
|
||||||
ViewBag.Orders = APIClient.GetRequest<List<OrderViewModel>>($"api/order/getorderlist?clientId={APIClient.Client.Id}");
|
ViewBag.Orders = APIClient.GetRequest<List<OrderViewModel>>($"api/order/getorderlist?clientId={APIClient.Client.Id}");
|
||||||
return View();
|
return View();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void AddAssembly(int order, int assembly, int amount)
|
public void AddComponent(int order, int component, int amount)
|
||||||
{
|
{
|
||||||
if (APIClient.Client == null)
|
if (APIClient.Client == null)
|
||||||
{
|
{
|
||||||
throw new Exception("Необходима авторизация");
|
throw new Exception("Необходима авторизация");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest("api/order/AddAssembly", Tuple.Create(
|
APIClient.PostRequest("api/order/AddComponent", Tuple.Create(
|
||||||
new OrderSearchModel() { Id = order },
|
new OrderSearchModel() { Id = order },
|
||||||
new AssemblySearchModel() { Id = assembly },
|
new ComponentSearchModel() { Id = component },
|
||||||
amount
|
amount
|
||||||
));
|
));
|
||||||
Response.Redirect("Order");
|
Response.Redirect("Order");
|
||||||
@ -242,8 +263,58 @@ namespace OrdererClientApp.Controllers
|
|||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest($"api/order/finishorder?id={id}", id);
|
APIClient.PostRequest($"api/order/finishorder?id={id}", id);
|
||||||
Response.Redirect("order");
|
Response.Redirect("Order");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet]
|
||||||
|
public IActionResult EditOrder(int id)
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
return Redirect("~/Home/Enter");
|
||||||
|
}
|
||||||
|
var orderViewModel = APIClient.GetRequest<List<OrderViewModel>>($"api/order/getorder?id={id}");
|
||||||
|
var componentViewModels = APIClient.GetRequest<List<ComponentViewModel>>($"api/order/getcomponentsbyorder?orderid={id}");
|
||||||
|
ViewBag.Order = orderViewModel;
|
||||||
|
ViewBag.Components = componentViewModels;
|
||||||
|
|
||||||
|
var list = new List<dynamic>
|
||||||
|
{
|
||||||
|
orderViewModel,
|
||||||
|
componentViewModels
|
||||||
|
};
|
||||||
|
|
||||||
|
return View(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost]
|
||||||
|
public void EditOrder(int order, double cost, int component = -1, int amount = -1)
|
||||||
|
{
|
||||||
|
if (APIClient.Client == null)
|
||||||
|
{
|
||||||
|
throw new Exception("Необходима авторизация");
|
||||||
|
}
|
||||||
|
if (cost < 0)
|
||||||
|
{
|
||||||
|
throw new Exception("Стоимость не может быть меньше нуля");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (component >= 0 & amount > 1)
|
||||||
|
{
|
||||||
|
APIClient.PostRequest("api/order/AddComponent", Tuple.Create(
|
||||||
|
new OrderSearchModel() { Id = order },
|
||||||
|
new ComponentSearchModel() { Id = component },
|
||||||
|
amount
|
||||||
|
));
|
||||||
|
}
|
||||||
|
APIClient.PostRequest($"api/order/editorder", new OrderBindingModel
|
||||||
|
{
|
||||||
|
Id = component,
|
||||||
|
Sum = cost,
|
||||||
|
ClientId = APIClient.Client.Id
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void DeliveryOrder(int id)
|
public void DeliveryOrder(int id)
|
||||||
{
|
{
|
||||||
@ -252,7 +323,7 @@ namespace OrdererClientApp.Controllers
|
|||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest($"api/order/deliveryorder?id={id}", id);
|
APIClient.PostRequest($"api/order/deliveryorder?id={id}", id);
|
||||||
Response.Redirect("order");
|
Response.Redirect("Order");
|
||||||
}
|
}
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public void TakeOrderInWork(int id)
|
public void TakeOrderInWork(int id)
|
||||||
@ -262,7 +333,7 @@ namespace OrdererClientApp.Controllers
|
|||||||
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
throw new Exception("Вы как суда попали? Суда вход только авторизованным");
|
||||||
}
|
}
|
||||||
APIClient.PostRequest($"api/order/takeorderinwork?id={id}", id);
|
APIClient.PostRequest($"api/order/takeorderinwork?id={id}", id);
|
||||||
Response.Redirect("order");
|
Response.Redirect("Order");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
@using ComputerShopContracts.ViewModels;
|
|
||||||
@using ComputerShopDataModels.Models;
|
|
||||||
|
|
||||||
@{
|
|
||||||
ViewData["Title"] = "Add Assembly To Order";
|
|
||||||
}
|
|
||||||
|
|
||||||
@model Dictionary<int, IAssemblyModel>
|
|
||||||
|
|
||||||
<form method="post">
|
|
||||||
|
|
||||||
<div class="u-form-group u-form-name u-label-top">
|
|
||||||
<label class="u-label u-text-custom-color-1 u-label-1">Заказ: </label>
|
|
||||||
<div class="u-input u-input-rectangle">
|
|
||||||
<select id="order" name="order" class="form-control" asp-items="@(new SelectList(@ViewBag.Orders, "Id", "DateCreate"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="u-form-group u-form-name u-label-top">
|
|
||||||
<label class="u-label u-text-custom-color-1 u-label-1">Сборка: </label>
|
|
||||||
<div class="u-input u-input-rectangle">
|
|
||||||
<select id="assembly" name="assembly" class="form-control" asp-items="@(new SelectList(@ViewBag.Assemblies, "Id", "AssemblyName"))"></select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-4">Количество:</div>
|
|
||||||
<div class="col-8"><input type="text" name="amount" id="amount" /></div>
|
|
||||||
</div>
|
|
||||||
<div class="u-align-right u-form-group u-form-submit u-label-top">
|
|
||||||
<div class="col-8"></div>
|
|
||||||
<div class="col-4"><input type="submit" value="Добавить заказ" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
@ -1,17 +1,53 @@
|
|||||||
|
@using ComputerShopContracts.ViewModels;
|
||||||
|
@using ComputerShopDataModels.Models;
|
||||||
@{
|
@{
|
||||||
ViewData["Title"] = "CreateOrder";
|
ViewData["Title"] = "CreateOrder";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@model Dictionary<int, IComponentModel>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h2 class="display-4">Создание заказа</h2>
|
<h2 class="display-4">Создание заказа</h2>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
<div class="u-form-group u-form-name u-label-top">
|
||||||
|
<label class="u-label u-text-custom-color-1 u-label-1">Комплектующее: </label>
|
||||||
|
<div class="u-input u-input-rectangle">
|
||||||
|
<select id="component_id" name="component_id" class="form-control" asp-items="@(new SelectList(@ViewBag.Components, "Id", "ComponentName"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4">Цена без учета сборок:</div>
|
<div class="col-4">Количество:</div>
|
||||||
<div class="col-8"><input type="text" name="sum" id="sum" /></div>
|
<div class="col-8"><input type="text" name="amount" id="amount" /></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-8"></div>
|
<div class="col-8"></div>
|
||||||
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
<div class="col-4"><input type="submit" value="Создать" class="btn btn-primary" /></div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$('#component_id').on('change', function () {
|
||||||
|
check();
|
||||||
|
});
|
||||||
|
$('#amount').on('change', function () {
|
||||||
|
check();
|
||||||
|
});
|
||||||
|
|
||||||
|
function check() {
|
||||||
|
var count = $('#amount').val();
|
||||||
|
var package = $('#component_id').val();
|
||||||
|
if (count && package) {
|
||||||
|
$.ajax({
|
||||||
|
method: "POST",
|
||||||
|
url: "/Home/Calc",
|
||||||
|
data: { count: count, package: package },
|
||||||
|
success: function (result) {
|
||||||
|
$("#sum").val(result);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,66 @@
|
|||||||
|
@using ComputerShopContracts.ViewModels;
|
||||||
|
@using ComputerShopDataModels.Models;
|
||||||
|
|
||||||
|
@{
|
||||||
|
ViewData["Title"] = "OrderEditing";
|
||||||
|
}
|
||||||
|
|
||||||
|
@model IEnumerable<dynamic>
|
||||||
|
|
||||||
|
<form method="post">
|
||||||
|
|
||||||
|
<div class="u-form-group u-form-name u-label-top">
|
||||||
|
<label class="u-label u-text-custom-color-1 u-label-1">Заказ: </label>
|
||||||
|
<div class="u-input u-input-rectangle">
|
||||||
|
asp-items="@(new SelectList(@ViewBag.Order, "Id", "DateCreate"))
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Номер заказа:</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@foreach (var order in ViewBag.Order)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@order.Id</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Комплектующие в заказе:</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
@if (ViewBag.Components != null)
|
||||||
|
@foreach (var components in ViewBag.Components)
|
||||||
|
{
|
||||||
|
|
||||||
|
@foreach (var component in components)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (component != null)
|
||||||
|
{
|
||||||
|
<tr>
|
||||||
|
<td>@component.ComponentName</td>
|
||||||
|
</tr>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
<div class="u-form-group u-form-name u-label-top">
|
||||||
|
<label class="u-label u-text-custom-color-1 u-label-1">Добавить комплектующее: </label>
|
||||||
|
<div class="u-input u-input-rectangle">
|
||||||
|
<select id="component" name="component" class="form-control" asp-items="@(new SelectList(@ViewBag.Components, "Id", "ComponentName"))"></select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-4">Количество:</div>
|
||||||
|
<div class="col-8"><input type="text" name="amount" id="amount" /></div>
|
||||||
|
</div>
|
||||||
|
<div class="u-align-right u-form-group u-form-submit u-label-top">
|
||||||
|
<div class="col-8"></div>
|
||||||
|
<div class="col-4"><input type="submit" value="Добавить заказ" class="u-active-custom-color-6 u-border-none u-btn u-btn-submit u-button-style u-custom-color-1 u-hover-custom-color-2 u-btn-1" /></div>
|
||||||
|
</div>
|
||||||
|
</form>
|
@ -23,7 +23,7 @@
|
|||||||
<a asp-action="CreateOrder">Создать заказ</a>
|
<a asp-action="CreateOrder">Создать заказ</a>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a asp-action="AddAssembly">Добавить сборки к заказу</a>
|
<a asp-action="AddComponent">Добавить компоненты к заказу</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@ -66,21 +66,25 @@
|
|||||||
@Html.DisplayFor(modelItem => item.DateImplement)
|
@Html.DisplayFor(modelItem => item.DateImplement)
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<form action="TakeOrderInWork" method="post">
|
|
||||||
<input type="hidden" name="id" value="@item.Id" />
|
|
||||||
<button type="submit" class="btn btn-outline-dark">Выполняется</button>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
<td>
|
<td>
|
||||||
<form action="DeliveryOrder" method="post">
|
<form action="DeliveryOrder" method="post">
|
||||||
<input type="hidden" name="id" value="@item.Id" />
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
<button type="submit" class="btn btn-outline-dark">Выдан</button>
|
<button type="submit" class="btn btn-outline-dark">Получено</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<form action="FinishOrder" method="post">
|
<form action="EditOrder" method="get">
|
||||||
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
|
<button type="submit" class="btn btn-outline-danger">Изменить</button>
|
||||||
|
</form>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<form action="DeleteOrder" method="post">
|
||||||
<input type="hidden" name="id" value="@item.Id" />
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
<button type="submit" class="btn btn-outline-dark">Готов</button>
|
<button type="submit" class="btn btn-outline-danger">Отменить заказ</button>
|
||||||
</form>
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
<p>
|
<p>
|
||||||
<form action="CreateReceiving" method="post">
|
<form action="CreateReceiving" method="post">
|
||||||
<button type="submit" class="btn btn-primary">Создать новое получение</button>
|
<button type="submit" class="btn btn-primary">Новое получение</button>
|
||||||
</form>
|
</form>
|
||||||
</p>
|
</p>
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@ -64,7 +64,7 @@
|
|||||||
</form>
|
</form>
|
||||||
<td>
|
<td>
|
||||||
<form action="DeleteReceiving" method="post">
|
<form action="DeleteReceiving" method="post">
|
||||||
<input type="hidden" name="receiving" value="@item.Id" />
|
<input type="hidden" name="id" value="@item.Id" />
|
||||||
<button type="submit" class="btn btn-danger">Отменить</button>
|
<button type="submit" class="btn btn-danger">Отменить</button>
|
||||||
</form>
|
</form>
|
||||||
<td>
|
<td>
|
@ -44,7 +44,7 @@
|
|||||||
<header>
|
<header>
|
||||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3 container-fluid">
|
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3 container-fluid">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">Магазин компьютерной техники</a>
|
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Receivings">Магазин компьютерной техники</a>
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||||
aria-expanded="false" aria-label="Toggle navigation">
|
aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
@ -52,7 +52,7 @@
|
|||||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||||
<ul class="navbar-nav flex-grow-1">
|
<ul class="navbar-nav flex-grow-1">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Получения компонентов</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Receivings">Получения техники</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Order">Заказы</a>
|
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Order">Заказы</a>
|
||||||
|
Loading…
Reference in New Issue
Block a user