PIbd-22_Rogashova_E.A._SUBD/BookShopView/FormTests.cs

60 lines
1.7 KiB
C#

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;
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 = _bookLogic.TestInsertList(Convert.ToInt32(numericUpDownInsert.Value));
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 FormTests_Load(object sender, EventArgs e)
{
}
}
}