2024-05-05 22:00:25 +04:00
|
|
|
|
using Database;
|
|
|
|
|
using System;
|
2024-04-16 22:38:56 +04:00
|
|
|
|
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;
|
2024-05-05 22:00:25 +04:00
|
|
|
|
using Type = Database.Type;
|
2024-04-16 22:38:56 +04:00
|
|
|
|
|
|
|
|
|
namespace View
|
|
|
|
|
{
|
|
|
|
|
public partial class MainForm : Form
|
|
|
|
|
{
|
2024-05-05 22:00:25 +04:00
|
|
|
|
private readonly Abstracts db;
|
|
|
|
|
public MainForm(Abstracts abstracts)
|
2024-04-16 22:38:56 +04:00
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
2024-05-05 22:00:25 +04:00
|
|
|
|
db = abstracts;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(UsersForm));
|
|
|
|
|
if (service is UsersForm form)
|
|
|
|
|
{
|
|
|
|
|
form.Show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(TypesForm));
|
|
|
|
|
if (service is TypesForm form)
|
|
|
|
|
{
|
|
|
|
|
form.Show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(InvitedForm));
|
|
|
|
|
if (service is InvitedForm form)
|
|
|
|
|
{
|
|
|
|
|
form.Show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var service = Program.ServiceProvider?.GetService(typeof(DatesForm));
|
|
|
|
|
if (service is DatesForm form)
|
|
|
|
|
{
|
|
|
|
|
form.Show();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string UserName = "БИБА";
|
|
|
|
|
string Email = "biba@rambler.ru";
|
|
|
|
|
DateTime date = DateTime.Now;
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
bool last = false;
|
|
|
|
|
for (int i = 0; i < 1000; i++)
|
|
|
|
|
{
|
|
|
|
|
last = db.CreateUser(new()
|
|
|
|
|
{
|
|
|
|
|
name = $"{UserName}{i}",
|
|
|
|
|
email = $"{Email}{i}",
|
|
|
|
|
birthday = date
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
string title = "type";
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
bool last = false;
|
|
|
|
|
for (int i = 0; i < 1000; i++)
|
|
|
|
|
{
|
|
|
|
|
last = db.CreateType(new() { title = $"{title}{i}" });
|
|
|
|
|
}
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button7_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
User userId = db.GetUser("БИБА0");
|
|
|
|
|
Type typeId = db.GetType("type0");
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
bool last = false;
|
|
|
|
|
for (int i = 0; i < 1000; i++)
|
|
|
|
|
{
|
|
|
|
|
last = db.CreateData(new()
|
|
|
|
|
{
|
|
|
|
|
dateTime = DateTime.Now,
|
|
|
|
|
typeId = typeId.Id + i,
|
|
|
|
|
userId = userId.Id + i
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button9_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
User userId = db.GetUser("БИБА0");
|
|
|
|
|
Type typeId = db.GetType("type0");
|
|
|
|
|
Data data = db.GetData(userId.Id, typeId.Id);
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
bool last = false;
|
|
|
|
|
for (int i = 0; i < 100; i++)
|
|
|
|
|
{
|
|
|
|
|
for (int j = 0; j < 100; j++)
|
|
|
|
|
{
|
|
|
|
|
last = db.CreateInvite(new()
|
|
|
|
|
{
|
|
|
|
|
typeId = data.Id + j,
|
|
|
|
|
userId = userId.Id + i
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button12_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
User userId = db.GetUser("БИБА0");
|
|
|
|
|
string UserName = "БИБА1";
|
|
|
|
|
string Email = "biba1@rambler.ru";
|
|
|
|
|
DateTime date = DateTime.Now;
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
bool last = false;
|
|
|
|
|
for (int i = 0; i < 1000; i++)
|
|
|
|
|
{
|
|
|
|
|
last = db.UpdateUser(new()
|
|
|
|
|
{
|
|
|
|
|
Id = userId.Id + i,
|
|
|
|
|
name = $"{UserName}{i}",
|
|
|
|
|
email = $"{Email}{i}",
|
|
|
|
|
birthday = date
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button11_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Type typeId = db.GetType("type0");
|
|
|
|
|
string title = "type1";
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
bool last = false;
|
|
|
|
|
for (int i = 0; i < 1000; i++)
|
|
|
|
|
{
|
|
|
|
|
last = db.UpdateType(new() { Id = typeId.Id + i, title = $"{title}{i}" });
|
|
|
|
|
}
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button10_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
User userId = db.GetUser("БИБА0");
|
|
|
|
|
Type typeId = db.GetType("type0");
|
|
|
|
|
Data data = db.GetData(userId.Id, typeId.Id);
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
bool last = false;
|
|
|
|
|
for (int i = 0; i < 1000; i++)
|
|
|
|
|
{
|
|
|
|
|
last = db.UpdateData(new()
|
|
|
|
|
{
|
|
|
|
|
Id = data.Id + i,
|
|
|
|
|
dateTime = DateTime.Today,
|
|
|
|
|
typeId = typeId.Id + i,
|
|
|
|
|
userId = userId.Id + i
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (last)
|
|
|
|
|
{
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button15_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
db.DeleteUsers();
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button14_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
db.DeleteTypes();
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button13_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
db.DeleteDatas();
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void button8_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
DateTime start = DateTime.Now;
|
|
|
|
|
db.DeleteInvited();
|
|
|
|
|
DateTime end = DateTime.Now;
|
|
|
|
|
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
2024-04-16 22:38:56 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|