FurnitureFactoryDataBaseImplement Implements fix

This commit is contained in:
FLARJ 2023-04-08 00:44:43 +04:00
parent a0c8eb42c8
commit ec8998be3c
5 changed files with 29 additions and 11 deletions

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FurnitureContracts.ViewModel;
namespace FurnitureFactoryBusinessLogic.OfficePackage.HelperModels
{
internal class ExcelInfoManager
{
public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty;
public List<ReportInterestLessonViewModel> InterestLessons { get; set; } = new();
}
}

View File

@ -9,7 +9,7 @@ using FurnitureContracts.BindingModels;
using FurnitureContracts.ViewModel; using FurnitureContracts.ViewModel;
using FurnitureContracts.SearchModels; using FurnitureContracts.SearchModels;
using FurnitureContracts.StoragesContracts; using FurnitureContracts.StoragesContracts;
using FurnitureFactoryDataBaseImplements.Models; using FurnitureFactoryDataBaseImplement.Models;
using FurnitureFactoryDataBaseImplement; using FurnitureFactoryDataBaseImplement;
namespace FurnitureFactoryDataBaseImplements.Implements namespace FurnitureFactoryDataBaseImplements.Implements

View File

@ -3,7 +3,7 @@ using FurnitureContracts.BindingModels;
using FurnitureContracts.SearchModels; using FurnitureContracts.SearchModels;
using FurnitureContracts.StoragesContracts; using FurnitureContracts.StoragesContracts;
using FurnitureContracts.ViewModel; using FurnitureContracts.ViewModel;
using FurnitureFactoryDataBaseImplements.Models; using FurnitureFactoryDataBaseImplement.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -51,7 +51,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
} }
using var context = new FurnitureDataBase(); using var context = new FurnitureDataBase();
return context.Managers return context.Managers
.Where(x => x.Name.Contains(model.UserName)) .Where(x => x.UserName.Contains(model.UserName))
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
.ToList(); .ToList();

View File

@ -3,7 +3,7 @@ using FurnitureContracts.BindingModels;
using FurnitureContracts.SearchModels; using FurnitureContracts.SearchModels;
using FurnitureContracts.StoragesContracts; using FurnitureContracts.StoragesContracts;
using FurnitureContracts.ViewModel; using FurnitureContracts.ViewModel;
using FurnitureFactoryDataBaseImplements.Models; using FurnitureFactoryDataBaseImplement.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -21,7 +21,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
using var context = new FurnitureDataBase(); using var context = new FurnitureDataBase();
return context.Orders return context.Orders
.Include(x => x.SalesSalons) .Include(x => x.SalesSalons)
.ThenInclude(x => x.SalesSalon) .ThenInclude(x => x.SalesSalons)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
.ToList(); .ToList();
@ -38,7 +38,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
{ {
return context.Orders return context.Orders
.Include(x => x.SalesSalons) .Include(x => x.SalesSalons)
.ThenInclude(x => x.SalesSalon) .ThenInclude(x => x.SalesSalons)
.Where(x => x.Date >= model.DateFrom && x.Date <= model.DateTo && x.ManagerId == model.ManagerId) .Where(x => x.Date >= model.DateFrom && x.Date <= model.DateTo && x.ManagerId == model.ManagerId)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
@ -46,7 +46,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
} }
return context.Orders return context.Orders
.Include(x => x.SalesSalons) .Include(x => x.SalesSalons)
.ThenInclude(x => x.SalesSalon) .ThenInclude(x => x.SalesSalons)
.Where(x => x.ManagerId == model.ManagerId) .Where(x => x.ManagerId == model.ManagerId)
.ToList() .ToList()
.Select(x => x.GetViewModel) .Select(x => x.GetViewModel)
@ -63,7 +63,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
using var context = new FurnitureDataBase(); using var context = new FurnitureDataBase();
return context.Orders return context.Orders
.Include(x => x.SalesSalons) .Include(x => x.SalesSalons)
.ThenInclude(x => x.SalesSalon) .ThenInclude(x => x.SalesSalons)
.FirstOrDefault(x => ((!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) || .FirstOrDefault(x => ((!string.IsNullOrEmpty(model.Title) && x.Title == model.Title) ||
(model.Id.HasValue && x.Id == model.Id)) && x.ManagerId == model.ManagerId) (model.Id.HasValue && x.Id == model.Id)) && x.ManagerId == model.ManagerId)
?.GetViewModel; ?.GetViewModel;
@ -72,7 +72,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
public OrdersViewModel? Insert(OrdersBindingModel model) public OrdersViewModel? Insert(OrdersBindingModel model)
{ {
using var context = new FurnitureDataBase(); using var context = new FurnitureDataBase();
var newOrder = Order.Create(context, model); var newOrder = Orders.Create(context, model);
if (newOrder == null) if (newOrder == null)
{ {
return null; return null;
@ -114,7 +114,7 @@ namespace FurnitureFactoryDataBaseImplements.Implements
.FirstOrDefault(rec => rec.Id == model.Id); .FirstOrDefault(rec => rec.Id == model.Id);
if (element != null) if (element != null)
{ {
context.SalesSalons.Remove(element); context.Orders.Remove(element);
context.SaveChanges(); context.SaveChanges();
return element.GetViewModel; return element.GetViewModel;
} }

View File

@ -3,7 +3,7 @@ using FurnitureContracts.SearchModels;
using FurnitureContracts.StoragesContracts; using FurnitureContracts.StoragesContracts;
using FurnitureContracts.ViewModel; using FurnitureContracts.ViewModel;
using FurnitureFactoryDataBaseImplement; using FurnitureFactoryDataBaseImplement;
using FurnitureFactoryDataBaseImplements.Models; using FurnitureFactoryDataBaseImplement.Models;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;