From f1703099c7855304fd166d29d798cdff3b888065 Mon Sep 17 00:00:00 2001 From: "ityurner02@mail.ru" Date: Fri, 14 Apr 2023 20:34:59 +0400 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B2=D0=B5=D1=80=D1=88=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20?= =?UTF-8?q?=D1=81=20=D1=84=D0=BE=D1=80=D0=BC=D0=B0=D0=BC=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessLogic/DisciplineLogic.cs | 16 +- .../BusinessLogic/GroupLogic.cs | 16 +- .../BusinessLogic/StudentLogic.cs | 16 +- .../BusinessLogic/TeacherLogic.cs | 16 +- SUBD/SUBD/FormElectronicJournal.Designer.cs | 39 ---- SUBD/SUBD/FormElectronicJournal.cs | 10 - SUBD/SUBD/FormElectronicJournal.resx | 120 ------------ SUBD/SUBD/FormMain.Designer.cs | 137 +++++++++++++ SUBD/SUBD/FormMain.cs | 80 ++++++++ SUBD/SUBD/FormMain.resx | 60 ++++++ SUBD/SUBD/FormRandom.Designer.cs | 95 +++++++++ SUBD/SUBD/FormRandom.cs | 180 ++++++++++++++++++ SUBD/SUBD/FormRandom.resx | 60 ++++++ SUBD/SUBD/Program.cs | 4 +- 14 files changed, 647 insertions(+), 202 deletions(-) delete mode 100644 SUBD/SUBD/FormElectronicJournal.Designer.cs delete mode 100644 SUBD/SUBD/FormElectronicJournal.cs delete mode 100644 SUBD/SUBD/FormElectronicJournal.resx create mode 100644 SUBD/SUBD/FormMain.Designer.cs create mode 100644 SUBD/SUBD/FormMain.cs create mode 100644 SUBD/SUBD/FormMain.resx create mode 100644 SUBD/SUBD/FormRandom.Designer.cs create mode 100644 SUBD/SUBD/FormRandom.cs create mode 100644 SUBD/SUBD/FormRandom.resx diff --git a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/DisciplineLogic.cs b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/DisciplineLogic.cs index b913209..05278a4 100644 --- a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/DisciplineLogic.cs +++ b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/DisciplineLogic.cs @@ -98,14 +98,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic } _logger.LogInformation("Discipline. Title:{Title}.Id:{Id}", model.Title, model.Id); - var element = _disciplineStorage.GetElement(new DisciplineSearchModel - { - Title = model.Title - }); - if (element != null && element.Id != model.Id) - { - throw new InvalidOperationException("Дисциплина с таким названием уже есть"); - } + //var element = _disciplineStorage.GetElement(new DisciplineSearchModel + //{ + // Title = model.Title + //}); + //if (element != null && element.Id != model.Id) + //{ + // throw new InvalidOperationException("Дисциплина с таким названием уже есть"); + //} } } } diff --git a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/GroupLogic.cs b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/GroupLogic.cs index 2d4a49e..77d7afd 100644 --- a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/GroupLogic.cs +++ b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/GroupLogic.cs @@ -98,14 +98,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic } _logger.LogInformation("Group. Title:{Title}.Id:{Id}", model.Title, model.Id); - var element = _groupStorage.GetElement(new GroupSearchModel - { - Title = model.Title - }); - if (element != null && element.Id != model.Id) - { - throw new InvalidOperationException("Группа с таким названием уже есть"); - } + //var element = _groupStorage.GetElement(new GroupSearchModel + //{ + // Title = model.Title + //}); + //if (element != null && element.Id != model.Id) + //{ + // throw new InvalidOperationException("Группа с таким названием уже есть"); + //} } } } diff --git a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/StudentLogic.cs b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/StudentLogic.cs index ad61788..885eebd 100644 --- a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/StudentLogic.cs +++ b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/StudentLogic.cs @@ -96,14 +96,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic _logger.LogInformation("Student. Name:{Name}.GroupId:{GroupId}.Id:{Id}", model.Name, model.GroupId, model.Id); - var element = _studentStorage.GetElement(new StudentSearchModel - { - Name = model.Name - }); - if (element != null && element.Id != model.Id) - { - throw new InvalidOperationException("Студент с таким именем уже есть"); - } + //var element = _studentStorage.GetElement(new StudentSearchModel + //{ + // Name = model.Name + //}); + //if (element != null && element.Id != model.Id) + //{ + // throw new InvalidOperationException("Студент с таким именем уже есть"); + //} } } } diff --git a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/TeacherLogic.cs b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/TeacherLogic.cs index f6eb0d4..76ed3d9 100644 --- a/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/TeacherLogic.cs +++ b/SUBD/ElectronicJournalBusinessLogic/BusinessLogic/TeacherLogic.cs @@ -98,14 +98,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic } _logger.LogInformation("Teacher. Name:{Name}.Id:{Id}", model.Name, model.Id); - var element = _teacherStorage.GetElement(new TeacherSearchModel - { - Name = model.Name - }); - if (element != null && element.Id != model.Id) - { - throw new InvalidOperationException("Преподаватель с таким именем уже есть"); - } + //var element = _teacherStorage.GetElement(new TeacherSearchModel + //{ + // Name = model.Name + //}); + //if (element != null && element.Id != model.Id) + //{ + // throw new InvalidOperationException("Преподаватель с таким именем уже есть"); + //} } } } diff --git a/SUBD/SUBD/FormElectronicJournal.Designer.cs b/SUBD/SUBD/FormElectronicJournal.Designer.cs deleted file mode 100644 index 7059d68..0000000 --- a/SUBD/SUBD/FormElectronicJournal.Designer.cs +++ /dev/null @@ -1,39 +0,0 @@ -namespace SUBD -{ - partial class FormElectronicJournal - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(800, 450); - this.Text = "Form1"; - } - - #endregion - } -} \ No newline at end of file diff --git a/SUBD/SUBD/FormElectronicJournal.cs b/SUBD/SUBD/FormElectronicJournal.cs deleted file mode 100644 index 94b189f..0000000 --- a/SUBD/SUBD/FormElectronicJournal.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SUBD -{ - public partial class FormElectronicJournal : Form - { - public FormElectronicJournal() - { - InitializeComponent(); - } - } -} \ No newline at end of file diff --git a/SUBD/SUBD/FormElectronicJournal.resx b/SUBD/SUBD/FormElectronicJournal.resx deleted file mode 100644 index 1af7de1..0000000 --- a/SUBD/SUBD/FormElectronicJournal.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/SUBD/SUBD/FormMain.Designer.cs b/SUBD/SUBD/FormMain.Designer.cs new file mode 100644 index 0000000..94709f4 --- /dev/null +++ b/SUBD/SUBD/FormMain.Designer.cs @@ -0,0 +1,137 @@ +namespace SUBD +{ + partial class FormMain + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + buttonDiscipline = new Button(); + buttonTeacher = new Button(); + buttonGroup = new Button(); + buttonStudent = new Button(); + buttonStatement = new Button(); + buttonResultOfControl = new Button(); + buttonGenerate = new Button(); + SuspendLayout(); + // + // buttonDiscipline + // + buttonDiscipline.Location = new Point(12, 12); + buttonDiscipline.Name = "buttonDiscipline"; + buttonDiscipline.Size = new Size(149, 67); + buttonDiscipline.TabIndex = 0; + buttonDiscipline.Text = "Дисциплины"; + buttonDiscipline.UseVisualStyleBackColor = true; + buttonDiscipline.Click += buttonDiscipline_Click; + // + // buttonTeacher + // + buttonTeacher.Location = new Point(167, 12); + buttonTeacher.Name = "buttonTeacher"; + buttonTeacher.Size = new Size(149, 67); + buttonTeacher.TabIndex = 1; + buttonTeacher.Text = "Преподаватели"; + buttonTeacher.UseVisualStyleBackColor = true; + buttonTeacher.Click += buttonTeacher_Click; + // + // buttonGroup + // + buttonGroup.Location = new Point(322, 12); + buttonGroup.Name = "buttonGroup"; + buttonGroup.Size = new Size(149, 67); + buttonGroup.TabIndex = 2; + buttonGroup.Text = "Группы"; + buttonGroup.UseVisualStyleBackColor = true; + buttonGroup.Click += buttonGroup_Click; + // + // buttonStudent + // + buttonStudent.Location = new Point(12, 85); + buttonStudent.Name = "buttonStudent"; + buttonStudent.Size = new Size(149, 67); + buttonStudent.TabIndex = 3; + buttonStudent.Text = "Студенты"; + buttonStudent.UseVisualStyleBackColor = true; + buttonStudent.Click += buttonStudent_Click; + // + // buttonStatement + // + buttonStatement.Location = new Point(167, 85); + buttonStatement.Name = "buttonStatement"; + buttonStatement.Size = new Size(149, 67); + buttonStatement.TabIndex = 4; + buttonStatement.Text = "Ведомости"; + buttonStatement.UseVisualStyleBackColor = true; + buttonStatement.Click += buttonStatement_Click; + // + // buttonResultOfControl + // + buttonResultOfControl.Location = new Point(322, 85); + buttonResultOfControl.Name = "buttonResultOfControl"; + buttonResultOfControl.Size = new Size(149, 67); + buttonResultOfControl.TabIndex = 5; + buttonResultOfControl.Text = "Результаты контроля"; + buttonResultOfControl.UseVisualStyleBackColor = true; + buttonResultOfControl.Click += buttonResultOfControl_Click; + // + // buttonGenerate + // + buttonGenerate.Location = new Point(167, 158); + buttonGenerate.Name = "buttonGenerate"; + buttonGenerate.Size = new Size(149, 67); + buttonGenerate.TabIndex = 6; + buttonGenerate.Text = "Сгенерировать"; + buttonGenerate.UseVisualStyleBackColor = true; + buttonGenerate.Click += buttonGenerate_Click; + // + // FormMain + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(486, 255); + Controls.Add(buttonGenerate); + Controls.Add(buttonResultOfControl); + Controls.Add(buttonStatement); + Controls.Add(buttonStudent); + Controls.Add(buttonGroup); + Controls.Add(buttonTeacher); + Controls.Add(buttonDiscipline); + Name = "FormMain"; + Text = "Электронный журнал"; + ResumeLayout(false); + } + + #endregion + + private Button buttonDiscipline; + private Button buttonTeacher; + private Button buttonGroup; + private Button buttonStudent; + private Button buttonStatement; + private Button buttonResultOfControl; + private Button buttonGenerate; + } +} \ No newline at end of file diff --git a/SUBD/SUBD/FormMain.cs b/SUBD/SUBD/FormMain.cs new file mode 100644 index 0000000..430eb84 --- /dev/null +++ b/SUBD/SUBD/FormMain.cs @@ -0,0 +1,80 @@ +namespace SUBD +{ + public partial class FormMain : Form + { + public FormMain() + { + InitializeComponent(); + } + + private void buttonDiscipline_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormDiscipline)); + + if (service is FormDiscipline form) + { + form.ShowDialog(); + } + } + + private void buttonTeacher_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormTeacher)); + + if (service is FormTeacher form) + { + form.ShowDialog(); + } + } + + private void buttonGroup_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormGroup)); + + if (service is FormGroup form) + { + form.ShowDialog(); + } + } + + private void buttonStudent_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormStudent)); + + if (service is FormStudent form) + { + form.ShowDialog(); + } + } + + private void buttonStatement_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormStatement)); + + if (service is FormStatement form) + { + form.ShowDialog(); + } + } + + private void buttonResultOfControl_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormResultOfControl)); + + if (service is FormResultOfControl form) + { + form.ShowDialog(); + } + } + + private void buttonGenerate_Click(object sender, EventArgs e) + { + var service = Program.ServiceProvider?.GetService(typeof(FormRandom)); + + if (service is FormRandom form) + { + form.ShowDialog(); + } + } + } +} \ No newline at end of file diff --git a/SUBD/SUBD/FormMain.resx b/SUBD/SUBD/FormMain.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/SUBD/SUBD/FormMain.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SUBD/SUBD/FormRandom.Designer.cs b/SUBD/SUBD/FormRandom.Designer.cs new file mode 100644 index 0000000..2d5327c --- /dev/null +++ b/SUBD/SUBD/FormRandom.Designer.cs @@ -0,0 +1,95 @@ +namespace SUBD +{ + partial class FormRandom + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + comboBoxWhat = new ComboBox(); + ButtonAdd = new Button(); + textBoxCount = new TextBox(); + labelTime = new Label(); + SuspendLayout(); + // + // comboBoxWhat + // + comboBoxWhat.DropDownStyle = ComboBoxStyle.DropDownList; + comboBoxWhat.FormattingEnabled = true; + comboBoxWhat.Items.AddRange(new object[] { "Преподаватель", "Дисциплина", "Группа", "Студент", "Ведомость", "Результат" }); + comboBoxWhat.Location = new Point(111, 12); + comboBoxWhat.Name = "comboBoxWhat"; + comboBoxWhat.Size = new Size(139, 28); + comboBoxWhat.TabIndex = 0; + // + // ButtonAdd + // + ButtonAdd.Location = new Point(111, 79); + ButtonAdd.Name = "ButtonAdd"; + ButtonAdd.Size = new Size(139, 29); + ButtonAdd.TabIndex = 1; + ButtonAdd.Text = "Добавить"; + ButtonAdd.UseVisualStyleBackColor = true; + ButtonAdd.Click += ButtonAdd_Click; + // + // textBoxCount + // + textBoxCount.Location = new Point(111, 46); + textBoxCount.Name = "textBoxCount"; + textBoxCount.Size = new Size(139, 27); + textBoxCount.TabIndex = 2; + // + // labelTime + // + labelTime.AutoSize = true; + labelTime.Location = new Point(151, 111); + labelTime.Name = "labelTime"; + labelTime.Size = new Size(54, 20); + labelTime.TabIndex = 3; + labelTime.Text = "Время"; + // + // FormRandom + // + AutoScaleDimensions = new SizeF(8F, 20F); + AutoScaleMode = AutoScaleMode.Font; + ClientSize = new Size(339, 140); + Controls.Add(labelTime); + Controls.Add(textBoxCount); + Controls.Add(ButtonAdd); + Controls.Add(comboBoxWhat); + Name = "FormRandom"; + Text = "Генерация"; + ResumeLayout(false); + PerformLayout(); + } + + #endregion + + private ComboBox comboBoxWhat; + private Button ButtonAdd; + private TextBox textBoxCount; + private Label labelTime; + } +} \ No newline at end of file diff --git a/SUBD/SUBD/FormRandom.cs b/SUBD/SUBD/FormRandom.cs new file mode 100644 index 0000000..883905d --- /dev/null +++ b/SUBD/SUBD/FormRandom.cs @@ -0,0 +1,180 @@ +using ElectronicJournalContracts.BindingModels; +using ElectronicJournalContracts.BusinessLogicContracts; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace SUBD +{ + public partial class FormRandom : Form + { + private readonly IDisciplineLogic _Dlogic; + private readonly ITeacherLogic _Tlogic; + private readonly IGroupLogic _Glogic; + private readonly IStudentLogic _STlogic; + private readonly IStatementLogic _Slogic; + private readonly IResultOfControlLogic _Rlogic; + public FormRandom(IDisciplineLogic dlogic, ITeacherLogic tlogic, IGroupLogic glogic, IStudentLogic stlogic, IStatementLogic slogic, IResultOfControlLogic rlogic) + { + InitializeComponent(); + _Dlogic = dlogic; + _Tlogic = tlogic; + _Glogic = glogic; + _STlogic = stlogic; + _Slogic = slogic; + _Rlogic = rlogic; + } + string[] names = new string[] { "Илья", "Татьяна", "Сергей", "Максим", "Владимир", "Александр", "Олег", "Анатаолий", "София", "Стела", "Аким", "Матвей", "Анисия", "Василий", "Лукьян", "Руслан", "Клара", "Андрей", "Мстислав", "Федот", "Олег", "Аркадий", "Ангелина", "Анжелика", "Стефания", "Мариам", "Дементий", "Андрон", "Даниил", "Адам", "Евдоким", "Валерий", "Дамир", "Фёдор", "Василиса", "Сафина", "Даниэль", "Дарина", "Мир", "Феофан", "Всеслава", "Инна", "Платон", "Ирина", "Рафаэль", "Милана", "Клавдий", "Лейла", "Роза", "Тимофей", "Пимен", "Модест", "Эмма", "Георгий", "Дарья", "Дмитрий", "Эрик", "Филипп", "Владилен", "Евсей", "Даниль", "Ростислав", "Тихон", "Тея", "Наум", "Виолетта", "Анатолий", "Рустам", "Юлия", "Дана", "Самсон", "Ариадна", "Ибрагим", "Светлана", "Инга", "Али", "Виталий", "Алисия", "Оксана", "Тимур", "Аида", "Камиль", "Иннокентий", "Элина", "Виктория", "Анна", "Амелия", "Япсина", "Эвелина", "Кира", "Артур", "Владлена", "Никифор", "Марина", "Артем", "Моисей", "Иван", "Лидия", "Трофим", "Игорь" }; + string[] groupName = new string[] { "ПИбд-21", "ИСЭбд-21", "ИСТбд-21", "ПСбд-21", "ИВТАбд-21", "РВбд-21", "НГбд-21", "ХТбд-21", "ПИбд-22", "ИСЭбд-22", "ИСТбд-22", "ПСбд-22", "ИВТАбд-22", "РВбд-22", "НГбд-22", "ХТбд-22", "ПИбд-23", "ИСЭбд-23", "ИСТбд-23", "ПСбд-23", "ИВТАбд-23", "РВбд-23", "НГбд-23", "ХТбд-23" }; + string[] disciplineName = new string[] { "Математический анализ", "Теория вероятности", "СУБД", "БД", "Интернет программирование", "Операционные системы", "МЛИТА", "СИТ", "РПП", "ТСЧМИ", "Технология программирования", "Физика", "ОЭВМИС", "Электротехника", "Философия", "Античная литература", "ОТС", "ОИТ", "Истормя", "Иностранный язык", "Музыка", "Археология", "Физическая культура", "Этика", "ОАИП" }; + string[] academicTitle = new string[] { "Доцент", "Профессор" }; + string[] form = new string[] { "Экзамен", "Зачет", "Курсовая", "Практика" }; + string[] mark = new string[] { "Отлично", "Хорошо", "Удовлетворительно", "Неудовлетворительно", "Зачтено", "Не зачтено" }; + Random rd = new Random(); + private void ButtonAdd_Click(object sender, EventArgs e) + { + switch (comboBoxWhat.SelectedItem) + { + case "Преподаватель": + Stopwatch stopwatch = new Stopwatch(); + stopwatch.Start(); + for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++) + { + var modelT = new TeacherBindingModel + { + Id = 0, + Name = names[rd.Next(0, names.Length)], + AcademicTitle = academicTitle[rd.Next(0, academicTitle.Length)] + }; + _Tlogic.Create(modelT); + } + stopwatch.Stop(); + TimeSpan ts = stopwatch.Elapsed; + string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts.Hours, ts.Minutes, ts.Seconds, + ts.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime); + break; + case "Дисциплина": + Stopwatch stopwatch1 = new Stopwatch(); + stopwatch1.Start(); + for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++) + { + var modelD = new DisciplineBindingModel + { + Id = 0, + Title = disciplineName[rd.Next(0, disciplineName.Length)] + }; + _Dlogic.Create(modelD); + } + stopwatch1.Stop(); + TimeSpan ts1 = stopwatch1.Elapsed; + string elapsedTime1 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts1.Hours, ts1.Minutes, ts1.Seconds, + ts1.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime1); + break; + case "Группа": + Stopwatch stopwatch2 = new Stopwatch(); + stopwatch2.Start(); + for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++) + { + var modelG = new GroupBindingModel + { + Id = 0, + Title = groupName[rd.Next(0, groupName.Length)], + Course = rd.Next(1, 7) + }; + _Glogic.Create(modelG); + } + stopwatch2.Stop(); + TimeSpan ts2 = stopwatch2.Elapsed; + string elapsedTime2 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts2.Hours, ts2.Minutes, ts2.Seconds, + ts2.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime2); + break; + case "Студент": + Stopwatch stopwatch3 = new Stopwatch(); + stopwatch3.Start(); + int grouplist = _Glogic.ReadList(null).Count(); + for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++) + { + var modelST = new StudentBindingModel + { + Id = 0, + Name = names[rd.Next(0, names.Length)], + GroupId = rd.Next(1, grouplist - 1) + }; + _STlogic.Create(modelST); + } + stopwatch3.Stop(); + TimeSpan ts3 = stopwatch3.Elapsed; + string elapsedTime3 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts3.Hours, ts3.Minutes, ts3.Seconds, + ts3.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime3); + break; + case "Ведомость": + Stopwatch stopwatch4 = new Stopwatch(); + stopwatch4.Start(); + int teachlist = _Tlogic.ReadList(null).Count(); + int grouplist1 = _Glogic.ReadList(null).Count(); + int disciplinelist = _Dlogic.ReadList(null).Count(); + for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++) + { + var modelS = new StatementBindingModel + { + Id = 0, + Date = DateOnly.FromDateTime(DateTime.Now), + DisciplineId = rd.Next(1, disciplinelist), + GroupId = rd.Next(1, grouplist1), + TeacherId = rd.Next(1, teachlist) + }; + _Slogic.Create(modelS); + } + stopwatch4.Stop(); + TimeSpan ts4 = stopwatch4.Elapsed; + string elapsedTime4 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts4.Hours, ts4.Minutes, ts4.Seconds, + ts4.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime4); + break; + case "Результат": + Stopwatch stopwatch5 = new Stopwatch(); + stopwatch5.Start(); + int studlist = _Tlogic.ReadList(null).Count(); + int statlist = _Glogic.ReadList(null).Count(); + for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++) + { + var modelR = new ResultOfControlBindingModel + { + Id = 0, + Form = form[rd.Next(0, form.Length)], + Date = DateOnly.FromDateTime(DateTime.Now), + Mark = mark[rd.Next(0, mark.Length)], + StudentId = rd.Next(1, studlist), + StatementId = rd.Next(1, statlist) + }; + _Rlogic.Create(modelR); + } + stopwatch5.Stop(); + TimeSpan ts5 = stopwatch5.Elapsed; + string elapsedTime5 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}", + ts5.Hours, ts5.Minutes, ts5.Seconds, + ts5.Milliseconds / 10); + labelTime.Text = ("RunTime " + elapsedTime5); + break; + + } + MessageBox.Show("Данные добавлены"); + } + } +} diff --git a/SUBD/SUBD/FormRandom.resx b/SUBD/SUBD/FormRandom.resx new file mode 100644 index 0000000..f298a7b --- /dev/null +++ b/SUBD/SUBD/FormRandom.resx @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/SUBD/SUBD/Program.cs b/SUBD/SUBD/Program.cs index 7c89a4c..7e95684 100644 --- a/SUBD/SUBD/Program.cs +++ b/SUBD/SUBD/Program.cs @@ -22,7 +22,7 @@ namespace SUBD var services = new ServiceCollection(); ConfigureServices(services); _serviceProvider = services.BuildServiceProvider(); - Application.Run(_serviceProvider.GetRequiredService()); + Application.Run(_serviceProvider.GetRequiredService()); } private static void ConfigureServices(ServiceCollection services) { @@ -55,6 +55,8 @@ namespace SUBD services.AddTransient(); services.AddTransient(); services.AddTransient(); + services.AddTransient(); + services.AddTransient(); } } } \ No newline at end of file