Перезаписал

This commit is contained in:
Владимир Данилов 2024-05-02 23:04:45 +04:00
parent 90bdd2cc2a
commit 88b8ae5390
8 changed files with 251 additions and 222 deletions

View File

@ -30,10 +30,10 @@
{ {
panel = new Panel(); panel = new Panel();
buttonToPdf = new Button(); buttonToPdf = new Button();
buttonCreateReport = new Button(); buttonMake = new Button();
dateTimePickerTo = new DateTimePicker(); dateTimePickerTo = new DateTimePicker();
labelTo = new Label();
dateTimePickerFrom = new DateTimePicker(); dateTimePickerFrom = new DateTimePicker();
labelTo = new Label();
labelFrom = new Label(); labelFrom = new Label();
panel.SuspendLayout(); panel.SuspendLayout();
SuspendLayout(); SuspendLayout();
@ -41,81 +41,74 @@
// panel // panel
// //
panel.Controls.Add(buttonToPdf); panel.Controls.Add(buttonToPdf);
panel.Controls.Add(buttonCreateReport); panel.Controls.Add(buttonMake);
panel.Controls.Add(dateTimePickerTo); panel.Controls.Add(dateTimePickerTo);
panel.Controls.Add(labelTo);
panel.Controls.Add(dateTimePickerFrom); panel.Controls.Add(dateTimePickerFrom);
panel.Controls.Add(labelTo);
panel.Controls.Add(labelFrom); panel.Controls.Add(labelFrom);
panel.Dock = DockStyle.Top; panel.Dock = DockStyle.Top;
panel.Location = new Point(0, 0); panel.Location = new Point(0, 0);
panel.Name = "panel"; panel.Name = "panel";
panel.Size = new Size(1019, 38); panel.Size = new Size(826, 33);
panel.TabIndex = 0; panel.TabIndex = 0;
// //
// buttonToPdf // buttonToPdf
// //
buttonToPdf.Anchor = AnchorStyles.Top | AnchorStyles.Right; buttonToPdf.Location = new Point(709, 5);
buttonToPdf.Location = new Point(866, 5);
buttonToPdf.Margin = new Padding(4, 3, 4, 3);
buttonToPdf.Name = "buttonToPdf"; buttonToPdf.Name = "buttonToPdf";
buttonToPdf.Size = new Size(139, 27); buttonToPdf.Size = new Size(103, 23);
buttonToPdf.TabIndex = 6; buttonToPdf.TabIndex = 5;
buttonToPdf.Text = "В Pdf"; buttonToPdf.Text = "В PDF";
buttonToPdf.UseVisualStyleBackColor = true; buttonToPdf.UseVisualStyleBackColor = true;
buttonToPdf.Click += ButtonToPdf_Click; buttonToPdf.Click += buttonToPdf_Click;
// //
// buttonCreateReport // buttonMake
// //
buttonCreateReport.Location = new Point(565, 5); buttonMake.Location = new Point(510, 5);
buttonCreateReport.Margin = new Padding(4, 3, 4, 3); buttonMake.Name = "buttonMake";
buttonCreateReport.Name = "buttonCreateReport"; buttonMake.Size = new Size(144, 23);
buttonCreateReport.Size = new Size(139, 27); buttonMake.TabIndex = 4;
buttonCreateReport.TabIndex = 5; buttonMake.Text = "Сформировать";
buttonCreateReport.Text = "Сформировать"; buttonMake.UseVisualStyleBackColor = true;
buttonCreateReport.UseVisualStyleBackColor = true; buttonMake.Click += buttonMake_Click;
buttonCreateReport.Click += ButtonCreateReport_Click;
// //
// dateTimePickerTo // dateTimePickerTo
// //
dateTimePickerTo.Location = new Point(257, 8); dateTimePickerTo.Location = new Point(282, 7);
dateTimePickerTo.Margin = new Padding(4, 3, 4, 3);
dateTimePickerTo.Name = "dateTimePickerTo"; dateTimePickerTo.Name = "dateTimePickerTo";
dateTimePickerTo.Size = new Size(163, 23); dateTimePickerTo.Size = new Size(200, 23);
dateTimePickerTo.TabIndex = 4; dateTimePickerTo.TabIndex = 3;
//
// dateTimePickerFrom
//
dateTimePickerFrom.Location = new Point(31, 7);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(200, 23);
dateTimePickerFrom.TabIndex = 2;
// //
// labelTo // labelTo
// //
labelTo.AutoSize = true; labelTo.AutoSize = true;
labelTo.Location = new Point(217, 11); labelTo.Location = new Point(246, 13);
labelTo.Margin = new Padding(4, 0, 4, 0);
labelTo.Name = "labelTo"; labelTo.Name = "labelTo";
labelTo.Size = new Size(21, 15); labelTo.Size = new Size(21, 15);
labelTo.TabIndex = 3; labelTo.TabIndex = 1;
labelTo.Text = "по"; labelTo.Text = "по";
// //
// dateTimePickerFrom
//
dateTimePickerFrom.Location = new Point(36, 8);
dateTimePickerFrom.Margin = new Padding(4, 3, 4, 3);
dateTimePickerFrom.Name = "dateTimePickerFrom";
dateTimePickerFrom.Size = new Size(163, 23);
dateTimePickerFrom.TabIndex = 2;
//
// labelFrom // labelFrom
// //
labelFrom.AutoSize = true; labelFrom.AutoSize = true;
labelFrom.Location = new Point(13, 11); labelFrom.Location = new Point(10, 13);
labelFrom.Margin = new Padding(4, 0, 4, 0);
labelFrom.Name = "labelFrom"; labelFrom.Name = "labelFrom";
labelFrom.Size = new Size(15, 15); labelFrom.Size = new Size(15, 15);
labelFrom.TabIndex = 1; labelFrom.TabIndex = 0;
labelFrom.Text = "С"; labelFrom.Text = "С";
// //
// FormReportOrders // FormReportOrders
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1019, 450); ClientSize = new Size(826, 277);
Controls.Add(panel); Controls.Add(panel);
Name = "FormReportOrders"; Name = "FormReportOrders";
Text = "Заказы"; Text = "Заказы";
@ -127,11 +120,11 @@
#endregion #endregion
private Panel panel; private Panel panel;
private DateTimePicker dateTimePickerFrom;
private Label labelTo;
private Label labelFrom; private Label labelFrom;
private Button buttonToPdf; private Button buttonToPdf;
private Button buttonCreateReport; private Button buttonMake;
private DateTimePicker dateTimePickerTo; private DateTimePicker dateTimePickerTo;
private Label labelTo;
private DateTimePicker dateTimePickerFrom;
} }
} }

