147 lines
4.2 KiB
C#
147 lines
4.2 KiB
C#
|
using HotelAbstractions.Logic;
|
|||
|
using HotelAbstractions.Models;
|
|||
|
|
|||
|
namespace HotelView
|
|||
|
{
|
|||
|
public partial class FormMain : Form
|
|||
|
{
|
|||
|
public FormMain()
|
|||
|
{
|
|||
|
InitializeComponent();
|
|||
|
}
|
|||
|
|
|||
|
private void HotelToolStrip_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(FormHotel));
|
|||
|
if (service is FormHotel form)
|
|||
|
{
|
|||
|
form.ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void RoomToolStrip_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(FormRoom));
|
|||
|
if (service is FormRoom form)
|
|||
|
{
|
|||
|
form.ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ReservationToolStrip_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(FormReservation));
|
|||
|
if (service is FormReservation form)
|
|||
|
{
|
|||
|
form.ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void GuestToolStrip_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(FormGuest));
|
|||
|
if (service is FormGuest form)
|
|||
|
{
|
|||
|
form.ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ServiceToolStrip_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(FormService));
|
|||
|
if (service is FormService form)
|
|||
|
{
|
|||
|
form.ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void ServiceCheckToolStrip_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(FormServiceCheck));
|
|||
|
if (service is FormServiceCheck form)
|
|||
|
{
|
|||
|
form.ShowDialog();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
private void add1000ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(IHotelLogic));
|
|||
|
if (service is IHotelLogic hotelLogic)
|
|||
|
{
|
|||
|
DateTime startTime = DateTime.Now;
|
|||
|
for (int i = 0; i < 1000; i++)
|
|||
|
{
|
|||
|
Hotel hotel = new()
|
|||
|
{
|
|||
|
Id = i + 1000,
|
|||
|
HotelName = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> " + i,
|
|||
|
Address = "<22><><EFBFBD><EFBFBD><EFBFBD> " + i,
|
|||
|
CountStar = i,
|
|||
|
CountRoom = i
|
|||
|
};
|
|||
|
hotelLogic.CreateId(hotel);
|
|||
|
}
|
|||
|
DateTime endTime = DateTime.Now;
|
|||
|
|
|||
|
labelTest.Text = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1000 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> {(endTime - startTime).TotalMilliseconds} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void get1000ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(IHotelLogic));
|
|||
|
if (service is IHotelLogic hotelLogic)
|
|||
|
{
|
|||
|
DateTime startTime = DateTime.Now;
|
|||
|
for (int i =0; i < 1000; i++)
|
|||
|
hotelLogic.Get(i + 1000);
|
|||
|
DateTime endTime = DateTime.Now;
|
|||
|
|
|||
|
labelTest.Text = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1000 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> {(endTime - startTime).TotalMilliseconds} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void update1000ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(IHotelLogic));
|
|||
|
if (service is IHotelLogic hoteLogic)
|
|||
|
{
|
|||
|
DateTime startTime = DateTime.Now;
|
|||
|
for (int i = 0; i < 1000; i++)
|
|||
|
{
|
|||
|
Hotel hotel = new()
|
|||
|
{
|
|||
|
Id = i + 1000,
|
|||
|
HotelName = "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> " + i + 2000,
|
|||
|
Address = "<22><><EFBFBD><EFBFBD><EFBFBD> " + i + 2000,
|
|||
|
CountStar = i + 2000,
|
|||
|
CountRoom = i + 2000
|
|||
|
};
|
|||
|
hoteLogic.Update(hotel);
|
|||
|
}
|
|||
|
DateTime endTime = DateTime.Now;
|
|||
|
|
|||
|
labelTest.Text = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1000 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> {(endTime - startTime).TotalMilliseconds} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
private void delete1000ToolStripMenuItem_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
var service = Program.ServiceProvider?.GetService(typeof(IHotelLogic));
|
|||
|
if (service is IHotelLogic hoteLogic)
|
|||
|
{
|
|||
|
DateTime startTime = DateTime.Now;
|
|||
|
for (int i = 0; i < 1000; i++)
|
|||
|
{
|
|||
|
hoteLogic.Delete(i + 1000);
|
|||
|
}
|
|||
|
DateTime endTime = DateTime.Now;
|
|||
|
|
|||
|
labelTest.Text = $"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1000 <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> {(endTime - startTime).TotalMilliseconds} <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>";
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|