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