fix
This commit is contained in:
parent
76c4c7c18d
commit
04aca8c706
@ -34,6 +34,13 @@ namespace SoftwareInstallationFileImplement.Implements
|
|||||||
}
|
}
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) // если не ищем по айдишнику, значит ищем по диапазону дат
|
||||||
|
{
|
||||||
|
return _source.Orders
|
||||||
|
.Where(x => model.DateFrom <= x.DateCreate.Date && x.DateCreate <= model.DateTo)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
var result = GetElement(model);
|
var result = GetElement(model);
|
||||||
return result != null ? new() { result } : new();
|
return result != null ? new() { result } : new();
|
||||||
}
|
}
|
||||||
|
@ -31,25 +31,16 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public List<ReportPackageComponentViewModel> GetPackageComponent()
|
public List<ReportPackageComponentViewModel> GetPackageComponent()
|
||||||
{
|
{
|
||||||
var components = _componentStorage.GetFullList();
|
|
||||||
var packages = _packageStorage.GetFullList();
|
var packages = _packageStorage.GetFullList();
|
||||||
var list = new List<ReportPackageComponentViewModel>();
|
var list = new List<ReportPackageComponentViewModel>();
|
||||||
foreach (var component in components)
|
foreach (var package in packages)
|
||||||
{
|
{
|
||||||
var record = new ReportPackageComponentViewModel
|
var record = new ReportPackageComponentViewModel
|
||||||
{
|
{
|
||||||
ComponentName = component.ComponentName,
|
PackageName = package.PackageName,
|
||||||
Packages = new List<Tuple<string, int>>(),
|
Components = package.PackageComponents.Values.Select(x => Tuple.Create(x.Item1.ComponentName, x.Item2)).ToList(),
|
||||||
TotalCount = 0
|
TotalCount = package.PackageComponents.Values.Select(x => x.Item2).Sum(),
|
||||||
};
|
};
|
||||||
foreach (var package in packages)
|
|
||||||
{
|
|
||||||
if (package.PackageComponents.ContainsKey(component.Id))
|
|
||||||
{
|
|
||||||
record.Packages.Add(new Tuple<string, int>(package.PackageName, package.PackageComponents[component.Id].Item2));
|
|
||||||
record.TotalCount += package.PackageComponents[component.Id].Item2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.Add(record);
|
list.Add(record);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
@ -65,12 +56,14 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
DateFrom = model.DateFrom,
|
DateFrom = model.DateFrom,
|
||||||
DateTo = model.DateTo
|
DateTo = model.DateTo
|
||||||
|
|
||||||
})
|
})
|
||||||
.Select(x => new ReportOrdersViewModel
|
.Select(x => new ReportOrdersViewModel
|
||||||
{
|
{
|
||||||
Id = x.Id,
|
Id = x.Id,
|
||||||
DateCreate = x.DateCreate,
|
DateCreate = x.DateCreate,
|
||||||
PackageName = x.PackageName,
|
PackageName = x.PackageName,
|
||||||
|
OrderStatus = x.Status.ToString(),
|
||||||
Sum = x.Sum
|
Sum = x.Sum
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
@ -85,7 +78,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
|
|||||||
{
|
{
|
||||||
FileName = model.FileName,
|
FileName = model.FileName,
|
||||||
Title = "Список компонент",
|
Title = "Список компонент",
|
||||||
Components = _componentStorage.GetFullList()
|
Packages = _packageStorage.GetFullList()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -31,11 +31,11 @@ namespace SoftwareInstallationBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
ColumnName = "A",
|
ColumnName = "A",
|
||||||
RowIndex = rowIndex,
|
RowIndex = rowIndex,
|
||||||
Text = pc.ComponentName,
|
Text = pc.PackageName,
|
||||||
StyleInfo = ExcelStyleInfoType.Text
|
StyleInfo = ExcelStyleInfoType.Text
|
||||||
});
|
});
|
||||||
rowIndex++;
|
rowIndex++;
|
||||||
foreach (var package in pc.Packages)
|
foreach (var package in pc.Components)
|
||||||
{
|
{
|
||||||
InsertCellInWorksheet(new ExcelCellParameters
|
InsertCellInWorksheet(new ExcelCellParameters
|
||||||
{
|
{
|
||||||
|
@ -21,10 +21,10 @@ namespace SoftwareInstallationBusinessLogic.OfficePackage
|
|||||||
Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
|
Text = $"с{ info.DateFrom.ToShortDateString() } по { info.DateTo.ToShortDateString() }", Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
CreateTable(new List<string> { "2cm", "3cm", "6cm", "3cm" });
|
CreateTable(new List<string> { "2cm", "3cm", "6cm", "4cm", "3cm" });
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { "Номер", "Дата заказа", "Изделие","Сумма" },
|
Texts = new List<string> { "Номер", "Дата заказа", "Изделие", "Статус заказа", "Сумма" },
|
||||||
Style = "NormalTitle",
|
Style = "NormalTitle",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
ParagraphAlignment = PdfParagraphAlignmentType.Center
|
||||||
});
|
});
|
||||||
@ -32,7 +32,7 @@ namespace SoftwareInstallationBusinessLogic.OfficePackage
|
|||||||
{
|
{
|
||||||
CreateRow(new PdfRowParameters
|
CreateRow(new PdfRowParameters
|
||||||
{
|
{
|
||||||
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PackageName, order.Sum.ToString() },
|
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PackageName, Convert.ToString(order.OrderStatus), order.Sum.ToString() },
|
||||||
Style = "Normal",
|
Style = "Normal",
|
||||||
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
ParagraphAlignment = PdfParagraphAlignmentType.Left
|
||||||
});
|
});
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperEnums;
|
||||||
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
using SoftwareInstallationBusinessLogic.OfficePackage.HelperModels;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace SoftwareInstallationBusinessLogic.OfficePackage
|
namespace SoftwareInstallationBusinessLogic.OfficePackage
|
||||||
{
|
{
|
||||||
@ -11,20 +10,22 @@ namespace SoftwareInstallationBusinessLogic.OfficePackage
|
|||||||
CreateWord(info);
|
CreateWord(info);
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> { (info.Title, new
|
Texts = new List<(string, WordTextProperties)> { (info.Title, new WordTextProperties { Bold = true, Size = "24", }) },
|
||||||
WordTextProperties { Bold = true, Size = "24", }) },
|
|
||||||
TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
Size = "24",
|
Size = "24",
|
||||||
JustificationType = WordJustificationType.Center
|
JustificationType = WordJustificationType.Center
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
foreach (var component in info.Components)
|
foreach (var package in info.Packages)
|
||||||
{
|
{
|
||||||
CreateParagraph(new WordParagraph
|
CreateParagraph(new WordParagraph
|
||||||
{
|
{
|
||||||
Texts = new List<(string, WordTextProperties)> {
|
Texts = new List<(string, WordTextProperties)>
|
||||||
(component.ComponentName, new WordTextProperties { Size = "24", }) },
|
{
|
||||||
|
(package.PackageName, new WordTextProperties { Size = "24", Bold = true}),
|
||||||
|
(" - цена: " + package.Price.ToString(), new WordTextProperties { Size = "24" })
|
||||||
|
},
|
||||||
TextProperties = new WordTextProperties
|
TextProperties = new WordTextProperties
|
||||||
{
|
{
|
||||||
Size = "24",
|
Size = "24",
|
||||||
|
@ -6,6 +6,6 @@ namespace SoftwareInstallationBusinessLogic.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<PackageViewModel> Packages { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,8 +2,8 @@
|
|||||||
{
|
{
|
||||||
public class ReportPackageComponentViewModel
|
public class ReportPackageComponentViewModel
|
||||||
{
|
{
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
public string PackageName { get; set; } = string.Empty;
|
||||||
public int TotalCount { get; set; }
|
public int TotalCount { get; set; }
|
||||||
public List<Tuple<string, int>> Packages { get; set; } = new();
|
public List<Tuple<string, int>> Components { get; set; } = new();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -36,6 +36,15 @@ namespace SoftwareInstallationDatabaseImplement.Implements
|
|||||||
|
|
||||||
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
|
||||||
{
|
{
|
||||||
|
if (!model.Id.HasValue && model.DateFrom.HasValue && model.DateTo.HasValue) // если не ищем по айдишнику, значит ищем по диапазону дат
|
||||||
|
{
|
||||||
|
using var context = new SoftwareInstallationDatabase();
|
||||||
|
return context.Orders
|
||||||
|
.Include(x => x.Package)
|
||||||
|
.Where(x => model.DateFrom <= x.DateCreate.Date && x.DateCreate <= model.DateTo)
|
||||||
|
.Select(x => x.GetViewModel)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
var result = GetElement(model);
|
var result = GetElement(model);
|
||||||
return result != null ? new() { result } : new();
|
return result != null ? new() { result } : new();
|
||||||
}
|
}
|
||||||
|
@ -54,6 +54,10 @@ namespace SoftwareInstallationListImplement.Implements
|
|||||||
{
|
{
|
||||||
return new() { order.GetViewModel };
|
return new() { order.GetViewModel };
|
||||||
}
|
}
|
||||||
|
if(model.DateFrom != null && model.DateTo != null && model.DateFrom <= order.DateCreate.Date && order.DateCreate <= model.DateTo)
|
||||||
|
{
|
||||||
|
result.Add(order.GetViewModel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -10,11 +10,12 @@ namespace SoftwareInstallationView
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
|
_reportLogic = reportLogic;
|
||||||
}
|
}
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -45,8 +45,7 @@ namespace SoftwareInstallationView
|
|||||||
var source = new ReportDataSource("DataSetOrders", dataSource);
|
var source = new ReportDataSource("DataSetOrders", dataSource);
|
||||||
reportViewer.LocalReport.DataSources.Clear();
|
reportViewer.LocalReport.DataSources.Clear();
|
||||||
reportViewer.LocalReport.DataSources.Add(source);
|
reportViewer.LocalReport.DataSources.Add(source);
|
||||||
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
|
var parameters = new[] { new ReportParameter("ReportParameterPeriod",$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
||||||
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
|
|
||||||
reportViewer.LocalReport.SetParameters(parameters);
|
reportViewer.LocalReport.SetParameters(parameters);
|
||||||
|
|
||||||
reportViewer.RefreshReport();
|
reportViewer.RefreshReport();
|
||||||
|
@ -23,8 +23,8 @@ namespace SoftwareInstallationView
|
|||||||
dataGridView.Rows.Clear();
|
dataGridView.Rows.Clear();
|
||||||
foreach (var elem in dict)
|
foreach (var elem in dict)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { elem.ComponentName,"", "" });
|
dataGridView.Rows.Add(new object[] { elem.PackageName,"", "" });
|
||||||
foreach (var listElem in elem.Packages)
|
foreach (var listElem in elem.Components)
|
||||||
{
|
{
|
||||||
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,9 @@ using Microsoft.Extensions.DependencyInjection;
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
using SoftwareInstallationBusinessLogic.BusinessLogic;
|
using SoftwareInstallationBusinessLogic.BusinessLogic;
|
||||||
|
using SoftwareInstallationBusinessLogic.BusinessLogics;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage.Implements;
|
||||||
|
using SoftwareInstallationBusinessLogic.OfficePackage;
|
||||||
|
|
||||||
namespace SoftwareInstallationView
|
namespace SoftwareInstallationView
|
||||||
{
|
{
|
||||||
@ -40,6 +43,11 @@ namespace SoftwareInstallationView
|
|||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
services.AddTransient<IPackageLogic, PackageLogic>();
|
services.AddTransient<IPackageLogic, PackageLogic>();
|
||||||
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
|
||||||
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
|
|
||||||
services.AddTransient<FormMain>();
|
services.AddTransient<FormMain>();
|
||||||
services.AddTransient<FormComponent>();
|
services.AddTransient<FormComponent>();
|
||||||
@ -48,6 +56,9 @@ namespace SoftwareInstallationView
|
|||||||
services.AddTransient<FormPackage>();
|
services.AddTransient<FormPackage>();
|
||||||
services.AddTransient<FormPackageComponent>();
|
services.AddTransient<FormPackageComponent>();
|
||||||
services.AddTransient<FormPackages>();
|
services.AddTransient<FormPackages>();
|
||||||
|
services.AddTransient<FormReportOrders>();
|
||||||
|
services.AddTransient<FormReportPackageComponents>();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -424,7 +424,6 @@
|
|||||||
<PaddingBottom>2pt</PaddingBottom>
|
<PaddingBottom>2pt</PaddingBottom>
|
||||||
</Style>
|
</Style>
|
||||||
</Textbox>
|
</Textbox>
|
||||||
<rd:Selected>true</rd:Selected>
|
|
||||||
</CellContents>
|
</CellContents>
|
||||||
</TablixCell>
|
</TablixCell>
|
||||||
<TablixCell>
|
<TablixCell>
|
||||||
@ -484,7 +483,7 @@
|
|||||||
<Top>2.48391cm</Top>
|
<Top>2.48391cm</Top>
|
||||||
<Left>0.55245cm</Left>
|
<Left>0.55245cm</Left>
|
||||||
<Height>1.2cm</Height>
|
<Height>1.2cm</Height>
|
||||||
<Width>19.84713cm</Width>
|
<Width>19.84714cm</Width>
|
||||||
<ZIndex>2</ZIndex>
|
<ZIndex>2</ZIndex>
|
||||||
<Style>
|
<Style>
|
||||||
<Border>
|
<Border>
|
||||||
|
@ -27,4 +27,10 @@
|
|||||||
<ProjectReference Include="..\SoftwareInstallationListImplement\SoftwareInstallationListImplement.csproj" />
|
<ProjectReference Include="..\SoftwareInstallationListImplement\SoftwareInstallationListImplement.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="ReportOrders.rdlc">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
Loading…
Reference in New Issue
Block a user