View File

@ -2,89 +2,99 @@
using RenovationWorkContracts.BusinessLogicsContracts; using RenovationWorkContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using Microsoft.Reporting.WinForms; using Microsoft.Reporting.WinForms;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace RenovationWorkView namespace RenovationWorkView
{ {
public partial class FormReportOrders : Form public partial class FormReportOrders : Form
{ {
private readonly ReportViewer reportViewer; private readonly ReportViewer reportViewer;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IReportLogic _logic; private readonly IReportLogic _logic;
public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
{
InitializeComponent();
_logger = logger;
_logic = logic;
reportViewer = new ReportViewer
{
Dock = DockStyle.Fill
};
reportViewer.LocalReport.LoadReportDefinition(new FileStream("C:\\Users\\danil\\source\\repos\\PIbd-21_Danilov_V.V._RenovationWork\\RenovationWork\\RenovationWork\\ReportOrders.rdlc", FileMode.Open));
Controls.Clear();
Controls.Add(reportViewer);
Controls.Add(panel);
}
private void ButtonCreateReport_Click(object sender, EventArgs e) public FormReportOrders(ILogger<FormReportOrders> logger, IReportLogic logic)
{ {
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) InitializeComponent();
{ _logger = logger;
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); _logic = logic;
return; reportViewer = new ReportViewer
} {
try Dock = DockStyle.Fill
{ };
var dataSource = _logic.GetOrders(new ReportBindingModel reportViewer.LocalReport.LoadReportDefinition(new FileStream("..\\..\\..\\ReportOrders.rdlc", FileMode.Open));
{ Controls.Clear();
DateFrom = dateTimePickerFrom.Value, Controls.Add(reportViewer);
DateTo = dateTimePickerTo.Value Controls.Add(panel);
}); }
var source = new ReportDataSource("DataSetOrders", dataSource);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source);
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
reportViewer.LocalReport.SetParameters(parameters);
reportViewer.RefreshReport(); private void buttonMake_Click(object sender, EventArgs e)
_logger.LogInformation("Loading list of orders for period {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); {
} if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
catch (Exception ex) {
{ MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
_logger.LogError(ex, "Loading list of orders for period error"); return;
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); }
} try
} {
var dataSource = _logic.GetOrders(new ReportBindingModel
{
DateFrom = dateTimePickerFrom.Value,
DateTo = dateTimePickerTo.Value
});
var source = new ReportDataSource("DataSetOrders", dataSource);
reportViewer.LocalReport.DataSources.Clear();
reportViewer.LocalReport.DataSources.Add(source);
var parameters = new[] { new ReportParameter("ReportParameterPeriod",
$"c {dateTimePickerFrom.Value.ToShortDateString()} по {dateTimePickerTo.Value.ToShortDateString()}") };
reportViewer.LocalReport.SetParameters(parameters);
private void ButtonToPdf_Click(object sender, EventArgs e) reportViewer.RefreshReport();
{ _logger.LogInformation("Загрузка списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date) }
{ catch (Exception ex)
MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); {
return; _logger.LogError(ex, "Ошибка загрузки списка заказов на период");
} MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" }; }
if (dialog.ShowDialog() == DialogResult.OK) }
{
try private void buttonToPdf_Click(object sender, EventArgs e)
{ {
_logic.SaveOrdersToPdfFile(new ReportBindingModel if (dateTimePickerFrom.Value.Date >= dateTimePickerTo.Value.Date)
{ {
FileName = dialog.FileName, MessageBox.Show("Дата начала должна быть меньше даты окончания", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
DateFrom = dateTimePickerFrom.Value, return;
DateTo = dateTimePickerTo.Value }
}); using var dialog = new SaveFileDialog { Filter = "pdf|*.pdf" };
_logger.LogInformation("Saving list of orders for period {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString()); if (dialog.ShowDialog() == DialogResult.OK)
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); {
} try
catch (Exception ex) {
{ _logic.SaveOrdersToPdfFile(new ReportBindingModel
_logger.LogError(ex, "Saving list of orders for period error"); {
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); FileName = dialog.FileName,
} DateFrom = dateTimePickerFrom.Value,
} DateTo = dateTimePickerTo.Value
} });
} _logger.LogInformation("Сохранение списка заказов на период {From}-{To}", dateTimePickerFrom.Value.ToShortDateString(), dateTimePickerTo.Value.ToShortDateString());
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception ex)
{
_logger.LogError(ex, "Ошибка сохранения списка заказов на период");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
} }

View File

@ -1,6 +1,4 @@
using System.Windows.Forms; namespace RenovationWorkView
namespace RenovationWorkView
{ {
partial class FormReportRepairComponents partial class FormReportRepairComponents
{ {
@ -30,70 +28,59 @@ namespace RenovationWorkView
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
dataGridView = new DataGridView();
ColumEngine = new DataGridViewTextBoxColumn();
ColumnComponent = new DataGridViewTextBoxColumn();
ColumnCount = new DataGridViewTextBoxColumn();
buttonSaveToExcel = new Button(); buttonSaveToExcel = new Button();
dataGridView = new DataGridView();
ColumnComponent = new DataGridViewTextBoxColumn();
ColumnRepair = new DataGridViewTextBoxColumn();
ColumnCount = new DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); SuspendLayout();
// //
// dataGridView
//
dataGridView.AllowUserToAddRows = false;
dataGridView.AllowUserToDeleteRows = false;
dataGridView.AllowUserToOrderColumns = true;
dataGridView.AllowUserToResizeColumns = false;
dataGridView.AllowUserToResizeRows = false;
dataGridView.BackgroundColor = SystemColors.ControlLightLight;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumEngine, ColumnComponent, ColumnCount });
dataGridView.Location = new Point(1, 58);
dataGridView.Margin = new Padding(4, 3, 4, 3);
dataGridView.MultiSelect = false;
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersVisible = false;
dataGridView.Size = new Size(624, 459);
dataGridView.TabIndex = 0;
//
// ColumEngine
//
ColumEngine.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
ColumEngine.HeaderText = "Ремонт";
ColumEngine.Name = "ColumEngine";
ColumEngine.ReadOnly = true;
//
// ColumnComponent
//
ColumnComponent.HeaderText = "Компонент";
ColumnComponent.Name = "ColumnComponent";
ColumnComponent.ReadOnly = true;
ColumnComponent.Width = 200;
//
// ColumnCount
//
ColumnCount.HeaderText = "Количество";
ColumnCount.Name = "ColumnCount";
ColumnCount.ReadOnly = true;
//
// buttonSaveToExcel // buttonSaveToExcel
// //
buttonSaveToExcel.Location = new Point(12, 12); buttonSaveToExcel.Location = new Point(12, 12);
buttonSaveToExcel.Name = "buttonSaveToExcel"; buttonSaveToExcel.Name = "buttonSaveToExcel";
buttonSaveToExcel.Size = new Size(180, 40); buttonSaveToExcel.Size = new Size(157, 23);
buttonSaveToExcel.TabIndex = 1; buttonSaveToExcel.TabIndex = 0;
buttonSaveToExcel.Text = "Сохранить в Excel"; buttonSaveToExcel.Text = "Сохранить в Excel";
buttonSaveToExcel.UseVisualStyleBackColor = true; buttonSaveToExcel.UseVisualStyleBackColor = true;
buttonSaveToExcel.Click += buttonSaveToExcel_Click; buttonSaveToExcel.Click += buttonSaveToExcel_Click;
// //
// dataGridView
//
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnComponent, ColumnRepair, ColumnCount });
dataGridView.Location = new Point(0, 41);
dataGridView.Name = "dataGridView";
dataGridView.RowTemplate.Height = 25;
dataGridView.Size = new Size(600, 150);
dataGridView.TabIndex = 1;
//
// ColumnComponent
//
ColumnComponent.HeaderText = "Компонент";
ColumnComponent.Name = "ColumnComponent";
ColumnComponent.Width = 185;
//
// ColumnRepair
//
ColumnRepair.HeaderText = "Изделие";
ColumnRepair.Name = "ColumnRepair";
ColumnRepair.Width = 185;
//
// ColumnCount
//
ColumnCount.HeaderText = "Количество";
ColumnCount.Name = "ColumnCount";
ColumnCount.Width = 185;
//
// FormReportRepairComponents // FormReportRepairComponents
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(625, 518); ClientSize = new Size(604, 229);
Controls.Add(buttonSaveToExcel);
Controls.Add(dataGridView); Controls.Add(dataGridView);
Controls.Add(buttonSaveToExcel);
Name = "FormReportRepairComponents"; Name = "FormReportRepairComponents";
Text = "Компоненты по изделиям"; Text = "Компоненты по изделиям";
Load += FormReportRepairComponents_Load; Load += FormReportRepairComponents_Load;
@ -103,10 +90,10 @@ namespace RenovationWorkView
#endregion #endregion
private DataGridView dataGridView;
private DataGridViewTextBoxColumn ColumEngine;
private DataGridViewTextBoxColumn ColumnComponent;
private DataGridViewTextBoxColumn ColumnCount;
private Button buttonSaveToExcel; private Button buttonSaveToExcel;
private DataGridView dataGridView;
private DataGridViewTextBoxColumn ColumnComponent;
private DataGridViewTextBoxColumn ColumnRepair;
private DataGridViewTextBoxColumn ColumnCount;
} }
} }

