Compare commits

..

No commits in common. "84eed7fd392aa0343d9413272df8416192accea0" and "aec779bd9955dbdab06772e18f9697b5b4963dc4" have entirely different histories.

4 changed files with 15 additions and 19 deletions

View File

@ -22,14 +22,11 @@ namespace ConfectioneryBusinessLogic.OfficePackage
JustificationType = WordJustificationType.Center JustificationType = WordJustificationType.Center
} }
}); });
foreach (var pastry in info.Pastrys) foreach (var component in info.Components)
{ {
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> { Texts = new List<(string, WordTextProperties)> {(component.ComponentName, new WordTextProperties { Size = "24", }) },
(pastry.PastryName, new WordTextProperties { Size = "24", Bold = true}),
("\t"+pastry.Price.ToString(), new WordTextProperties{Size = "24"})
},
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {
Size = "24", Size = "24",

View File

@ -11,15 +11,17 @@ namespace ConfectioneryBusinessLogic
public class ReportLogic : IReportLogic public class ReportLogic : IReportLogic
{ {
private readonly IComponentStorage _componentStorage; private readonly IComponentStorage _componentStorage;
private readonly IPastryStorage _pastryStorage; private readonly IPastryStorage _productStorage;
private readonly IOrderStorage _orderStorage; private readonly IOrderStorage _orderStorage;
private readonly AbstractSaveToExcel _saveToExcel; private readonly AbstractSaveToExcel _saveToExcel;
private readonly AbstractSaveToWord _saveToWord; private readonly AbstractSaveToWord _saveToWord;
private readonly AbstractSaveToPdf _saveToPdf; private readonly AbstractSaveToPdf _saveToPdf;
public ReportLogic(IPastryStorage pastryStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel, public ReportLogic(IPastryStorage productStorage, IComponentStorage
AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf) componentStorage, IOrderStorage orderStorage,
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord,
AbstractSaveToPdf saveToPdf)
{ {
_pastryStorage = pastryStorage; _productStorage = productStorage;
_componentStorage = componentStorage; _componentStorage = componentStorage;
_orderStorage = orderStorage; _orderStorage = orderStorage;
_saveToExcel = saveToExcel; _saveToExcel = saveToExcel;
@ -33,7 +35,7 @@ namespace ConfectioneryBusinessLogic
public List<ReportPastryComponentViewModel> GetPastryComponent() public List<ReportPastryComponentViewModel> GetPastryComponent()
{ {
var components = _componentStorage.GetFullList(); var components = _componentStorage.GetFullList();
var products = _pastryStorage.GetFullList(); var products = _productStorage.GetFullList();
var list = new List<ReportPastryComponentViewModel>(); var list = new List<ReportPastryComponentViewModel>();
foreach (var component in components) foreach (var component in components)
{ {
@ -89,8 +91,8 @@ namespace ConfectioneryBusinessLogic
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список изделий", Title = "Список компонент",
Pastrys = _pastryStorage.GetFullList() Components = _componentStorage.GetFullList()
}); });
} }
/// <summary> /// <summary>
@ -102,7 +104,7 @@ namespace ConfectioneryBusinessLogic
_saveToExcel.CreateReport(new ExcelInfo _saveToExcel.CreateReport(new ExcelInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список компонентов", Title = "Список компонент",
PastryComponents = GetPastryComponent() PastryComponents = GetPastryComponent()
}); });
} }

View File

@ -11,6 +11,6 @@ namespace ConfectioneryBusinessLogic.OfficePackage.HelperModels
{ {
public string FileName { get; set; } = string.Empty; public string FileName { get; set; } = string.Empty;
public string Title { get; set; } = string.Empty; public string Title { get; set; } = string.Empty;
public List<PastryViewModel> Pastrys { get; set; } = new(); public List<ComponentViewModel> Components { get; set; } = new();
} }
} }

View File

@ -23,11 +23,8 @@ namespace ConfectioneryDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
using var context = new ConfectioneryDatabase(); using var context = new ConfectioneryDatabase();
if (model.DateFrom.HasValue) var result = context.Orders.Include(x => x.Pastry).Select(x => x.GetViewModel).ToList();
{ return result;
return context.Orders.Include(x => x.Pastry).Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo).Select(x => x.GetViewModel).ToList();
}
return context.Orders.Include(x => x.Pastry).Where(x => x.Id == model.Id).Select(x => x.GetViewModel).ToList();
} }
public OrderViewModel? GetElement(OrderSearchModel model) public OrderViewModel? GetElement(OrderSearchModel model)