DB/TransportGuide/FormTests.cs

76 lines
2.0 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;
//private readonly IUserLogic _userLogic;
//private readonly ITopicLogic _topicLogic;
public FormTests(IRouteLogic routeLogic)//IUserLogic userLogic, ITopicLogic topicLogic, IMessageLogic messageLogic)
{
InitializeComponent();
//_userLogic = userLogic;
//_topicLogic = topicLogic;
_routeLogic= routeLogic;
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)
{
//try
//{
// var result = _messageLogic.TestInsertList(Convert.ToInt32(numericUpDownInsert.Value),
// _userLogic.ReadList(null) ?? new(),
// _topicLogic.ReadList(null) ?? new());
// 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);
}
}
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);
//}
}
}
}