4 с половиной часа безудержного веселья

This commit is contained in:
antoc0der 2024-03-26 20:44:18 +04:00
parent 16986cf1a5
commit 0e8bd52b64
14 changed files with 659 additions and 628 deletions

View File

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup>
<ItemGroup>

View File

@ -24,10 +24,10 @@ namespace FlowerShopBusinessLogic.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", "4cm" });
CreateRow(new PdfRowParameters
{
Texts = new List<string> { "Номер", "Дата заказа", "Изделие","Сумма" },
Texts = new List<string> { "Номер", "Дата заказа", "Изделие","Сумма", "Статус" },
Style = "NormalTitle",
ParagraphAlignment = PdfParagraphAlignmentType.Center
});
@ -35,7 +35,7 @@ namespace FlowerShopBusinessLogic.OfficePackage
{
CreateRow(new PdfRowParameters
{
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.FlowerName, order.Sum.ToString() },
Texts = new List<string> { order.Id.ToString(), order.DateCreate.ToShortDateString(), order.FlowerName, order.Sum.ToString(), order.OrderStatus.ToString() },
Style = "Normal",
ParagraphAlignment = PdfParagraphAlignmentType.Left
});

View File

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup>
<ItemGroup>

View File

@ -11,6 +11,7 @@ namespace FlowerShopContracts.ViewModels
public int Id { get; set; }
public DateTime DateCreate { get; set; }
public string FlowerName { get; set; } = string.Empty;
public string OrderStatus { get; set; } = string.Empty;
public double Sum { get; set; }
}

View File

@ -9,7 +9,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup>
</Project>

View File

@ -14,7 +14,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup>
<ItemGroup>

View File

@ -30,7 +30,9 @@ namespace FlowerShopDatabaseImplement.Implements
}
using var context = new FlowerShopDataBase();
return context.Orders.Include(x => x.Flower)
.Where(x => x.Id == model.Id)
.Where(x => ((!model.Id.HasValue || x.Id == model.Id) &&
(!model.DateFrom.HasValue || x.DateCreate >= model.DateFrom) &&
(!model.DateTo.HasValue || x.DateCreate <= model.DateTo)))
.Select(x => x.GetViewModel)
.ToList();
}

View File

@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup>
<ItemGroup>

View File

@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
</ItemGroup>
<ItemGroup>

View File

@ -34,18 +34,21 @@
labelPo = new Label();
buttonMake = new Button();
buttonToPdf = new Button();
panel = new Panel();
panel1 = new Panel();
panel.SuspendLayout();
SuspendLayout();
//
// dateTimePickerFrom
//
dateTimePickerFrom.Location = new Point(51, 10);
dateTimePickerFrom.Location = new Point(48, 15);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(250, 27);
dateTimePickerFrom.TabIndex = 0;
//
// dateTimePickerTo
//
dateTimePickerTo.Location = new Point(363, 10);
dateTimePickerTo.Location = new Point(359, 15);
dateTimePickerTo.Name = "dateTimePickerTo";
dateTimePickerTo.Size = new Size(250, 27);
dateTimePickerTo.TabIndex = 1;
@ -53,7 +56,7 @@
// labelS
//
labelS.AutoSize = true;
labelS.Location = new Point(12, 15);
labelS.Location = new Point(8, 20);
labelS.Name = "labelS";
labelS.Size = new Size(18, 20);
labelS.TabIndex = 2;
@ -62,7 +65,7 @@
// labelPo
//
labelPo.AutoSize = true;
labelPo.Location = new Point(317, 15);
labelPo.Location = new Point(315, 22);
labelPo.Name = "labelPo";
labelPo.Size = new Size(29, 20);
labelPo.TabIndex = 3;
@ -70,7 +73,7 @@
//
// buttonMake
//
buttonMake.Location = new Point(649, 11);
buttonMake.Location = new Point(637, 13);
buttonMake.Name = "buttonMake";
buttonMake.Size = new Size(139, 29);
buttonMake.TabIndex = 4;
@ -80,7 +83,7 @@
//
// buttonToPdf
//
buttonToPdf.Location = new Point(1078, 11);
buttonToPdf.Location = new Point(1050, 11);
buttonToPdf.Name = "buttonToPdf";
buttonToPdf.Size = new Size(94, 29);
buttonToPdf.TabIndex = 5;
@ -88,21 +91,38 @@
buttonToPdf.UseVisualStyleBackColor = true;
buttonToPdf.Click += buttonToPdf_Click;
//
// panel
//
panel.Controls.Add(dateTimePickerFrom);
panel.Controls.Add(buttonToPdf);
panel.Controls.Add(labelS);
panel.Controls.Add(buttonMake);
panel.Controls.Add(dateTimePickerTo);
panel.Controls.Add(labelPo);
panel.Location = new Point(12, 2);
panel.Name = "panel";
panel.Size = new Size(1160, 56);
panel.TabIndex = 6;
//
// panel1
//
panel1.Location = new Point(15, 69);
panel1.Name = "panel1";
panel1.Size = new Size(1158, 479);
panel1.TabIndex = 7;
//
// FormReportOrders
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1184, 217);
Controls.Add(buttonToPdf);
Controls.Add(buttonMake);
Controls.Add(labelPo);
Controls.Add(labelS);
Controls.Add(dateTimePickerTo);
Controls.Add(dateTimePickerFrom);
ClientSize = new Size(1184, 567);
Controls.Add(panel1);
Controls.Add(panel);
Name = "FormReportOrders";
Text = "FormReportOrders";
panel.ResumeLayout(false);
panel.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
@ -113,5 +133,7 @@
private Label labelPo;
private Button buttonMake;
private Button buttonToPdf;
private Panel panel;
private Panel panel1;
}
}

View File

@ -28,10 +28,8 @@ namespace ProjectFlowerShop
{
Dock = DockStyle.Fill
};
reportViewer.LocalReport.LoadReportDefinition(new
FileStream("ReportOrders.rdlc", FileMode.Open));
Controls.Clear();
Controls.Add(reportViewer);
panel1.Controls.Add(reportViewer);
reportViewer.LocalReport.LoadReportDefinition(new FileStream("ReportOrders.rdlc", FileMode.Open));
}
@ -95,7 +93,7 @@ namespace ProjectFlowerShop
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
MessageBoxIcon.Error);
}

View File

@ -8,6 +8,9 @@ using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
using System.Drawing;
using FlowerShopBusinessLogic;
using FlowerShopBusinessLogic.OfficePackage.Implements;
using FlowerShopBusinessLogic.OfficePackage;
namespace ProjectFlowerShop
{
@ -40,6 +43,7 @@ namespace ProjectFlowerShop
services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<IFlowerLogic, FlowerLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<MainForm>();
services.AddTransient<ComponentForm>();
services.AddTransient<FormComponents>();
@ -47,6 +51,11 @@ namespace ProjectFlowerShop
services.AddTransient<FormFlower>();
services.AddTransient<FormFlowerComponent>();
services.AddTransient<FormFlowers>();
services.AddTransient<FormReportFlowerComponent>();
services.AddTransient<FormReportOrders>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
}
}

View File

@ -16,7 +16,7 @@
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="PDFsharp-MigraDoc" Version="6.0.0" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
</ItemGroup>

File diff suppressed because it is too large Load Diff