309 lines
9.9 KiB
C#
309 lines
9.9 KiB
C#
using Commentbase;
|
||
using Database;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.ComponentModel;
|
||
using System.Data;
|
||
using System.Drawing;
|
||
using System.Linq;
|
||
using System.Net;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using System.Windows.Forms;
|
||
|
||
namespace View
|
||
{
|
||
public partial class MainForm : Form
|
||
{
|
||
private readonly Abstracts db;
|
||
public MainForm(Abstracts abstracts)
|
||
{
|
||
InitializeComponent();
|
||
db = abstracts;
|
||
}
|
||
private void button1_Click(object sender, EventArgs e)
|
||
{
|
||
var service = Program.ServiceProvider?.GetService(typeof(FormAlbums));
|
||
if (service is FormAlbums form)
|
||
{
|
||
form.Show();
|
||
}
|
||
}
|
||
private void button2_Click(object sender, EventArgs e)
|
||
{
|
||
var service = Program.ServiceProvider?.GetService(typeof(FormLocations));
|
||
if (service is FormLocations form)
|
||
{
|
||
form.Show();
|
||
}
|
||
}
|
||
private void button3_Click(object sender, EventArgs e)
|
||
{
|
||
var service = Program.ServiceProvider?.GetService(typeof(FormAuthors));
|
||
if (service is FormAuthors form)
|
||
{
|
||
form.Show();
|
||
}
|
||
}
|
||
private void button4_Click(object sender, EventArgs e)
|
||
{
|
||
var service = Program.ServiceProvider?.GetService(typeof(FormPhotos));
|
||
if (service is FormPhotos form)
|
||
{
|
||
form.Show();
|
||
}
|
||
}
|
||
private void button5_Click(object sender, EventArgs e)
|
||
{
|
||
var service = Program.ServiceProvider?.GetService(typeof(FormComments));
|
||
if (service is FormComments form)
|
||
{
|
||
form.Show();
|
||
}
|
||
}
|
||
private void button6_Click(object sender, EventArgs e)
|
||
{
|
||
string Title = "Шикарный альбом";
|
||
string Description = "Тут даже нечего сказать";
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.CreateAlbum(new()
|
||
{
|
||
Title = $"{Title}{i}",
|
||
Description = $"{Description}{i}"
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button7_Click(object sender, EventArgs e)
|
||
{
|
||
string Name = "Москва, Россия";
|
||
string ShortName = "RUS";
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.CreateLocation(new()
|
||
{
|
||
Name = $"{Name}{i}",
|
||
ShortName = $"{ShortName}{i}"
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button8_Click(object sender, EventArgs e)
|
||
{
|
||
string Name = "Эрик Житель";
|
||
string PhoneNum = "+79999999999";
|
||
string Email = "laba@mail.ru";
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.CreateAuthor(new()
|
||
{
|
||
Name = $"{Name}{i}",
|
||
PhoneNum = $"{PhoneNum}{i}",
|
||
Email = $"{Email}{i}"
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button9_Click(object sender, EventArgs e)
|
||
{
|
||
string Title = "image";
|
||
string Description = "photo";
|
||
string Privacy = "Общий доступ";
|
||
DateTime UploadData = DateTime.Now;
|
||
string ImagePath = "Image/Ch8cfe8vfevb";
|
||
Album albumId = db.GetAlbum("Шикарный альбом0");
|
||
Location locationId = db.GetLocation("Москва, Россия0");
|
||
Author authorId = db.GetAuthor("Эрик Житель0");
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.CreatePhoto(new()
|
||
{
|
||
Title = $"{Title}{i}",
|
||
Description = $"{Description}{i}",
|
||
Privacy = $"{Privacy}{i}",
|
||
UploadDate = UploadData,
|
||
ImagePath = $"{ImagePath}{i}",
|
||
AlbumId = albumId.Id + i,
|
||
LocationId = locationId.Id + i,
|
||
AuthorId = authorId.Id + i
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button10_Click(object sender, EventArgs e)
|
||
{
|
||
DateTime PostDate = DateTime.Now;
|
||
string Content = "Вай, как круто!";
|
||
Album albumId = db.GetAlbum("Шикарный альбом0");
|
||
Location locationId = db.GetLocation("Москва, Россия0");
|
||
Author authorId = db.GetAuthor("Эрик Житель0");
|
||
Photo photoId = db.GetPhoto(albumId.Id, locationId.Id, authorId.Id);
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.CreateComment(new()
|
||
{
|
||
PostDate = PostDate,
|
||
Content = $"{Content}{i}",
|
||
PhotoId = photoId.Id + i
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button11_Click(object sender, EventArgs e)
|
||
{
|
||
Album AlbumId = db.GetAlbum("Шикарный альбом0");
|
||
string Title = "Шикарный альбом1";
|
||
string Description = "Тут даже нечего сказать опять";
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.UpdateAlbum(new()
|
||
{
|
||
Id = AlbumId.Id + i,
|
||
Title = $"{Title}{i}",
|
||
Description = $"{Description}{i}"
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button12_Click(object sender, EventArgs e)
|
||
{
|
||
Location locationId = db.GetLocation("Москва, Россия0");
|
||
string Name = "Рим, Италия";
|
||
string ShortName = "ITA";
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.UpdateLocation(new()
|
||
{
|
||
Id = locationId.Id + i,
|
||
Name = $"{Name}{i}",
|
||
ShortName = $"{ShortName}{i}"
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button13_Click(object sender, EventArgs e)
|
||
{
|
||
Author authorId = db.GetAuthor("Эрик Житель0");
|
||
string Name = "Chel";
|
||
string PhoneNum = "+79991112233";
|
||
string Email = "laba4@mail.ru";
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.UpdateAuthor(new()
|
||
{
|
||
Id = authorId.Id + i,
|
||
Name = $"{Name}{i}",
|
||
PhoneNum = $"{PhoneNum}{i}",
|
||
Email = $"{Email}{i}"
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button14_Click(object sender, EventArgs e)
|
||
{
|
||
string Title = "image";
|
||
string Description = "photo";
|
||
string Privacy = "Общий доступ";
|
||
DateTime UploadData = DateTime.Now;
|
||
string ImagePath = "Image/sndbkKSB23842KJH";
|
||
Album albumId = db.GetAlbum("Шикарный альбом0");
|
||
Location locationId = db.GetLocation("Москва, Россия0");
|
||
Author authorId = db.GetAuthor("Эрик Житель0");
|
||
Photo photo = db.GetPhoto(albumId.Id, locationId.Id, authorId.Id);
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.UpdatePhoto(new()
|
||
{
|
||
Id = photo.Id + i,
|
||
Title = $"{Title}{i}",
|
||
Description = $"{Description}{i}",
|
||
Privacy = $"{Privacy}{i}",
|
||
UploadDate = UploadData,
|
||
ImagePath = $"{ImagePath}{i}",
|
||
AlbumId = albumId.Id + i,
|
||
LocationId = locationId.Id + i,
|
||
AuthorId = authorId.Id + i
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button15_Click(object sender, EventArgs e)
|
||
{
|
||
DateTime PostDate = DateTime.Now;
|
||
string Content = "О боже мой!";
|
||
Album albumId = db.GetAlbum("Шикарный альбом0");
|
||
Location locationId = db.GetLocation("Москва, Россия0");
|
||
Author authorId = db.GetAuthor("Эрик Житель0");
|
||
Photo photo = db.GetPhoto(albumId.Id, locationId.Id, authorId.Id);
|
||
Comment comment = db.GetComment(photo.Id);
|
||
DateTime start = DateTime.Now;
|
||
for (int i = 0; i < 1000; i++)
|
||
{
|
||
db.UpdateComment(new()
|
||
{
|
||
Id = comment.Id + i,
|
||
PostDate = PostDate,
|
||
Content = $"{Content}{i}",
|
||
PhotoId = photo.Id + i
|
||
});
|
||
}
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button16_Click(object sender, EventArgs e)
|
||
{
|
||
DateTime start = DateTime.Now;
|
||
db.DeleteAllAlbums();
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button17_Click(object sender, EventArgs e)
|
||
{
|
||
DateTime start = DateTime.Now;
|
||
db.DeleteAllLocations();
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button18_Click(object sender, EventArgs e)
|
||
{
|
||
DateTime start = DateTime.Now;
|
||
db.DeleteAllAuthors();
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button19_Click(object sender, EventArgs e)
|
||
{
|
||
DateTime start = DateTime.Now;
|
||
db.DeleteAllPhotos();
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
private void button20_Click(object sender, EventArgs e)
|
||
{
|
||
DateTime start = DateTime.Now;
|
||
db.DeleteAllComments();
|
||
DateTime end = DateTime.Now;
|
||
MessageBox.Show((end - start).Milliseconds.ToString(), "Время работы", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
}
|
||
}
|
||
}
|