View File

@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging; using RenovationWorkContracts.BindingModels;
using RenovationWorkContracts.BindingModels;
using RenovationWorkContracts.BusinessLogicsContracts; using RenovationWorkContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -16,15 +16,14 @@ namespace RenovationWorkView
public partial class FormReportRepairComponents : Form public partial class FormReportRepairComponents : Form
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IReportLogic _logic; private readonly IReportLogic _logic;
public FormReportRepairComponents(ILogger<FormReportRepairComponents> logger, IReportLogic logic) public FormReportRepairComponents(ILogger<FormReportRepairComponents> logger, IReportLogic logic)
{ {
InitializeComponent(); InitializeComponent();
_logger = logger; _logger = logger;
_logic = logic; _logic = logic;
} }
private void FormReportRepairComponents_Load(object sender, EventArgs e) private void FormReportRepairComponents_Load(object sender, EventArgs e)
{ {
try try
@ -44,11 +43,11 @@ namespace RenovationWorkView
dataGridView.Rows.Add(Array.Empty<object>()); dataGridView.Rows.Add(Array.Empty<object>());
} }
} }
_logger.LogInformation("Loading list of repairs with components"); _logger.LogInformation("Загрузка списка изделий по компонентам");
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Loading list of repairs with components error"); _logger.LogError(ex, "Ошибка загрузки списка изделий по компонентам");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
@ -64,12 +63,12 @@ namespace RenovationWorkView
{ {
FileName = dialog.FileName FileName = dialog.FileName
}); });
_logger.LogInformation("Saving list of repairs with components"); _logger.LogInformation("Сохранение списка изделий по компонентам");
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Saving list of repairs with components error"); _logger.LogError(ex, "Ошибка сохранения списка изделий по компонентам");
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }

