готовая 4

This commit is contained in:
Казначеева Елизавета 2024-04-21 17:55:38 +04:00
parent 8ad7ef7f3f
commit d3003c7023
12 changed files with 26 additions and 17 deletions

View File

@ -40,7 +40,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
{ {
var record = new ReportPackageComponentViewModel var record = new ReportPackageComponentViewModel
{ {
SoftwareName = Software.PackageName, PackageName = Software.PackageName,
Components = new List<(string Component, int Count)>(), Components = new List<(string Component, int Count)>(),
TotalCount = 0 TotalCount = 0
}; };
@ -68,7 +68,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
{ {
Id = x.Id, Id = x.Id,
DateCreate = x.DateCreate, DateCreate = x.DateCreate,
SoftwareName = x.PackageName, PackageName = x.PackageName,
Sum = x.Sum, Sum = x.Sum,
Status = x.Status.ToString(), Status = x.Status.ToString(),
}) })
@ -80,7 +80,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
_saveToWord.CreateDoc(new WordInfo _saveToWord.CreateDoc(new WordInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список ЖИ", Title = "Список компонентов",
Softwares = _PackageStorage.GetFullList() Softwares = _PackageStorage.GetFullList()
}); });
} }
@ -89,7 +89,7 @@ namespace SoftwareInstallationBusinessLogic.BusinessLogics
_saveToExcel.CreateReport(new ExcelInfo _saveToExcel.CreateReport(new ExcelInfo
{ {
FileName = model.FileName, FileName = model.FileName,
Title = "Список ЖИ", Title = "Список компонентов",
SoftwareComponents = GetSoftwareComponents() SoftwareComponents = GetSoftwareComponents()
}); });
} }

View File

@ -32,7 +32,7 @@ namespace SoftwareInstallationBusinessLogic.OfficePackage
{ {
ColumnName = "A", ColumnName = "A",
RowIndex = rowIndex, RowIndex = rowIndex,
Text = pc.SoftwareName, Text = pc.PackageName,
StyleInfo = ExcelStyleInfoType.Text StyleInfo = ExcelStyleInfoType.Text
}); });
rowIndex++; rowIndex++;

View File

@ -36,7 +36,7 @@ namespace SoftwareInstallationBusinessLogic.OfficePackage
{ {
CreateRow(new PdfRowParameters CreateRow(new PdfRowParameters
{ {
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.SoftwareName, order.Sum.ToString(), order.Status }, Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.PackageName, order.Sum.ToString(), order.Status },
Style = "Normal", Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left ParagraphAlignment = PdfParagraphAlignmentType.Left
}); });

View File

@ -27,8 +27,8 @@ namespace SoftwareInstallationBusinessLogic.OfficePackage
CreateParagraph(new WordParagraph CreateParagraph(new WordParagraph
{ {
Texts = new List<(string, WordTextProperties)> Texts = new List<(string, WordTextProperties)>
{(Software.PackageName + " - ", new WordTextProperties { Size = "24", Bold = true}), { (Software.PackageName + " - ", new WordTextProperties { Size = "24", Bold = true }),
(Software.Price.ToString(), new WordTextProperties { Size = "24", })}, (" стоит " + Software.Price.ToString() + " рублей", new WordTextProperties { Size = "24", })},
TextProperties = new WordTextProperties TextProperties = new WordTextProperties
{ {

View File

@ -10,7 +10,7 @@ namespace SoftwareInstallationContracts.ViewModels
{ {
public int Id { get; set; } public int Id { get; set; }
public DateTime DateCreate { get; set; } public DateTime DateCreate { get; set; }
public string SoftwareName { get; set; } = string.Empty; public string PackageName { get; set; } = string.Empty;
public double Sum { get; set; } public double Sum { get; set; }
public string Status { get; set; } = string.Empty; public string Status { get; set; } = string.Empty;
} }

View File

@ -8,7 +8,7 @@ namespace SoftwareInstallationContracts.ViewModels
{ {
public class ReportPackageComponentViewModel public class ReportPackageComponentViewModel
{ {
public string SoftwareName { get; set; } = string.Empty; public string PackageName { get; set; } = string.Empty;
public int TotalCount { get; set; } public int TotalCount { get; set; }
public List<(string Component, int Count)> Components { get; set; } = new(); public List<(string Component, int Count)> Components { get; set; } = new();

View File

@ -24,11 +24,19 @@ namespace SoftwareInstallationDatabaseImplement
public List<OrderViewModel> GetFilteredList(OrderSearchModel model) public List<OrderViewModel> GetFilteredList(OrderSearchModel model)
{ {
if (!model.Id.HasValue) if (!model.Id.HasValue && !model.DateFrom.HasValue)
{ {
return new(); return new();
} }
using var context = new SoftwareInstallationDatabase(); using var context = new SoftwareInstallationDatabase();
if (model.DateFrom.HasValue)
{
return context.Orders
.Include(x => x.Package)
.Where(x => x.DateCreate >= model.DateFrom && x.DateCreate <= model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}
return context.Orders return context.Orders
.Include(x => x.Package) .Include(x => x.Package)
.Where(x => x.Id == model.Id) .Where(x => x.Id == model.Id)

View File

@ -46,7 +46,8 @@
panel.Controls.Add(dateTimePickerStart); panel.Controls.Add(dateTimePickerStart);
panel.Controls.Add(labelEnd); panel.Controls.Add(labelEnd);
panel.Controls.Add(labelStart); panel.Controls.Add(labelStart);
panel.Location = new Point(1, 0); panel.Dock = DockStyle.Top;
panel.Location = new Point(0, 0);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(800, 77); panel.Size = new Size(800, 77);
panel.TabIndex = 0; panel.TabIndex = 0;

View File

@ -28,7 +28,7 @@ namespace SoftwareInstallationView
{ {
Dock = DockStyle.Fill Dock = DockStyle.Fill
}; };
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open)); reportViewer.LocalReport.LoadReportDefinition(new FileStream("D:\\RPP\\SoftwareInstallation\\SoftwareInstallationView\\ReportOrders.rdlc", FileMode.Open));
Controls.Clear(); Controls.Clear();
Controls.Add(reportViewer); Controls.Add(reportViewer);
Controls.Add(panel); Controls.Add(panel);

View File

@ -79,6 +79,7 @@
Controls.Add(buttonSaveToExcel); Controls.Add(buttonSaveToExcel);
Name = "FormReportPackageComponents"; Name = "FormReportPackageComponents";
Text = "Компоненты по изделиям"; Text = "Компоненты по изделиям";
Load += FormReportPackageComponents_Load;
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false); ResumeLayout(false);
} }

View File

@ -56,7 +56,7 @@ namespace SoftwareInstallationView
dataGridView.Rows.Clear(); dataGridView.Rows.Clear();
foreach (var elem in dict) foreach (var elem in dict)
{ {
dataGridView.Rows.Add(new object[] { elem.SoftwareName, "", "" }); dataGridView.Rows.Add(new object[] { elem.PackageName, "", "" });
foreach (var listElem in elem.Components) foreach (var listElem in elem.Components)
{ {
dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 }); dataGridView.Rows.Add(new object[] { "", listElem.Item1, listElem.Item2 });

View File

@ -9,14 +9,13 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.18">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" /> <PackageReference Include="ReportViewerCore.WinForms" Version="15.1.18" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>