From 8d6846eefc430c3a3cc913116c92a732d461406e Mon Sep 17 00:00:00 2001 From: FLARJ <122087628+FLARJ@users.noreply.github.com> Date: Fri, 19 May 2023 14:16:33 +0400 Subject: [PATCH] fix Contracts --- .../BindingModels/OrdersBindingModel.cs | 2 +- .../BindingModels/SalesSalonsBindingModel.cs | 5 ++--- .../ViewModel/OrdersViewModel.cs | 2 +- .../BusinessLogic/ReportLogic.cs | 4 ++-- .../FurnitureDataBase.cs | 18 +++++++++--------- .../Implements/OrderStorage.cs | 2 +- .../Models/Orders.cs | 8 ++++---- .../Models/IOrdersModel.cs | 2 +- .../Controllers/HomeController.cs | 4 ++-- 9 files changed, 23 insertions(+), 24 deletions(-) diff --git a/FurnitureFactory/FurnitureContracts/BindingModels/OrdersBindingModel.cs b/FurnitureFactory/FurnitureContracts/BindingModels/OrdersBindingModel.cs index 00da4ae..9d915db 100644 --- a/FurnitureFactory/FurnitureContracts/BindingModels/OrdersBindingModel.cs +++ b/FurnitureFactory/FurnitureContracts/BindingModels/OrdersBindingModel.cs @@ -5,7 +5,7 @@ namespace FurnitureContracts.BindingModels public class OrdersBindingModel : IOrdersModel { public string Title { get; set; } = string.Empty; - public DateTime Date { get; set; } = DateTime.Now; + public DateTime DateCreate { get; set; } = DateTime.Now; public string Status { get; set; } = string.Empty; public int Id { get; set; } public int ManagerId { get; set; } diff --git a/FurnitureFactory/FurnitureContracts/BindingModels/SalesSalonsBindingModel.cs b/FurnitureFactory/FurnitureContracts/BindingModels/SalesSalonsBindingModel.cs index 4e33517..5921ab6 100644 --- a/FurnitureFactory/FurnitureContracts/BindingModels/SalesSalonsBindingModel.cs +++ b/FurnitureFactory/FurnitureContracts/BindingModels/SalesSalonsBindingModel.cs @@ -6,8 +6,7 @@ namespace FurnitureContracts.BindingModels { public string Name { get; set; } = string.Empty; public string Address { get; set; } = string.Empty; - public Dictionary OrdersId { get; set; } - public int Id { get; set; } public int ManagerId { get; set; } - } + public int Id { get; set; } + } } diff --git a/FurnitureFactory/FurnitureContracts/ViewModel/OrdersViewModel.cs b/FurnitureFactory/FurnitureContracts/ViewModel/OrdersViewModel.cs index 2bdf928..fb6c201 100644 --- a/FurnitureFactory/FurnitureContracts/ViewModel/OrdersViewModel.cs +++ b/FurnitureFactory/FurnitureContracts/ViewModel/OrdersViewModel.cs @@ -16,7 +16,7 @@ namespace FurnitureContracts.ViewModel [DisplayName("Дата заказа")] - public DateTime Date { get; set; } + public DateTime DateCreate { get; set; } [DisplayName("Статус")] public string Status { get; set; } = string.Empty; diff --git a/FurnitureFactory/FurnitureFactoryBusinessLogic/BusinessLogic/ReportLogic.cs b/FurnitureFactory/FurnitureFactoryBusinessLogic/BusinessLogic/ReportLogic.cs index beaed94..c1b60b7 100644 --- a/FurnitureFactory/FurnitureFactoryBusinessLogic/BusinessLogic/ReportLogic.cs +++ b/FurnitureFactory/FurnitureFactoryBusinessLogic/BusinessLogic/ReportLogic.cs @@ -150,7 +150,7 @@ namespace FurnitureFactoryBusinessLogic.BusinessLogic { SalesSalonTitle = salessalons.FirstOrDefault(x => x.Id == salessalonOrder).ToString(), OrderTitle = order.Title, - DateCreateOrder = order.Date, + DateCreateOrder = order.DateCreate, HeadsetTitle = headset.Title, }); } @@ -196,7 +196,7 @@ namespace FurnitureFactoryBusinessLogic.BusinessLogic { SalesSalonTitle = interests.FirstOrDefault(x => x.Id == interestOrder).ToString(), OrderTitle = order.Title, - DateCreateOrder = order.Date, + DateCreateOrder = order.DateCreate, HeadsetTitle = headset.Title, DateCreateHeadset = headset.DateCreate }); diff --git a/FurnitureFactory/FurnitureFactoryDataBaseImplement/FurnitureDataBase.cs b/FurnitureFactory/FurnitureFactoryDataBaseImplement/FurnitureDataBase.cs index 2d760e6..241ac1b 100644 --- a/FurnitureFactory/FurnitureFactoryDataBaseImplement/FurnitureDataBase.cs +++ b/FurnitureFactory/FurnitureFactoryDataBaseImplement/FurnitureDataBase.cs @@ -18,16 +18,16 @@ namespace FurnitureFactoryDataBaseImplement { public class FurnitureDataBase : DbContext { - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (optionsBuilder.IsConfigured == false) - { - optionsBuilder.UseNpgsql("Host=localhost;Port=5432;Database=FurnitureFactory;Username=postgres;Password=Jus999666Y"); - } - base.OnConfiguring(optionsBuilder); - } + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (optionsBuilder.IsConfigured == false) + { + optionsBuilder.UseNpgsql(@"Host=localhost;Port=5432;Database=FurnitureFactory;Username=postgres;Password=Jus999666Y"); + } + base.OnConfiguring(optionsBuilder); + } - public virtual DbSet Managers { set; get; } + public virtual DbSet Managers { set; get; } public virtual DbSet SalesSalons { set; get; } public virtual DbSet Headsets { set; get; } public virtual DbSet HeadsetSalesSalons { set; get; } diff --git a/FurnitureFactory/FurnitureFactoryDataBaseImplement/Implements/OrderStorage.cs b/FurnitureFactory/FurnitureFactoryDataBaseImplement/Implements/OrderStorage.cs index c057a4c..19bb0ff 100644 --- a/FurnitureFactory/FurnitureFactoryDataBaseImplement/Implements/OrderStorage.cs +++ b/FurnitureFactory/FurnitureFactoryDataBaseImplement/Implements/OrderStorage.cs @@ -39,7 +39,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements return context.Orders .Include(x => x.SalesSalons) .ThenInclude(x => x.SalesSalons) - .Where(x => x.Date >= model.DateFrom && x.Date <= model.DateTo && x.ManagerId == model.ManagerId) + .Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo && x.ManagerId == model.ManagerId) .ToList() .Select(x => x.GetViewModel) .ToList(); diff --git a/FurnitureFactory/FurnitureFactoryDataBaseImplement/Models/Orders.cs b/FurnitureFactory/FurnitureFactoryDataBaseImplement/Models/Orders.cs index 638fd5c..0f0acf8 100644 --- a/FurnitureFactory/FurnitureFactoryDataBaseImplement/Models/Orders.cs +++ b/FurnitureFactory/FurnitureFactoryDataBaseImplement/Models/Orders.cs @@ -18,7 +18,7 @@ namespace FurnitureFactoryDataBaseImplement.Models [Required] public string Status { get; set; } = string.Empty; [Required] - public DateTime Date { get; set; } + public DateTime DateCreate { get; set; } [Required] public int ManagerId { get; set; } public virtual Manager Manager { get; set; } @@ -50,7 +50,7 @@ namespace FurnitureFactoryDataBaseImplement.Models Id = model.Id, Title = model.Title, Status = model.Status, - Date = model.Date, + DateCreate = model.DateCreate, ManagerId = model.ManagerId, SalesSalons = model.OrdersSalesSalons.Select(x => new OrdersSalesSalons { @@ -62,7 +62,7 @@ namespace FurnitureFactoryDataBaseImplement.Models public void Update(OrdersBindingModel model) { Status = model.Status; - Date = model.Date; + DateCreate = model.DateCreate; } public OrdersViewModel GetViewModel => new() @@ -70,7 +70,7 @@ namespace FurnitureFactoryDataBaseImplement.Models Id = Id, Title = Title, Status = Status, - Date = Date, + DateCreate = DateCreate, ManagerId = ManagerId, OrdersSalesSalons = OrdersSalesSalons }; diff --git a/FurnitureFactory/FurnitureFactoryDataModels/Models/IOrdersModel.cs b/FurnitureFactory/FurnitureFactoryDataModels/Models/IOrdersModel.cs index a8c3bb7..e1e04cf 100644 --- a/FurnitureFactory/FurnitureFactoryDataModels/Models/IOrdersModel.cs +++ b/FurnitureFactory/FurnitureFactoryDataModels/Models/IOrdersModel.cs @@ -9,7 +9,7 @@ namespace FurnitureFactoryDataModels.Models public interface IOrdersModel : IId { string Title { get; } - DateTime Date { get; } + DateTime DateCreate { get; } string Status { get; } public Dictionary OrdersSalesSalons { get; } int ManagerId { get; } diff --git a/FurnitureFactory/ManagerWebClient/Controllers/HomeController.cs b/FurnitureFactory/ManagerWebClient/Controllers/HomeController.cs index f54da28..2ba3272 100644 --- a/FurnitureFactory/ManagerWebClient/Controllers/HomeController.cs +++ b/FurnitureFactory/ManagerWebClient/Controllers/HomeController.cs @@ -338,7 +338,7 @@ namespace ManagerWebClient.Controllers ManagerId = APIClient.Manager.Id, Title = title, Status = status, - Date = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc), + DateCreate = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc), OrdersSalesSalons = orderSalesSalons }); @@ -386,7 +386,7 @@ namespace ManagerWebClient.Controllers ManagerId = APIClient.Manager.Id, Title = title, Status = status, - Date = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc), + DateCreate = DateTime.SpecifyKind(DateTime.Parse(dateCreate), DateTimeKind.Utc), OrdersSalesSalons = orderSalesSalons });