Почти закончил
This commit is contained in:
parent
aba68f3272
commit
4dee91c9a9
@ -37,8 +37,8 @@ logger, IReportLogic logic)
|
||||
dataGridView.Rows.Clear();
|
||||
foreach (var elem in dict)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { elem.ComponentName, "", "" });
|
||||
foreach (var listElem in elem.Computers)
|
||||
dataGridView.Rows.Add(new object[] { elem.ComputerName, "", "" });
|
||||
foreach (var listElem in elem.Components)
|
||||
{
|
||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||
}
|
||||
|
@ -42,23 +42,20 @@ namespace ComputersShopBusinessLogic.BusinessLogics
|
||||
var components = _componentStorage.GetFullList();
|
||||
var Computers = _ComputerStorage.GetFullList();
|
||||
var list = new List<ReportComputerComponentViewModel>();
|
||||
foreach (var component in components)
|
||||
foreach (var computer in Computers)
|
||||
{
|
||||
var record = new ReportComputerComponentViewModel
|
||||
{
|
||||
ComponentName = component.ComponentName,
|
||||
Computers = new List<Tuple<string, int>>(),
|
||||
ComputerName = computer.ComputerName,
|
||||
Components = new List<Tuple<string, int>>(),
|
||||
TotalCount = 0
|
||||
};
|
||||
foreach (var Computer in Computers)
|
||||
foreach (var component in computer.ComputerComponents)
|
||||
{
|
||||
if (Computer.ComputerComponents.ContainsKey(component.Id))
|
||||
{
|
||||
record.Computers.Add(new Tuple<string,
|
||||
int>(Computer.ComputerName, Computer.ComputerComponents[component.Id].Item2));
|
||||
record.TotalCount +=
|
||||
Computer.ComputerComponents[component.Id].Item2;
|
||||
}
|
||||
record.Components.Add(new Tuple<string,
|
||||
int>(component.Value.Item1.ComponentName, component.Value.Item2));
|
||||
record.TotalCount +=
|
||||
component.Value.Item2;
|
||||
}
|
||||
list.Add(record);
|
||||
}
|
||||
|
@ -36,17 +36,17 @@ namespace ComputersShopBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "A",
|
||||
RowIndex = rowIndex,
|
||||
Text = pc.ComponentName,
|
||||
Text = pc.ComputerName,
|
||||
StyleInfo = ExcelStyleInfoType.Text
|
||||
});
|
||||
rowIndex++;
|
||||
foreach (var Computer in pc.Computers)
|
||||
foreach (var component in pc.Components)
|
||||
{
|
||||
InsertCellInWorksheet(new ExcelCellParameters
|
||||
{
|
||||
ColumnName = "B",
|
||||
RowIndex = rowIndex,
|
||||
Text = Computer.Item1,
|
||||
Text = component.Item1,
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
@ -54,7 +54,7 @@ namespace ComputersShopBusinessLogic.OfficePackage
|
||||
{
|
||||
ColumnName = "C",
|
||||
RowIndex = rowIndex,
|
||||
Text = Computer.Item2.ToString(),
|
||||
Text = component.Item2.ToString(),
|
||||
StyleInfo =
|
||||
ExcelStyleInfoType.TextWithBroder
|
||||
});
|
||||
|
@ -23,7 +23,7 @@ namespace ComputersShopBusinessLogic.OfficePackage
|
||||
{
|
||||
Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal", ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||
});
|
||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
|
||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm", "3cm" });
|
||||
CreateRow(new PdfRowParameters
|
||||
{
|
||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Сумма", "Статус" },
|
||||
|
@ -8,8 +8,8 @@ namespace ComputersShopContracts.ViewModels
|
||||
{
|
||||
public class ReportComputerComponentViewModel
|
||||
{
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
public string ComputerName { get; set; } = string.Empty;
|
||||
public int TotalCount { get; set; }
|
||||
public List<Tuple<string, int>> Computers { get; set; } = new();
|
||||
public List<Tuple<string, int>> Components { get; set; } = new();
|
||||
}
|
||||
}
|
||||
|
@ -23,10 +23,6 @@ namespace ComputersShopDatabaseImplement.Implements
|
||||
}
|
||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||
{
|
||||
if (!model.Id.HasValue)
|
||||
{
|
||||
return new();
|
||||
}
|
||||
using var context = new ComputersShopDatabase();
|
||||
return context.Orders.Include(x => x.Computers)
|
||||
.Where(x => (
|
||||
|
Loading…
x
Reference in New Issue
Block a user