View File

@ -117,4 +117,13 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<metadata name="ColumnComponent.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnRepair.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="ColumnCount.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root> </root>

View File

@ -5,9 +5,9 @@ using RenovationWorkDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging; using NLog.Extensions.Logging;
using System.Text;
using RenovationWorkBusinessLogic.OfficePackage.Implements; using RenovationWorkBusinessLogic.OfficePackage.Implements;
using RenovationWorkBusinessLogic.OfficePackage; using RenovationWorkBusinessLogic.OfficePackage;
using System.Text;
namespace RenovationWorkView namespace RenovationWorkView
{ {
@ -15,18 +15,21 @@ namespace RenovationWorkView
{ {
private static ServiceProvider? _serviceProvider; private static ServiceProvider? _serviceProvider;
public static ServiceProvider? ServiceProvider => _serviceProvider; public static ServiceProvider? ServiceProvider => _serviceProvider;
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread] [STAThread]
static void Main() static void Main()
{ {
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
// To customize application configuration such as set high DPI settings or default font, // To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration. // see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
var services = new ServiceCollection(); var services = new ServiceCollection();
ConfigureServices(services); ConfigureServices(services);
_serviceProvider = services.BuildServiceProvider(); _serviceProvider = services.BuildServiceProvider();
Application.Run(_serviceProvider.GetRequiredService<FormMain>()); Application.Run(_serviceProvider.GetRequiredService<FormMain>());
} }
private static void ConfigureServices(ServiceCollection services) private static void ConfigureServices(ServiceCollection services)
{ {
services.AddLogging(option => services.AddLogging(option =>
@ -42,10 +45,10 @@ namespace RenovationWorkView
services.AddTransient<IRepairLogic, RepairLogic>(); services.AddTransient<IRepairLogic, RepairLogic>();
services.AddTransient<IReportLogic, ReportLogic>(); services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<AbstractSaveToWord, SaveToWord>(); services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>(); services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>(); services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<FormMain>(); services.AddTransient<FormMain>();
services.AddTransient<FormComponent>(); services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>(); services.AddTransient<FormComponents>();

View File

@ -2,20 +2,23 @@
<PropertyGroup> <PropertyGroup>
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net8.0-windows</TargetFramework> <TargetFramework>net8.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.17">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
<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.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="NLog" Version="5.2.8" /> <PackageReference Include="NLog" Version="5.2.8" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" /> <PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
<PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" /> <PackageReference Include="ReportViewerCore.WinForms" Version="15.1.19" />
</ItemGroup> </ItemGroup>
@ -23,8 +26,24 @@
<ProjectReference Include="..\RenovationWorkBusinessLogic\RenovationWorkBusinessLogic.csproj" /> <ProjectReference Include="..\RenovationWorkBusinessLogic\RenovationWorkBusinessLogic.csproj" />
<ProjectReference Include="..\RenovationWorkContracts\RenovationWorkContracts.csproj" /> <ProjectReference Include="..\RenovationWorkContracts\RenovationWorkContracts.csproj" />
<ProjectReference Include="..\RenovationWorkDatabaseImplement\RenovationWorkDatabaseImplement.csproj" /> <ProjectReference Include="..\RenovationWorkDatabaseImplement\RenovationWorkDatabaseImplement.csproj" />
<ProjectReference Include="..\RenovationWorkDataModels\RenovationWorkDataModels.csproj" />
<ProjectReference Include="..\RenovationWorkFileImplement\RenovationWorkFileImplement.csproj" /> <ProjectReference Include="..\RenovationWorkFileImplement\RenovationWorkFileImplement.csproj" />
<ProjectReference Include="..\RenovationWorkListImplement\RenovationWorkListImplement.csproj" /> <ProjectReference Include="..\RenovationWorkListImplement\RenovationWorkListImplement.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project> </Project>

View File

@ -1,6 +1,15 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2016/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh> <AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="RenovationWorkContractsViewModels">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>47cb53f0-7dde-4717-ba03-866a0bc4f4dd</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets> <DataSets>
<DataSet Name="DataSetOrders"> <DataSet Name="DataSetOrders">
<Query> <Query>
@ -24,15 +33,15 @@
<DataField>Sum</DataField> <DataField>Sum</DataField>
<rd:TypeName>System.Decimal</rd:TypeName> <rd:TypeName>System.Decimal</rd:TypeName>
</Field> </Field>
<Field Name="OrderStatus"> <Field Name="Status">
<DataField>OrderStatus</DataField> <DataField>Status</DataField>
<rd:TypeName>RenovationWorkDataModels.OrderStatus</rd:TypeName> <rd:TypeName>RenovationWorkDataModels.Status</rd:TypeName>
</Field> </Field>
</Fields> </Fields>
<rd:DataSetInfo> <rd:DataSetInfo>
<rd:DataSetName>RenovationWorkContracts.ViewModels</rd:DataSetName> <rd:DataSetName>RenovationWorkContracts.ViewModels</rd:DataSetName>
<rd:TableName>ReportOrdersViewModel</rd:TableName> <rd:TableName>ReportOrderViewModel</rd:TableName>
<rd:ObjectDataSourceType>RenovationWorkContracts.ViewModels.ReportOrdersViewModel, RenovationWorkContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType> <rd:ObjectDataSourceType>RenovationWorkContracts.ViewModels.ReportOrderViewModel, RenovationWorkContracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</rd:ObjectDataSourceType>
</rd:DataSetInfo> </rd:DataSetInfo>
</DataSet> </DataSet>
</DataSets> </DataSets>
@ -81,9 +90,9 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Заказы</Value> <Value>Список заказов</Value>
<Style> <Style>
<FontSize>14pt</FontSize> <FontSize>16pt</FontSize>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
</TextRun> </TextRun>
@ -93,14 +102,14 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>TextboxTitle</rd:DefaultName> <Height>1cm</Height>
<Height>0.83812cm</Height>
<Width>21cm</Width> <Width>21cm</Width>
<ZIndex>1</ZIndex> <ZIndex>1</ZIndex>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
</Border> </Border>
<VerticalAlign>Middle</VerticalAlign>
<PaddingLeft>2pt</PaddingLeft> <PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight> <PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop> <PaddingTop>2pt</PaddingTop>
@ -171,7 +180,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Дата создания</Value> <Value>Дата заказа</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -235,7 +244,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Статус Заказа</Value> <Value>Сумма</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -267,7 +276,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>Сумма</Value> <Value>Статус</Value>
<Style> <Style>
<FontWeight>Bold</FontWeight> <FontWeight>Bold</FontWeight>
</Style> </Style>
@ -359,7 +368,7 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="RepairName"> <Textbox Name="Name">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@ -389,21 +398,21 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="OrderStatus"> <Textbox Name="Sum1">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!OrderStatus.Value</Value> <Value>=Fields!Sum.Value</Value>
<Style /> <Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>OrderStatus</rd:DefaultName> <rd:DefaultName>Sum1</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -419,21 +428,21 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Sum"> <Textbox Name="Status">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>=Fields!Sum.Value</Value> <Value>=Fields!Status.Value</Value>
<Style /> <Style />
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style /> <Style />
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Sum</rd:DefaultName> <rd:DefaultName>Status</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Color>LightGrey</Color> <Color>LightGrey</Color>
@ -549,10 +558,10 @@
</Style> </Style>
</Textbox> </Textbox>
</ReportItems> </ReportItems>
<Height>2in</Height> <Height>5.72875cm</Height>
<Style /> <Style />
</Body> </Body>
<Width>8.26772in</Width> <Width>21cm</Width>
<Page> <Page>
<PageHeight>29.7cm</PageHeight> <PageHeight>29.7cm</PageHeight>
<PageWidth>21cm</PageWidth> <PageWidth>21cm</PageWidth>
@ -574,7 +583,7 @@
</ReportParameters> </ReportParameters>
<ReportParametersLayout> <ReportParametersLayout>
<GridLayoutDefinition> <GridLayoutDefinition>
<NumberOfColumns>4</NumberOfColumns> <NumberOfColumns>5</NumberOfColumns>
<NumberOfRows>2</NumberOfRows> <NumberOfRows>2</NumberOfRows>
<CellDefinitions> <CellDefinitions>
<CellDefinition> <CellDefinition>
@ -586,5 +595,5 @@
</GridLayoutDefinition> </GridLayoutDefinition>
</ReportParametersLayout> </ReportParametersLayout>
<rd:ReportUnitType>Cm</rd:ReportUnitType> <rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>4d09d569-730a-46f4-8266-77bb279f2dec</rd:ReportID> <rd:ReportID>1c0c12af-b9e8-41db-8d1f-26d1acbf91cc</rd:ReportID>
</Report> </Report>