DB/TransportGuide/FormTests.cs
2023-05-06 11:07:27 +04:00

57 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TransportGuideContracts.BusinessLogicsContracts;
namespace TransportGuide
{
public partial class FormTests : Form
{
private readonly IRouteLogic _routeLogic;
public FormTests(IRouteLogic routeLogic)
{
InitializeComponent();
_routeLogic= routeLogic;
numericUpDownInsert.Minimum = 1;
numericUpDownInsert.Maximum = 1000000;
numericUpDownRead.Minimum = 1;
numericUpDownRead.Maximum = 1000000;
}
private void buttonInsertTest_Click(object sender, EventArgs e)
{
try
{
var result = _routeLogic.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 = _routeLogic.TestReadList(Convert.ToInt32(numericUpDownRead.Value));
textBoxReadTime.Text = result;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}