Some changes
This commit is contained in:
parent
fa66a3def9
commit
6a9f1d014c
215
BookShop/BookShopView/FormBooks.Designer.cs
generated
215
BookShop/BookShopView/FormBooks.Designer.cs
generated
@ -1,116 +1,115 @@
|
|||||||
namespace BookShopView
|
namespace BookShopView
|
||||||
{
|
{
|
||||||
partial class FormBooks
|
partial class FormBooks
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clean up any resources being used.
|
/// Clean up any resources being used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required method for Designer support - do not modify
|
/// Required method for Designer support - do not modify
|
||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
dataGridView = new DataGridView();
|
||||||
this.ButtonDelete = new System.Windows.Forms.Button();
|
ButtonDelete = new Button();
|
||||||
this.ButtonUpdate = new System.Windows.Forms.Button();
|
ButtonUpdate = new Button();
|
||||||
this.buttonAdd = new System.Windows.Forms.Button();
|
buttonAdd = new Button();
|
||||||
this.buttonUpd = new System.Windows.Forms.Button();
|
buttonUpd = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Control;
|
dataGridView.BackgroundColor = SystemColors.Control;
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
dataGridView.Location = new Point(12, 12);
|
||||||
this.dataGridView.Name = "dataGridView";
|
dataGridView.Name = "dataGridView";
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(461, 345);
|
dataGridView.Size = new Size(461, 402);
|
||||||
this.dataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// ButtonDelete
|
// ButtonDelete
|
||||||
//
|
//
|
||||||
this.ButtonDelete.Location = new System.Drawing.Point(493, 183);
|
ButtonDelete.Location = new Point(493, 183);
|
||||||
this.ButtonDelete.Name = "ButtonDelete";
|
ButtonDelete.Name = "ButtonDelete";
|
||||||
this.ButtonDelete.Size = new System.Drawing.Size(115, 54);
|
ButtonDelete.Size = new Size(115, 54);
|
||||||
this.ButtonDelete.TabIndex = 1;
|
ButtonDelete.TabIndex = 1;
|
||||||
this.ButtonDelete.Text = "Удалить";
|
ButtonDelete.Text = "Удалить";
|
||||||
this.ButtonDelete.UseVisualStyleBackColor = true;
|
ButtonDelete.UseVisualStyleBackColor = true;
|
||||||
this.ButtonDelete.Click += new System.EventHandler(this.ButtonDel_Click);
|
ButtonDelete.Click += ButtonDel_Click;
|
||||||
//
|
//
|
||||||
// ButtonUpdate
|
// ButtonUpdate
|
||||||
//
|
//
|
||||||
this.ButtonUpdate.Location = new System.Drawing.Point(493, 266);
|
ButtonUpdate.Location = new Point(493, 266);
|
||||||
this.ButtonUpdate.Name = "ButtonUpdate";
|
ButtonUpdate.Name = "ButtonUpdate";
|
||||||
this.ButtonUpdate.Size = new System.Drawing.Size(115, 58);
|
ButtonUpdate.Size = new Size(115, 58);
|
||||||
this.ButtonUpdate.TabIndex = 2;
|
ButtonUpdate.TabIndex = 2;
|
||||||
this.ButtonUpdate.Text = "Обновить";
|
ButtonUpdate.Text = "Обновить";
|
||||||
this.ButtonUpdate.UseVisualStyleBackColor = true;
|
ButtonUpdate.UseVisualStyleBackColor = true;
|
||||||
this.ButtonUpdate.Click += new System.EventHandler(this.ButtonRef_Click);
|
ButtonUpdate.Click += ButtonRef_Click;
|
||||||
//
|
//
|
||||||
// buttonAdd
|
// buttonAdd
|
||||||
//
|
//
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(493, 33);
|
buttonAdd.Location = new Point(493, 33);
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
buttonAdd.Name = "buttonAdd";
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(115, 52);
|
buttonAdd.Size = new Size(115, 52);
|
||||||
this.buttonAdd.TabIndex = 3;
|
buttonAdd.TabIndex = 3;
|
||||||
this.buttonAdd.Text = "Добавить";
|
buttonAdd.Text = "Добавить";
|
||||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
buttonAdd.UseVisualStyleBackColor = true;
|
||||||
this.buttonAdd.Click += new System.EventHandler(this.buttonAdd_Click);
|
buttonAdd.Click += buttonAdd_Click;
|
||||||
//
|
//
|
||||||
// buttonUpd
|
// buttonUpd
|
||||||
//
|
//
|
||||||
this.buttonUpd.Location = new System.Drawing.Point(493, 105);
|
buttonUpd.Location = new Point(493, 105);
|
||||||
this.buttonUpd.Name = "buttonUpd";
|
buttonUpd.Name = "buttonUpd";
|
||||||
this.buttonUpd.Size = new System.Drawing.Size(115, 52);
|
buttonUpd.Size = new Size(115, 52);
|
||||||
this.buttonUpd.TabIndex = 4;
|
buttonUpd.TabIndex = 4;
|
||||||
this.buttonUpd.Text = "Изменить";
|
buttonUpd.Text = "Изменить";
|
||||||
this.buttonUpd.UseVisualStyleBackColor = true;
|
buttonUpd.UseVisualStyleBackColor = true;
|
||||||
this.buttonUpd.Click += new System.EventHandler(this.ButtonUpd_Click);
|
buttonUpd.Click += ButtonUpd_Click;
|
||||||
//
|
//
|
||||||
// FormBooks
|
// FormBooks
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(620, 372);
|
ClientSize = new Size(620, 426);
|
||||||
this.Controls.Add(this.buttonUpd);
|
Controls.Add(buttonUpd);
|
||||||
this.Controls.Add(this.buttonAdd);
|
Controls.Add(buttonAdd);
|
||||||
this.Controls.Add(this.ButtonUpdate);
|
Controls.Add(ButtonUpdate);
|
||||||
this.Controls.Add(this.ButtonDelete);
|
Controls.Add(ButtonDelete);
|
||||||
this.Controls.Add(this.dataGridView);
|
Controls.Add(dataGridView);
|
||||||
this.Name = "FormBooks";
|
Name = "FormBooks";
|
||||||
this.Text = "Книги";
|
Text = "Книги";
|
||||||
this.Load += new System.EventHandler(this.FormBooks_Load);
|
Load += FormBooks_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
this.ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
#endregion
|
||||||
|
|
||||||
#endregion
|
private DataGridView dataGridView;
|
||||||
|
private Button ButtonDelete;
|
||||||
private DataGridView dataGridView;
|
private Button ButtonUpdate;
|
||||||
private Button ButtonDelete;
|
private Button buttonAdd;
|
||||||
private Button ButtonUpdate;
|
private Button buttonUpd;
|
||||||
private Button buttonAdd;
|
}
|
||||||
private Button buttonUpd;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -13,108 +13,108 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace BookShopView
|
namespace BookShopView
|
||||||
{
|
{
|
||||||
public partial class FormBooks : Form
|
public partial class FormBooks : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IBookLogic _logic;
|
private readonly IBookLogic _logic;
|
||||||
public FormBooks(ILogger<FormBooks> logger, IBookLogic logic)
|
public FormBooks(ILogger<FormBooks> logger, IBookLogic logic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_logic = logic;
|
_logic = logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormBooks_Load(object sender, EventArgs e)
|
private void FormBooks_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
var list = _logic.ReadList(null);
|
||||||
if (list != null)
|
if (list != null)
|
||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
dataGridView.Columns["BookName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["BookName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["Cost"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["Cost"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["Count"].Visible = false;
|
dataGridView.Columns["Count"].Visible = false;
|
||||||
dataGridView.Columns["GenreId"].Visible = false;
|
dataGridView.Columns["GenreId"].Visible = false;
|
||||||
dataGridView.Columns["GenreName"].Visible = false;
|
dataGridView.Columns["GenreName"].Visible = false;
|
||||||
dataGridView.Columns["BookAuthors"].Visible = false;
|
dataGridView.Columns["BookAuthors"].Visible = false;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка книг");
|
_logger.LogInformation("Загрузка книг");
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки книг");
|
_logger.LogError(ex, "Ошибка загрузки книг");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormBook));
|
var service = Program.ServiceProvider?.GetService(typeof(FormBook));
|
||||||
if (service is FormBook form)
|
if (service is FormBook form)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonDel_Click(object sender, EventArgs e)
|
private void ButtonDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
if (MessageBox.Show("Удалить запись?", "Вопрос", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation("Удаление изделия");
|
_logger.LogInformation("Удаление изделия");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!_logic.Delete(new BookBindingModel
|
if (!_logic.Delete(new BookBindingModel
|
||||||
{
|
{
|
||||||
Id = id
|
Id = id
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||||
}
|
}
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка удаления изделия");
|
_logger.LogError(ex, "Ошибка удаления изделия");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
private void ButtonRef_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service =
|
var service =
|
||||||
Program.ServiceProvider?.GetService(typeof(FormBook));
|
Program.ServiceProvider?.GetService(typeof(FormBook));
|
||||||
if (service is FormBook form)
|
if (service is FormBook form)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
359
BookShop/BookShopView/FormMain.Designer.cs
generated
359
BookShop/BookShopView/FormMain.Designer.cs
generated
@ -1,191 +1,184 @@
|
|||||||
namespace BookShopView
|
namespace BookShopView
|
||||||
{
|
{
|
||||||
partial class FormMain
|
partial class FormMain
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clean up any resources being used.
|
/// Clean up any resources being used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required method for Designer support - do not modify
|
/// Required method for Designer support - do not modify
|
||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
menuStrip1 = new MenuStrip();
|
||||||
this.справочникиToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
справочникиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.AuthorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
AuthorsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.BooksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
BooksToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.ClientsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
ClientsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.GenresToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
GenresToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.ComponentsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
ComponentsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.ComponentGiftsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
ComponentGiftsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.OrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
OrdersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.dataGridView = new System.Windows.Forms.DataGridView();
|
dataGridView = new DataGridView();
|
||||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
buttonCreateOrder = new Button();
|
||||||
this.buttonRef = new System.Windows.Forms.Button();
|
buttonRef = new Button();
|
||||||
this.testsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
тестыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
this.SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// menuStrip1
|
// menuStrip1
|
||||||
//
|
//
|
||||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
menuStrip1.Items.AddRange(new ToolStripItem[] { справочникиToolStripMenuItem, тестыToolStripMenuItem });
|
||||||
this.справочникиToolStripMenuItem});
|
menuStrip1.Location = new Point(0, 0);
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
menuStrip1.Size = new Size(1367, 28);
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1367, 28);
|
menuStrip1.TabIndex = 0;
|
||||||
this.menuStrip1.TabIndex = 0;
|
menuStrip1.Text = "menuStrip1";
|
||||||
this.menuStrip1.Text = "menuStrip1";
|
//
|
||||||
//
|
// справочникиToolStripMenuItem
|
||||||
// справочникиToolStripMenuItem
|
//
|
||||||
//
|
справочникиToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { AuthorsToolStripMenuItem, BooksToolStripMenuItem, ClientsToolStripMenuItem, GenresToolStripMenuItem });
|
||||||
this.справочникиToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
||||||
this.AuthorsToolStripMenuItem,
|
справочникиToolStripMenuItem.Size = new Size(117, 24);
|
||||||
this.BooksToolStripMenuItem,
|
справочникиToolStripMenuItem.Text = "Справочники";
|
||||||
this.ClientsToolStripMenuItem,
|
//
|
||||||
this.GenresToolStripMenuItem,
|
// AuthorsToolStripMenuItem
|
||||||
this.testsToolStripMenuItem});
|
//
|
||||||
this.справочникиToolStripMenuItem.Name = "справочникиToolStripMenuItem";
|
AuthorsToolStripMenuItem.Name = "AuthorsToolStripMenuItem";
|
||||||
this.справочникиToolStripMenuItem.Size = new System.Drawing.Size(117, 24);
|
AuthorsToolStripMenuItem.Size = new Size(224, 26);
|
||||||
this.справочникиToolStripMenuItem.Text = "Справочники";
|
AuthorsToolStripMenuItem.Text = "Авторы";
|
||||||
//
|
AuthorsToolStripMenuItem.Click += AuthorsToolStripMenuItem_Click;
|
||||||
// AuthorsToolStripMenuItem
|
//
|
||||||
//
|
// BooksToolStripMenuItem
|
||||||
this.AuthorsToolStripMenuItem.Name = "AuthorsToolStripMenuItem";
|
//
|
||||||
this.AuthorsToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
BooksToolStripMenuItem.Name = "BooksToolStripMenuItem";
|
||||||
this.AuthorsToolStripMenuItem.Text = "Авторы";
|
BooksToolStripMenuItem.Size = new Size(224, 26);
|
||||||
this.AuthorsToolStripMenuItem.Click += new System.EventHandler(this.AuthorsToolStripMenuItem_Click);
|
BooksToolStripMenuItem.Text = "Книги";
|
||||||
//
|
BooksToolStripMenuItem.Click += BooksToolStripMenuItem_Click;
|
||||||
// BooksToolStripMenuItem
|
//
|
||||||
//
|
// ClientsToolStripMenuItem
|
||||||
this.BooksToolStripMenuItem.Name = "BooksToolStripMenuItem";
|
//
|
||||||
this.BooksToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
||||||
this.BooksToolStripMenuItem.Text = "Книги";
|
ClientsToolStripMenuItem.Size = new Size(224, 26);
|
||||||
this.BooksToolStripMenuItem.Click += new System.EventHandler(this.BooksToolStripMenuItem_Click);
|
ClientsToolStripMenuItem.Text = "Клиенты";
|
||||||
//
|
ClientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
|
||||||
// ClientsToolStripMenuItem
|
//
|
||||||
//
|
// GenresToolStripMenuItem
|
||||||
this.ClientsToolStripMenuItem.Name = "ClientsToolStripMenuItem";
|
//
|
||||||
this.ClientsToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
GenresToolStripMenuItem.Name = "GenresToolStripMenuItem";
|
||||||
this.ClientsToolStripMenuItem.Text = "Клиенты";
|
GenresToolStripMenuItem.Size = new Size(224, 26);
|
||||||
this.ClientsToolStripMenuItem.Click += new System.EventHandler(this.ClientsToolStripMenuItem_Click);
|
GenresToolStripMenuItem.Text = "Жанры";
|
||||||
//
|
GenresToolStripMenuItem.Click += GenresToolStripMenuItem_Click;
|
||||||
// GenresToolStripMenuItem
|
//
|
||||||
//
|
// ComponentsToolStripMenuItem
|
||||||
this.GenresToolStripMenuItem.Name = "GenresToolStripMenuItem";
|
//
|
||||||
this.GenresToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
ComponentsToolStripMenuItem.Name = "ComponentsToolStripMenuItem";
|
||||||
this.GenresToolStripMenuItem.Text = "Жанры";
|
ComponentsToolStripMenuItem.Size = new Size(276, 26);
|
||||||
this.GenresToolStripMenuItem.Click += new System.EventHandler(this.GenresToolStripMenuItem_Click);
|
ComponentsToolStripMenuItem.Text = "Список компонентов";
|
||||||
//
|
//
|
||||||
// ComponentsToolStripMenuItem
|
// ComponentGiftsToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.ComponentsToolStripMenuItem.Name = "ComponentsToolStripMenuItem";
|
ComponentGiftsToolStripMenuItem.Name = "ComponentGiftsToolStripMenuItem";
|
||||||
this.ComponentsToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
|
ComponentGiftsToolStripMenuItem.Size = new Size(276, 26);
|
||||||
this.ComponentsToolStripMenuItem.Text = "Список компонентов";
|
ComponentGiftsToolStripMenuItem.Text = "Компоненты по изделиям";
|
||||||
//
|
//
|
||||||
// ComponentGiftsToolStripMenuItem
|
// OrdersToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.ComponentGiftsToolStripMenuItem.Name = "ComponentGiftsToolStripMenuItem";
|
OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
|
||||||
this.ComponentGiftsToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
|
OrdersToolStripMenuItem.Size = new Size(276, 26);
|
||||||
this.ComponentGiftsToolStripMenuItem.Text = "Компоненты по изделиям";
|
OrdersToolStripMenuItem.Text = "Список заказов";
|
||||||
//
|
//
|
||||||
// OrdersToolStripMenuItem
|
// dataGridView
|
||||||
//
|
//
|
||||||
this.OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
|
dataGridView.BackgroundColor = SystemColors.Control;
|
||||||
this.OrdersToolStripMenuItem.Size = new System.Drawing.Size(276, 26);
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
this.OrdersToolStripMenuItem.Text = "Список заказов";
|
dataGridView.Location = new Point(12, 41);
|
||||||
//
|
dataGridView.Name = "dataGridView";
|
||||||
// dataGridView
|
dataGridView.RowHeadersWidth = 51;
|
||||||
//
|
dataGridView.RowTemplate.Height = 29;
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.SystemColors.Control;
|
dataGridView.Size = new Size(1123, 423);
|
||||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.TabIndex = 1;
|
||||||
this.dataGridView.Location = new System.Drawing.Point(12, 41);
|
//
|
||||||
this.dataGridView.Name = "dataGridView";
|
// buttonCreateOrder
|
||||||
this.dataGridView.RowHeadersWidth = 51;
|
//
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
buttonCreateOrder.Location = new Point(1155, 167);
|
||||||
this.dataGridView.Size = new System.Drawing.Size(1123, 423);
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
this.dataGridView.TabIndex = 1;
|
buttonCreateOrder.Size = new Size(189, 78);
|
||||||
//
|
buttonCreateOrder.TabIndex = 2;
|
||||||
// buttonCreateOrder
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
//
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
this.buttonCreateOrder.Location = new System.Drawing.Point(1155, 167);
|
buttonCreateOrder.Click += buttonCreateOrder_Click;
|
||||||
this.buttonCreateOrder.Name = "buttonCreateOrder";
|
//
|
||||||
this.buttonCreateOrder.Size = new System.Drawing.Size(189, 78);
|
// buttonRef
|
||||||
this.buttonCreateOrder.TabIndex = 2;
|
//
|
||||||
this.buttonCreateOrder.Text = "Создать заказ";
|
buttonRef.Location = new Point(1155, 304);
|
||||||
this.buttonCreateOrder.UseVisualStyleBackColor = true;
|
buttonRef.Name = "buttonRef";
|
||||||
this.buttonCreateOrder.Click += new System.EventHandler(this.buttonCreateOrder_Click);
|
buttonRef.Size = new Size(189, 78);
|
||||||
//
|
buttonRef.TabIndex = 6;
|
||||||
// buttonRef
|
buttonRef.Text = "Обновить список";
|
||||||
//
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
this.buttonRef.Location = new System.Drawing.Point(1155, 304);
|
//
|
||||||
this.buttonRef.Name = "buttonRef";
|
// тестыToolStripMenuItem
|
||||||
this.buttonRef.Size = new System.Drawing.Size(189, 78);
|
//
|
||||||
this.buttonRef.TabIndex = 6;
|
тестыToolStripMenuItem.Name = "тестыToolStripMenuItem";
|
||||||
this.buttonRef.Text = "Обновить список";
|
тестыToolStripMenuItem.Size = new Size(63, 24);
|
||||||
this.buttonRef.UseVisualStyleBackColor = true;
|
тестыToolStripMenuItem.Text = "Тесты";
|
||||||
//
|
тестыToolStripMenuItem.Click += testsToolStripMenuItem_Click;
|
||||||
// testsToolStripMenuItem
|
//
|
||||||
//
|
// FormMain
|
||||||
this.testsToolStripMenuItem.Name = "testsToolStripMenuItem";
|
//
|
||||||
this.testsToolStripMenuItem.Size = new System.Drawing.Size(224, 26);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
this.testsToolStripMenuItem.Text = "Тесты";
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.testsToolStripMenuItem.Click += new System.EventHandler(this.testsToolStripMenuItem_Click);
|
ClientSize = new Size(1367, 471);
|
||||||
//
|
Controls.Add(buttonRef);
|
||||||
// FormMain
|
Controls.Add(buttonCreateOrder);
|
||||||
//
|
Controls.Add(dataGridView);
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
Controls.Add(menuStrip1);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
MainMenuStrip = menuStrip1;
|
||||||
this.ClientSize = new System.Drawing.Size(1367, 471);
|
Name = "FormMain";
|
||||||
this.Controls.Add(this.buttonRef);
|
Text = "Книжный магазин";
|
||||||
this.Controls.Add(this.buttonCreateOrder);
|
Load += FormMain_Load;
|
||||||
this.Controls.Add(this.dataGridView);
|
menuStrip1.ResumeLayout(false);
|
||||||
this.Controls.Add(this.menuStrip1);
|
menuStrip1.PerformLayout();
|
||||||
this.MainMenuStrip = this.menuStrip1;
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
this.Name = "FormMain";
|
ResumeLayout(false);
|
||||||
this.Text = "Книжный магазин";
|
PerformLayout();
|
||||||
this.Load += new System.EventHandler(this.FormMain_Load);
|
}
|
||||||
this.menuStrip1.ResumeLayout(false);
|
|
||||||
this.menuStrip1.PerformLayout();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
#endregion
|
||||||
|
|
||||||
#endregion
|
private MenuStrip menuStrip1;
|
||||||
|
private ToolStripMenuItem справочникиToolStripMenuItem;
|
||||||
private MenuStrip menuStrip1;
|
private ToolStripMenuItem AuthorsToolStripMenuItem;
|
||||||
private ToolStripMenuItem справочникиToolStripMenuItem;
|
private ToolStripMenuItem BooksToolStripMenuItem;
|
||||||
private ToolStripMenuItem AuthorsToolStripMenuItem;
|
private DataGridView dataGridView;
|
||||||
private ToolStripMenuItem BooksToolStripMenuItem;
|
private Button buttonCreateOrder;
|
||||||
private DataGridView dataGridView;
|
private Button buttonRef;
|
||||||
private Button buttonCreateOrder;
|
private ToolStripMenuItem ComponentsToolStripMenuItem;
|
||||||
private Button buttonRef;
|
private ToolStripMenuItem ComponentGiftsToolStripMenuItem;
|
||||||
private ToolStripMenuItem ComponentsToolStripMenuItem;
|
private ToolStripMenuItem OrdersToolStripMenuItem;
|
||||||
private ToolStripMenuItem ComponentGiftsToolStripMenuItem;
|
private ToolStripMenuItem ClientsToolStripMenuItem;
|
||||||
private ToolStripMenuItem OrdersToolStripMenuItem;
|
private ToolStripMenuItem GenresToolStripMenuItem;
|
||||||
private ToolStripMenuItem ClientsToolStripMenuItem;
|
private ToolStripMenuItem тестыToolStripMenuItem;
|
||||||
private ToolStripMenuItem GenresToolStripMenuItem;
|
}
|
||||||
private ToolStripMenuItem testsToolStripMenuItem;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -12,100 +12,100 @@ using System.Windows.Forms;
|
|||||||
|
|
||||||
namespace BookShopView
|
namespace BookShopView
|
||||||
{
|
{
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
}
|
}
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _orderLogic.ReadList(null);
|
var list = _orderLogic.ReadList(null);
|
||||||
if (list != null)
|
if (list != null)
|
||||||
{
|
{
|
||||||
dataGridView.DataSource = list;
|
dataGridView.DataSource = list;
|
||||||
dataGridView.Columns["BookId"].Visible = false;
|
dataGridView.Columns["BookId"].Visible = false;
|
||||||
dataGridView.Columns["BookName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["BookName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
dataGridView.Columns["ClientSurname"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["ClientSurname"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["Count"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["Count"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["Sum"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["Sum"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
dataGridView.Columns["DateCreate"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
dataGridView.Columns["DateCreate"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки заказов");
|
_logger.LogError(ex, "Ошибка загрузки заказов");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AuthorsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void AuthorsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormAuthors));
|
var service = Program.ServiceProvider?.GetService(typeof(FormAuthors));
|
||||||
if (service is FormAuthors form)
|
if (service is FormAuthors form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void GenresToolStripMenuItem_Click(object sender, EventArgs e)
|
private void GenresToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormGenres));
|
var service = Program.ServiceProvider?.GetService(typeof(FormGenres));
|
||||||
|
|
||||||
if (service is FormGenres form)
|
if (service is FormGenres form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void BooksToolStripMenuItem_Click(object sender, EventArgs e)
|
private void BooksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormBooks));
|
var service = Program.ServiceProvider?.GetService(typeof(FormBooks));
|
||||||
|
|
||||||
if (service is FormBooks form)
|
if (service is FormBooks form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ClientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||||
|
|
||||||
if (service is FormClients form)
|
if (service is FormClients form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormСreateOrder));
|
var service = Program.ServiceProvider?.GetService(typeof(FormСreateOrder));
|
||||||
if (service is FormСreateOrder form)
|
if (service is FormСreateOrder form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
LoadData();
|
LoadData();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void testsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void testsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormTests));
|
var service = Program.ServiceProvider?.GetService(typeof(FormTests));
|
||||||
|
|
||||||
if (service is FormTests form)
|
if (service is FormTests form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
402
BookShop/BookShopView/FormTests.Designer.cs
generated
402
BookShop/BookShopView/FormTests.Designer.cs
generated
@ -1,238 +1,180 @@
|
|||||||
namespace BookShopView
|
namespace BookShopView
|
||||||
{
|
{
|
||||||
partial class FormTests
|
partial class FormTests
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required designer variable.
|
/// Required designer variable.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private System.ComponentModel.IContainer components = null;
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Clean up any resources being used.
|
/// Clean up any resources being used.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
if (disposing && (components != null))
|
if (disposing && (components != null))
|
||||||
{
|
{
|
||||||
components.Dispose();
|
components.Dispose();
|
||||||
}
|
}
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required method for Designer support - do not modify
|
/// Required method for Designer support - do not modify
|
||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.buttonInsertTest = new System.Windows.Forms.Button();
|
buttonInsertTest = new Button();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
label1 = new Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
label2 = new Label();
|
||||||
this.textBoxInsertTime = new System.Windows.Forms.TextBox();
|
textBoxInsertTime = new TextBox();
|
||||||
this.buttonReadTest = new System.Windows.Forms.Button();
|
buttonReadTest = new Button();
|
||||||
this.textBoxReadTime = new System.Windows.Forms.TextBox();
|
textBoxReadTime = new TextBox();
|
||||||
this.label3 = new System.Windows.Forms.Label();
|
label3 = new Label();
|
||||||
this.label4 = new System.Windows.Forms.Label();
|
label4 = new Label();
|
||||||
this.numericUpDownInsert = new System.Windows.Forms.NumericUpDown();
|
numericUpDownInsert = new NumericUpDown();
|
||||||
this.numericUpDownRead = new System.Windows.Forms.NumericUpDown();
|
numericUpDownRead = new NumericUpDown();
|
||||||
this.buttonJoinQuery = new System.Windows.Forms.Button();
|
((System.ComponentModel.ISupportInitialize)numericUpDownInsert).BeginInit();
|
||||||
this.numericUpDownJoin = new System.Windows.Forms.NumericUpDown();
|
((System.ComponentModel.ISupportInitialize)numericUpDownRead).BeginInit();
|
||||||
this.textBoxJoin = new System.Windows.Forms.TextBox();
|
SuspendLayout();
|
||||||
this.label5 = new System.Windows.Forms.Label();
|
//
|
||||||
this.label6 = new System.Windows.Forms.Label();
|
// buttonInsertTest
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownInsert)).BeginInit();
|
//
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownRead)).BeginInit();
|
buttonInsertTest.Location = new Point(6, 31);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownJoin)).BeginInit();
|
buttonInsertTest.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.SuspendLayout();
|
buttonInsertTest.Name = "buttonInsertTest";
|
||||||
//
|
buttonInsertTest.Size = new Size(170, 45);
|
||||||
// buttonInsertTest
|
buttonInsertTest.TabIndex = 0;
|
||||||
//
|
buttonInsertTest.Text = "Вставка данных";
|
||||||
this.buttonInsertTest.Location = new System.Drawing.Point(14, 16);
|
buttonInsertTest.UseVisualStyleBackColor = true;
|
||||||
this.buttonInsertTest.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
buttonInsertTest.Click += buttonInsertTest_Click;
|
||||||
this.buttonInsertTest.Name = "buttonInsertTest";
|
//
|
||||||
this.buttonInsertTest.Size = new System.Drawing.Size(98, 81);
|
// label1
|
||||||
this.buttonInsertTest.TabIndex = 0;
|
//
|
||||||
this.buttonInsertTest.Text = "Тест вставки сообщений";
|
label1.AutoSize = true;
|
||||||
this.buttonInsertTest.UseVisualStyleBackColor = true;
|
label1.Location = new Point(190, 18);
|
||||||
this.buttonInsertTest.Click += new System.EventHandler(this.buttonInsertTest_Click);
|
label1.Name = "label1";
|
||||||
//
|
label1.Size = new Size(171, 20);
|
||||||
// label1
|
label1.TabIndex = 1;
|
||||||
//
|
label1.Text = "Количество элементов:";
|
||||||
this.label1.AutoSize = true;
|
//
|
||||||
this.label1.Location = new System.Drawing.Point(119, 16);
|
// label2
|
||||||
this.label1.Name = "label1";
|
//
|
||||||
this.label1.Size = new System.Drawing.Size(197, 20);
|
label2.AutoSize = true;
|
||||||
this.label1.TabIndex = 1;
|
label2.Location = new Point(190, 68);
|
||||||
this.label1.Text = "Введите кол-во элементов:";
|
label2.Name = "label2";
|
||||||
//
|
label2.Size = new Size(57, 20);
|
||||||
// label2
|
label2.TabIndex = 3;
|
||||||
//
|
label2.Text = "Время:";
|
||||||
this.label2.AutoSize = true;
|
//
|
||||||
this.label2.Location = new System.Drawing.Point(119, 71);
|
// textBoxInsertTime
|
||||||
this.label2.Name = "label2";
|
//
|
||||||
this.label2.Size = new System.Drawing.Size(187, 20);
|
textBoxInsertTime.Location = new Point(427, 68);
|
||||||
this.label2.TabIndex = 3;
|
textBoxInsertTime.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.label2.Text = "Итоговое время запроса:";
|
textBoxInsertTime.Name = "textBoxInsertTime";
|
||||||
//
|
textBoxInsertTime.ReadOnly = true;
|
||||||
// textBoxInsertTime
|
textBoxInsertTime.Size = new Size(114, 27);
|
||||||
//
|
textBoxInsertTime.TabIndex = 4;
|
||||||
this.textBoxInsertTime.Location = new System.Drawing.Point(334, 68);
|
//
|
||||||
this.textBoxInsertTime.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
// buttonReadTest
|
||||||
this.textBoxInsertTime.Name = "textBoxInsertTime";
|
//
|
||||||
this.textBoxInsertTime.ReadOnly = true;
|
buttonReadTest.Location = new Point(6, 152);
|
||||||
this.textBoxInsertTime.Size = new System.Drawing.Size(114, 27);
|
buttonReadTest.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.textBoxInsertTime.TabIndex = 4;
|
buttonReadTest.Name = "buttonReadTest";
|
||||||
//
|
buttonReadTest.Size = new Size(170, 49);
|
||||||
// buttonReadTest
|
buttonReadTest.TabIndex = 5;
|
||||||
//
|
buttonReadTest.Text = "Чтение данных";
|
||||||
this.buttonReadTest.Location = new System.Drawing.Point(14, 141);
|
buttonReadTest.UseVisualStyleBackColor = true;
|
||||||
this.buttonReadTest.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
buttonReadTest.Click += buttonReadTest_Click;
|
||||||
this.buttonReadTest.Name = "buttonReadTest";
|
//
|
||||||
this.buttonReadTest.Size = new System.Drawing.Size(98, 75);
|
// textBoxReadTime
|
||||||
this.buttonReadTest.TabIndex = 5;
|
//
|
||||||
this.buttonReadTest.Text = "Тест чтения сообщений";
|
textBoxReadTime.Location = new Point(427, 189);
|
||||||
this.buttonReadTest.UseVisualStyleBackColor = true;
|
textBoxReadTime.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.buttonReadTest.Click += new System.EventHandler(this.buttonReadTest_Click);
|
textBoxReadTime.Name = "textBoxReadTime";
|
||||||
//
|
textBoxReadTime.ReadOnly = true;
|
||||||
// textBoxReadTime
|
textBoxReadTime.Size = new Size(114, 27);
|
||||||
//
|
textBoxReadTime.TabIndex = 9;
|
||||||
this.textBoxReadTime.Location = new System.Drawing.Point(334, 193);
|
//
|
||||||
this.textBoxReadTime.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
// label3
|
||||||
this.textBoxReadTime.Name = "textBoxReadTime";
|
//
|
||||||
this.textBoxReadTime.ReadOnly = true;
|
label3.AutoSize = true;
|
||||||
this.textBoxReadTime.Size = new System.Drawing.Size(114, 27);
|
label3.Location = new Point(190, 192);
|
||||||
this.textBoxReadTime.TabIndex = 9;
|
label3.Name = "label3";
|
||||||
//
|
label3.Size = new Size(57, 20);
|
||||||
// label3
|
label3.TabIndex = 8;
|
||||||
//
|
label3.Text = "Время:";
|
||||||
this.label3.AutoSize = true;
|
//
|
||||||
this.label3.Location = new System.Drawing.Point(119, 196);
|
// label4
|
||||||
this.label3.Name = "label3";
|
//
|
||||||
this.label3.Size = new System.Drawing.Size(187, 20);
|
label4.AutoSize = true;
|
||||||
this.label3.TabIndex = 8;
|
label4.Location = new Point(190, 136);
|
||||||
this.label3.Text = "Итоговое время запроса:";
|
label4.Name = "label4";
|
||||||
//
|
label4.Size = new Size(171, 20);
|
||||||
// label4
|
label4.TabIndex = 6;
|
||||||
//
|
label4.Text = "Количество элементов:";
|
||||||
this.label4.AutoSize = true;
|
//
|
||||||
this.label4.Location = new System.Drawing.Point(119, 141);
|
// numericUpDownInsert
|
||||||
this.label4.Name = "label4";
|
//
|
||||||
this.label4.Size = new System.Drawing.Size(197, 20);
|
numericUpDownInsert.Location = new Point(427, 16);
|
||||||
this.label4.TabIndex = 6;
|
numericUpDownInsert.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.label4.Text = "Введите кол-во элементов:";
|
numericUpDownInsert.Name = "numericUpDownInsert";
|
||||||
//
|
numericUpDownInsert.Size = new Size(114, 27);
|
||||||
// numericUpDownInsert
|
numericUpDownInsert.TabIndex = 10;
|
||||||
//
|
//
|
||||||
this.numericUpDownInsert.Location = new System.Drawing.Point(334, 16);
|
// numericUpDownRead
|
||||||
this.numericUpDownInsert.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
//
|
||||||
this.numericUpDownInsert.Name = "numericUpDownInsert";
|
numericUpDownRead.Location = new Point(427, 134);
|
||||||
this.numericUpDownInsert.Size = new System.Drawing.Size(114, 27);
|
numericUpDownRead.Margin = new Padding(3, 4, 3, 4);
|
||||||
this.numericUpDownInsert.TabIndex = 10;
|
numericUpDownRead.Name = "numericUpDownRead";
|
||||||
//
|
numericUpDownRead.Size = new Size(114, 27);
|
||||||
// numericUpDownRead
|
numericUpDownRead.TabIndex = 11;
|
||||||
//
|
//
|
||||||
this.numericUpDownRead.Location = new System.Drawing.Point(334, 139);
|
// FormTests
|
||||||
this.numericUpDownRead.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
//
|
||||||
this.numericUpDownRead.Name = "numericUpDownRead";
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
this.numericUpDownRead.Size = new System.Drawing.Size(114, 27);
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
this.numericUpDownRead.TabIndex = 11;
|
ClientSize = new Size(553, 246);
|
||||||
//
|
Controls.Add(numericUpDownRead);
|
||||||
// buttonJoinQuery
|
Controls.Add(numericUpDownInsert);
|
||||||
//
|
Controls.Add(textBoxReadTime);
|
||||||
this.buttonJoinQuery.Location = new System.Drawing.Point(14, 263);
|
Controls.Add(label3);
|
||||||
this.buttonJoinQuery.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
Controls.Add(label4);
|
||||||
this.buttonJoinQuery.Name = "buttonJoinQuery";
|
Controls.Add(buttonReadTest);
|
||||||
this.buttonJoinQuery.Size = new System.Drawing.Size(98, 99);
|
Controls.Add(textBoxInsertTime);
|
||||||
this.buttonJoinQuery.TabIndex = 12;
|
Controls.Add(label2);
|
||||||
this.buttonJoinQuery.Text = "Тест сложного чтения (Join)";
|
Controls.Add(label1);
|
||||||
this.buttonJoinQuery.UseVisualStyleBackColor = true;
|
Controls.Add(buttonInsertTest);
|
||||||
this.buttonJoinQuery.Click += new System.EventHandler(this.buttonJoinQuery_Click);
|
Margin = new Padding(3, 4, 3, 4);
|
||||||
//
|
Name = "FormTests";
|
||||||
// numericUpDownJoin
|
Text = "Тесты запросов к бд";
|
||||||
//
|
Load += FormTests_Load;
|
||||||
this.numericUpDownJoin.Location = new System.Drawing.Point(334, 256);
|
((System.ComponentModel.ISupportInitialize)numericUpDownInsert).EndInit();
|
||||||
this.numericUpDownJoin.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
((System.ComponentModel.ISupportInitialize)numericUpDownRead).EndInit();
|
||||||
this.numericUpDownJoin.Name = "numericUpDownJoin";
|
ResumeLayout(false);
|
||||||
this.numericUpDownJoin.Size = new System.Drawing.Size(114, 27);
|
PerformLayout();
|
||||||
this.numericUpDownJoin.TabIndex = 16;
|
}
|
||||||
//
|
|
||||||
// textBoxJoin
|
|
||||||
//
|
|
||||||
this.textBoxJoin.Location = new System.Drawing.Point(334, 314);
|
|
||||||
this.textBoxJoin.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
|
||||||
this.textBoxJoin.Name = "textBoxJoin";
|
|
||||||
this.textBoxJoin.ReadOnly = true;
|
|
||||||
this.textBoxJoin.Size = new System.Drawing.Size(114, 27);
|
|
||||||
this.textBoxJoin.TabIndex = 15;
|
|
||||||
//
|
|
||||||
// label5
|
|
||||||
//
|
|
||||||
this.label5.AutoSize = true;
|
|
||||||
this.label5.Location = new System.Drawing.Point(119, 317);
|
|
||||||
this.label5.Name = "label5";
|
|
||||||
this.label5.Size = new System.Drawing.Size(187, 20);
|
|
||||||
this.label5.TabIndex = 14;
|
|
||||||
this.label5.Text = "Итоговое время запроса:";
|
|
||||||
//
|
|
||||||
// label6
|
|
||||||
//
|
|
||||||
this.label6.AutoSize = true;
|
|
||||||
this.label6.Location = new System.Drawing.Point(119, 263);
|
|
||||||
this.label6.Name = "label6";
|
|
||||||
this.label6.Size = new System.Drawing.Size(197, 20);
|
|
||||||
this.label6.TabIndex = 13;
|
|
||||||
this.label6.Text = "Введите кол-во элементов:";
|
|
||||||
//
|
|
||||||
// FormTests
|
|
||||||
//
|
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(553, 381);
|
|
||||||
this.Controls.Add(this.numericUpDownJoin);
|
|
||||||
this.Controls.Add(this.textBoxJoin);
|
|
||||||
this.Controls.Add(this.label5);
|
|
||||||
this.Controls.Add(this.label6);
|
|
||||||
this.Controls.Add(this.buttonJoinQuery);
|
|
||||||
this.Controls.Add(this.numericUpDownRead);
|
|
||||||
this.Controls.Add(this.numericUpDownInsert);
|
|
||||||
this.Controls.Add(this.textBoxReadTime);
|
|
||||||
this.Controls.Add(this.label3);
|
|
||||||
this.Controls.Add(this.label4);
|
|
||||||
this.Controls.Add(this.buttonReadTest);
|
|
||||||
this.Controls.Add(this.textBoxInsertTime);
|
|
||||||
this.Controls.Add(this.label2);
|
|
||||||
this.Controls.Add(this.label1);
|
|
||||||
this.Controls.Add(this.buttonInsertTest);
|
|
||||||
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
|
||||||
this.Name = "FormTests";
|
|
||||||
this.Text = "Тесты запросов к бд";
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownInsert)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownRead)).EndInit();
|
|
||||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownJoin)).EndInit();
|
|
||||||
this.ResumeLayout(false);
|
|
||||||
this.PerformLayout();
|
|
||||||
|
|
||||||
}
|
#endregion
|
||||||
|
|
||||||
#endregion
|
private Button buttonInsertTest;
|
||||||
|
private Label label1;
|
||||||
private Button buttonInsertTest;
|
private Label label2;
|
||||||
private Label label1;
|
private TextBox textBoxInsertTime;
|
||||||
private Label label2;
|
private Button buttonReadTest;
|
||||||
private TextBox textBoxInsertTime;
|
private TextBox textBoxReadTime;
|
||||||
private Button buttonReadTest;
|
private Label label3;
|
||||||
private TextBox textBoxReadTime;
|
private Label label4;
|
||||||
private Label label3;
|
private NumericUpDown numericUpDownInsert;
|
||||||
private Label label4;
|
private NumericUpDown numericUpDownRead;
|
||||||
private NumericUpDown numericUpDownInsert;
|
private Button buttonJoinQuery;
|
||||||
private NumericUpDown numericUpDownRead;
|
private NumericUpDown numericUpDownJoin;
|
||||||
private Button buttonJoinQuery;
|
private TextBox textBoxJoin;
|
||||||
private NumericUpDown numericUpDownJoin;
|
private Label label5;
|
||||||
private TextBox textBoxJoin;
|
private Label label6;
|
||||||
private Label label5;
|
}
|
||||||
private Label label6;
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -1,75 +1,50 @@
|
|||||||
using BookShopContracts.BusinessLogicsContracts;
|
using BookShopContracts.BusinessLogicsContracts;
|
||||||
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 BookShopView
|
namespace BookShopView
|
||||||
{
|
{
|
||||||
public partial class FormTests : Form
|
public partial class FormTests : Form
|
||||||
{
|
{
|
||||||
private readonly IBookLogic _bookLogic;
|
private readonly IBookLogic _bookLogic;
|
||||||
//private readonly IUserLogic _userLogic;
|
public FormTests(IBookLogic routeLogic)
|
||||||
//private readonly ITopicLogic _topicLogic;
|
{
|
||||||
public FormTests(IBookLogic routeLogic)//IUserLogic userLogic, ITopicLogic topicLogic, IMessageLogic messageLogic)
|
InitializeComponent();
|
||||||
{
|
_bookLogic = routeLogic;
|
||||||
InitializeComponent();
|
numericUpDownInsert.Minimum = 0;
|
||||||
//_userLogic = userLogic;
|
numericUpDownInsert.Maximum = 1000000;
|
||||||
//_topicLogic = topicLogic;
|
numericUpDownRead.Minimum = 0;
|
||||||
_bookLogic = routeLogic;
|
numericUpDownRead.Maximum = 1000000;
|
||||||
numericUpDownInsert.Minimum = 0;
|
}
|
||||||
numericUpDownInsert.Maximum = 1000000;
|
|
||||||
numericUpDownRead.Minimum = 0;
|
|
||||||
numericUpDownRead.Maximum = 1000000;
|
|
||||||
numericUpDownJoin.Minimum = 0;
|
|
||||||
numericUpDownJoin.Maximum = 1000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void buttonInsertTest_Click(object sender, EventArgs e)
|
private void buttonInsertTest_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//try
|
try
|
||||||
//{
|
{
|
||||||
// var result = _messageLogic.TestInsertList(Convert.ToInt32(numericUpDownInsert.Value),
|
var result = _bookLogic.TestInsertList(Convert.ToInt32(numericUpDownInsert.Value));
|
||||||
// _userLogic.ReadList(null) ?? new(),
|
|
||||||
// _topicLogic.ReadList(null) ?? new());
|
|
||||||
|
|
||||||
// textBoxInsertTime.Text = result;
|
textBoxInsertTime.Text = result;
|
||||||
//}
|
}
|
||||||
//catch (Exception ex)
|
catch (Exception ex)
|
||||||
//{
|
{
|
||||||
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonReadTest_Click(object sender, EventArgs e)
|
private void buttonReadTest_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = _bookLogic.TestReadList(Convert.ToInt32(numericUpDownRead.Value));
|
var result = _bookLogic.TestReadList(Convert.ToInt32(numericUpDownRead.Value));
|
||||||
textBoxReadTime.Text = result;
|
textBoxReadTime.Text = result;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonJoinQuery_Click(object sender, EventArgs e)
|
private void FormTests_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
//try
|
|
||||||
//{
|
}
|
||||||
// var result = _messageLogic.TestJoinReadList(Convert.ToInt32(numericUpDownJoin.Value));
|
}
|
||||||
// textBoxJoin.Text = result;
|
|
||||||
//}
|
|
||||||
//catch (Exception ex)
|
|
||||||
//{
|
|
||||||
// MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user