удаление ошибок
This commit is contained in:
parent
0da524dc71
commit
c29812b2ff
@ -13,7 +13,7 @@ public partial class FormBuyHorse : Form
|
||||
IHorseRepository horseRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_buyHorseRepository = buyHorseRepository ??
|
||||
_buyHorseRepository = buyHorseRepository ??
|
||||
throw new ArgumentNullException(nameof(buyHorseRepository));
|
||||
comboBoxOwner.DataSource = ownerRepository.ReadOwners();
|
||||
comboBoxOwner.DisplayMember = "LastName";
|
||||
@ -58,8 +58,8 @@ public partial class FormBuyHorse : Form
|
||||
}
|
||||
list.Add(BuyHorseHorse.CreateElement(
|
||||
0,
|
||||
Convert.ToInt32(row.Cells["ColumnHorse"].Value),1));
|
||||
Convert.ToInt32(row.Cells["ColumnHorse"].Value)));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,168 +0,0 @@
|
||||
namespace ProjectHorseRacing.Forms
|
||||
{
|
||||
partial class FormOwnerHorsesReport
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label4 = new Label();
|
||||
label3 = new Label();
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
buttonBuild = new Button();
|
||||
buttonFile = new Button();
|
||||
textBoxFilePath = new TextBox();
|
||||
comboBoxOwner = new ComboBox();
|
||||
dateTimePickerStart = new DateTimePicker();
|
||||
dateTimePickerEnd = new DateTimePicker();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(33, 193);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(90, 20);
|
||||
label4.TabIndex = 29;
|
||||
label4.Text = "Дата конца:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(33, 144);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(97, 20);
|
||||
label3.TabIndex = 28;
|
||||
label3.Text = "Дата начала:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(33, 88);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(78, 20);
|
||||
label2.TabIndex = 27;
|
||||
label2.Text = "Владелец:";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(33, 36);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(112, 20);
|
||||
label1.TabIndex = 26;
|
||||
label1.Text = "Путь до файла:";
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.Location = new Point(33, 246);
|
||||
buttonBuild.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(338, 31);
|
||||
buttonBuild.TabIndex = 25;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = true;
|
||||
buttonBuild.Click += buttonBuild_Click;
|
||||
//
|
||||
// buttonFile
|
||||
//
|
||||
buttonFile.Location = new Point(339, 32);
|
||||
buttonFile.Margin = new Padding(3, 4, 3, 4);
|
||||
buttonFile.Name = "buttonFile";
|
||||
buttonFile.Size = new Size(30, 31);
|
||||
buttonFile.TabIndex = 24;
|
||||
buttonFile.Text = "...";
|
||||
buttonFile.UseVisualStyleBackColor = true;
|
||||
buttonFile.Click += buttonFile_Click;
|
||||
//
|
||||
// textBoxFilePath
|
||||
//
|
||||
textBoxFilePath.Location = new Point(143, 32);
|
||||
textBoxFilePath.Margin = new Padding(3, 4, 3, 4);
|
||||
textBoxFilePath.Name = "textBoxFilePath";
|
||||
textBoxFilePath.Size = new Size(189, 27);
|
||||
textBoxFilePath.TabIndex = 23;
|
||||
//
|
||||
// comboBoxOwner
|
||||
//
|
||||
comboBoxOwner.FormattingEnabled = true;
|
||||
comboBoxOwner.Location = new Point(143, 84);
|
||||
comboBoxOwner.Margin = new Padding(3, 4, 3, 4);
|
||||
comboBoxOwner.Name = "comboBoxOwner";
|
||||
comboBoxOwner.Size = new Size(226, 28);
|
||||
comboBoxOwner.TabIndex = 22;
|
||||
//
|
||||
// dateTimePickerStart
|
||||
//
|
||||
dateTimePickerStart.Location = new Point(143, 137);
|
||||
dateTimePickerStart.Margin = new Padding(3, 4, 3, 4);
|
||||
dateTimePickerStart.Name = "dateTimePickerStart";
|
||||
dateTimePickerStart.Size = new Size(228, 27);
|
||||
dateTimePickerStart.TabIndex = 21;
|
||||
//
|
||||
// dateTimePickerEnd
|
||||
//
|
||||
dateTimePickerEnd.Location = new Point(143, 188);
|
||||
dateTimePickerEnd.Margin = new Padding(3, 4, 3, 4);
|
||||
dateTimePickerEnd.Name = "dateTimePickerEnd";
|
||||
dateTimePickerEnd.Size = new Size(228, 27);
|
||||
dateTimePickerEnd.TabIndex = 20;
|
||||
//
|
||||
// FormOwnerHorsesReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(413, 298);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(buttonFile);
|
||||
Controls.Add(textBoxFilePath);
|
||||
Controls.Add(comboBoxOwner);
|
||||
Controls.Add(dateTimePickerStart);
|
||||
Controls.Add(dateTimePickerEnd);
|
||||
Name = "FormOwnerHorsesReport";
|
||||
Text = "Отчет по покупке лошадей";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label label4;
|
||||
private Label label3;
|
||||
private Label label2;
|
||||
private Label label1;
|
||||
private Button buttonBuild;
|
||||
private Button buttonFile;
|
||||
private TextBox textBoxFilePath;
|
||||
private ComboBox comboBoxOwner;
|
||||
private DateTimePicker dateTimePickerStart;
|
||||
private DateTimePicker dateTimePickerEnd;
|
||||
}
|
||||
}
|
@ -1,80 +0,0 @@
|
||||
using ProjectHorseRacing.Reports;
|
||||
using ProjectHorseRacing.Repositories;
|
||||
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;
|
||||
using Unity;
|
||||
|
||||
namespace ProjectHorseRacing.Forms
|
||||
{
|
||||
public partial class FormOwnerHorsesReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormOwnerHorsesReport(IUnityContainer container, IOwnerRepository ownerRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
|
||||
comboBoxOwner.DataSource = ownerRepository.ReadOwners();
|
||||
comboBoxOwner.DisplayMember = "LastName";
|
||||
comboBoxOwner.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxFilePath.Text))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
if (comboBoxOwner.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Не выбран корм");
|
||||
}
|
||||
if (dateTimePickerEnd.Value <= dateTimePickerStart.Value)
|
||||
{
|
||||
throw new Exception("Дата начала должна быть раньше даты окончания");
|
||||
}
|
||||
if (_container.Resolve<TableReport>().CreateTable(textBoxFilePath.Text, 4, (int)comboBoxOwner.SelectedValue!, dateTimePickerStart.Value, dateTimePickerEnd.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании отчета",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Excel Files | *.xlsx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
textBoxFilePath.Text = sfd.FileName;
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,18 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.2" />
|
||||
<PackageReference Include="Serilog" Version="4.2.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Unity" Version="5.11.10" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
x
Reference in New Issue
Block a user