Compare commits
3 Commits
aec779bd99
...
84eed7fd39
Author | SHA1 | Date | |
---|---|---|---|
84eed7fd39 | |||
8ada1a958e | |||
49438bd93a |
@ -22,11 +22,14 @@ namespace ConfectioneryBusinessLogic.OfficePackage
|
|||||||
JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
foreach (var component in info.Components)
|
foreach (var pastry in info.Pastrys)
|
||||||
{
|
{
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> {(component.ComponentName, new WordTextProperties { Size = "24", }) },
|
Texts = new List<(string, WordTextProperties)> {
|
||||||
|
(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",
|
||||||
|
@ -11,17 +11,15 @@ namespace ConfectioneryBusinessLogic
|
|||||||
public class ReportLogic : IReportLogic
|
public class ReportLogic : IReportLogic
|
||||||
{
|
{
|
||||||
private readonly IComponentStorage _componentStorage;
|
private readonly IComponentStorage _componentStorage;
|
||||||
private readonly IPastryStorage _productStorage;
|
private readonly IPastryStorage _pastryStorage;
|
||||||
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 productStorage, IComponentStorage
|
public ReportLogic(IPastryStorage pastryStorage, IComponentStorage componentStorage, IOrderStorage orderStorage, AbstractSaveToExcel saveToExcel,
|
||||||
componentStorage, IOrderStorage orderStorage,
|
AbstractSaveToWord saveToWord, AbstractSaveToPdf saveToPdf)
|
||||||
AbstractSaveToExcel saveToExcel, AbstractSaveToWord saveToWord,
|
|
||||||
AbstractSaveToPdf saveToPdf)
|
|
||||||
{
|
{
|
||||||
_productStorage = productStorage;
|
_pastryStorage = pastryStorage;
|
||||||
_componentStorage = componentStorage;
|
_componentStorage = componentStorage;
|
||||||
_orderStorage = orderStorage;
|
_orderStorage = orderStorage;
|
||||||
_saveToExcel = saveToExcel;
|
_saveToExcel = saveToExcel;
|
||||||
@ -35,7 +33,7 @@ namespace ConfectioneryBusinessLogic
|
|||||||
public List<ReportPastryComponentViewModel> GetPastryComponent()
|
public List<ReportPastryComponentViewModel> GetPastryComponent()
|
||||||
{
|
{
|
||||||
var components = _componentStorage.GetFullList();
|
var components = _componentStorage.GetFullList();
|
||||||
var products = _productStorage.GetFullList();
|
var products = _pastryStorage.GetFullList();
|
||||||
var list = new List<ReportPastryComponentViewModel>();
|
var list = new List<ReportPastryComponentViewModel>();
|
||||||
foreach (var component in components)
|
foreach (var component in components)
|
||||||
{
|
{
|
||||||
@ -91,8 +89,8 @@ namespace ConfectioneryBusinessLogic
|
|||||||
_saveToWord.CreateDoc(new WordInfo
|
_saveToWord.CreateDoc(new WordInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список изделий",
|
||||||
Components = _componentStorage.GetFullList()
|
Pastrys = _pastryStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -104,7 +102,7 @@ namespace ConfectioneryBusinessLogic
|
|||||||
_saveToExcel.CreateReport(new ExcelInfo
|
_saveToExcel.CreateReport(new ExcelInfo
|
||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список компонентов",
|
||||||
PastryComponents = GetPastryComponent()
|
PastryComponents = GetPastryComponent()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -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<ComponentViewModel> Components { get; set; } = new();
|
public List<PastryViewModel> Pastrys { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,8 +23,11 @@ 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();
|
||||||
var result = context.Orders.Include(x => x.Pastry).Select(x => x.GetViewModel).ToList();
|
if (model.DateFrom.HasValue)
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user