diff --git a/ExamTimetable/ExamTimetable.sln b/ExamTimetable/ExamTimetable.sln
index c14d4b0..5d126ef 100644
--- a/ExamTimetable/ExamTimetable.sln
+++ b/ExamTimetable/ExamTimetable.sln
@@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33122.133
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamTimetable", "ExamTimetable\ExamTimetable.csproj", "{073BFD8D-BE81-4F92-963C-F36385B2337C}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamTimetable_Forms", "ExamTimetable\ExamTimetable_Forms.csproj", "{073BFD8D-BE81-4F92-963C-F36385B2337C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExamTimetable_Database", "ExamTimetable_Database\ExamTimetable_Database.csproj", "{6C08BB85-9FEF-4B6B-B4CE-1CE138397AAB}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -15,6 +17,10 @@ Global
{073BFD8D-BE81-4F92-963C-F36385B2337C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{073BFD8D-BE81-4F92-963C-F36385B2337C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{073BFD8D-BE81-4F92-963C-F36385B2337C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6C08BB85-9FEF-4B6B-B4CE-1CE138397AAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6C08BB85-9FEF-4B6B-B4CE-1CE138397AAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6C08BB85-9FEF-4B6B-B4CE-1CE138397AAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6C08BB85-9FEF-4B6B-B4CE-1CE138397AAB}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/ExamTimetable/ExamTimetable/ExamTimetable_Forms.csproj b/ExamTimetable/ExamTimetable/ExamTimetable_Forms.csproj
index b57c89e..0c0d172 100644
--- a/ExamTimetable/ExamTimetable/ExamTimetable_Forms.csproj
+++ b/ExamTimetable/ExamTimetable/ExamTimetable_Forms.csproj
@@ -8,4 +8,12 @@
enable
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/Form1.Designer.cs b/ExamTimetable/ExamTimetable/Form1.Designer.cs
deleted file mode 100644
index 70bdbb5..0000000
--- a/ExamTimetable/ExamTimetable/Form1.Designer.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-namespace ExamTimetable
-{
- partial class Form1
- {
- ///
- /// 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/ExamTimetable/ExamTimetable/Form1.cs b/ExamTimetable/ExamTimetable/Form1.cs
deleted file mode 100644
index 8ef3ff4..0000000
--- a/ExamTimetable/ExamTimetable/Form1.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace ExamTimetable
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- }
-}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/Form1.resx b/ExamTimetable/ExamTimetable/Form1.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/ExamTimetable/ExamTimetable/Form1.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/ExamTimetable/ExamTimetable/FormComission.Designer.cs b/ExamTimetable/ExamTimetable/FormComission.Designer.cs
new file mode 100644
index 0000000..f8876ce
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormComission.Designer.cs
@@ -0,0 +1,148 @@
+namespace ExamTimetable_Forms
+{
+ partial class FormComission
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.textBoxTeachers = new System.Windows.Forms.TextBox();
+ this.comboBoxFuc = new System.Windows.Forms.ComboBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonUpdate = new System.Windows.Forms.Button();
+ this.buttonDelete = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(483, 357);
+ this.dataGridView.TabIndex = 0;
+ this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick);
+ //
+ // textBoxTeachers
+ //
+ this.textBoxTeachers.Location = new System.Drawing.Point(582, 31);
+ this.textBoxTeachers.Name = "textBoxTeachers";
+ this.textBoxTeachers.Size = new System.Drawing.Size(267, 23);
+ this.textBoxTeachers.TabIndex = 1;
+ //
+ // comboBoxFuc
+ //
+ this.comboBoxFuc.FormattingEnabled = true;
+ this.comboBoxFuc.Location = new System.Drawing.Point(688, 70);
+ this.comboBoxFuc.Name = "comboBoxFuc";
+ this.comboBoxFuc.Size = new System.Drawing.Size(161, 23);
+ this.comboBoxFuc.TabIndex = 2;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(501, 13);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(95, 15);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Преподаватели:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(616, 73);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(66, 15);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Факультет:";
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Location = new System.Drawing.Point(774, 110);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(75, 23);
+ this.buttonCreate.TabIndex = 5;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // buttonUpdate
+ //
+ this.buttonUpdate.Location = new System.Drawing.Point(774, 152);
+ this.buttonUpdate.Name = "buttonUpdate";
+ this.buttonUpdate.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpdate.TabIndex = 6;
+ this.buttonUpdate.Text = "Изменить";
+ this.buttonUpdate.UseVisualStyleBackColor = true;
+ this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
+ //
+ // buttonDelete
+ //
+ this.buttonDelete.Location = new System.Drawing.Point(774, 198);
+ this.buttonDelete.Name = "buttonDelete";
+ this.buttonDelete.Size = new System.Drawing.Size(75, 23);
+ this.buttonDelete.TabIndex = 7;
+ this.buttonDelete.Text = "Удалить";
+ this.buttonDelete.UseVisualStyleBackColor = true;
+ this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
+ //
+ // FormComission
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(861, 381);
+ this.Controls.Add(this.buttonDelete);
+ this.Controls.Add(this.buttonUpdate);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.comboBoxFuc);
+ this.Controls.Add(this.textBoxTeachers);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormComission";
+ this.Text = "FormComission";
+ this.Load += new System.EventHandler(this.FormComission_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private TextBox textBoxTeachers;
+ private ComboBox comboBoxFuc;
+ private Label label1;
+ private Label label2;
+ private Button buttonCreate;
+ private Button buttonUpdate;
+ private Button buttonDelete;
+ }
+}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/FormComission.cs b/ExamTimetable/ExamTimetable/FormComission.cs
new file mode 100644
index 0000000..44f0d23
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormComission.cs
@@ -0,0 +1,126 @@
+using ExamTimetable_Database;
+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;
+
+namespace ExamTimetable_Forms
+{
+ public partial class FormComission : Form
+ {
+ private Abstractions bd;
+ public FormComission(Abstractions _bd)
+ {
+ InitializeComponent();
+ bd = _bd;
+ }
+ private void loadData()
+ {
+ List comissions = bd.GetComissions();
+
+ // Очищаем dataGridView перед заполнением новыми данными
+ dataGridView.Rows.Clear();
+
+ // Предварительно определяем столбцы, если это не было сделано ранее
+ if (dataGridView.ColumnCount == 0)
+ {
+ dataGridView.Columns.Add("Id", "ID");
+ dataGridView.Columns.Add("Teachers", "Преподавательский состав");
+ dataGridView.Columns.Add("Fuc", "Факультет");
+ }
+
+ // Заполняем dataGridView данными из списка моделей автомобилей
+ foreach (Comission сomission in comissions)
+ {
+ dataGridView.Rows.Add(сomission.comm_id, сomission.teaching_stuff, bd.GetFacultyById(сomission.fu_id).faculty_name);
+ }
+ }
+
+
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ // Создаем новый объект с данными из текстовых полей и комбо-бокса
+ Comission newComission = new Comission
+ {
+ teaching_stuff = textBoxTeachers.Text,
+ fu_id = ((helpCombobox)comboBoxFuc.SelectedItem).Id
+ };
+
+ // Добавляем новый факультет в базу данных
+ bd.AddComission(newComission);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonUpdate_Click(object sender, EventArgs e)
+ {
+ // Получаем Id выбранной строки
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Создаем объект CarModel с обновленными данными из текстовых полей и комбо-бокса
+ Comission updatedComission = new Comission
+ {
+ comm_id = selectedRowId,
+ teaching_stuff = textBoxTeachers.Text,
+ fu_id = ((helpCombobox)comboBoxFuc.SelectedItem).Id
+ };
+
+ // Обновляем модель автомобиля в базе данных
+ bd.UpdateComission(updatedComission);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonDelete_Click(object sender, EventArgs e)
+ {
+ // Получаем Id выбранной строки
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Удаляем факультет из базы данных
+ bd.DeleteComission(selectedRowId);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void FormComission_Load(object sender, EventArgs e)
+ {
+ loadData();
+ }
+
+ private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex >= 0)
+ {
+ DataGridViewRow row = dataGridView.Rows[e.RowIndex];
+
+ // Заполняем текстовые поля данными из выбранной строки
+ textBoxTeachers.Text = row.Cells["Teachers"].Value.ToString();
+
+ // Получаем значение из выбранной строки
+ string selectedFuc = row.Cells["Fuc"].Value.ToString();
+
+ // Загружаем список в комбо-бокс
+ comboBoxFuc.DataSource = bd.GetFaculties()
+ .Select(x => new helpCombobox()
+ {
+ Text = bd.GetFacultyById(x.faculty_id).faculty_name,
+ Id = x.faculty_id
+ })
+ .ToList();
+ comboBoxFuc.DisplayMember = "Text";
+ comboBoxFuc.ValueMember = "Id";
+
+ // Выбираем универ, который соответствует выбранному значению в строке
+ comboBoxFuc.SelectedItem = selectedFuc;
+ }
+ }
+ }
+}
diff --git a/ExamTimetable/ExamTimetable/FormComission.resx b/ExamTimetable/ExamTimetable/FormComission.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormComission.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/ExamTimetable/ExamTimetable/FormExam.Designer.cs b/ExamTimetable/ExamTimetable/FormExam.Designer.cs
new file mode 100644
index 0000000..7e64f59
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormExam.Designer.cs
@@ -0,0 +1,192 @@
+namespace ExamTimetable_Forms
+{
+ partial class FormExam
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.textBoxDateTime = new System.Windows.Forms.TextBox();
+ this.textBoxPlace = new System.Windows.Forms.TextBox();
+ this.textBoxSubject = new System.Windows.Forms.TextBox();
+ this.comboBoxCom = new System.Windows.Forms.ComboBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonUpdate = new System.Windows.Forms.Button();
+ this.buttonDelete = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(520, 426);
+ this.dataGridView.TabIndex = 0;
+ this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick);
+ //
+ // textBoxDateTime
+ //
+ this.textBoxDateTime.Location = new System.Drawing.Point(647, 12);
+ this.textBoxDateTime.Name = "textBoxDateTime";
+ this.textBoxDateTime.Size = new System.Drawing.Size(141, 23);
+ this.textBoxDateTime.TabIndex = 1;
+ //
+ // textBoxPlace
+ //
+ this.textBoxPlace.Location = new System.Drawing.Point(647, 56);
+ this.textBoxPlace.Name = "textBoxPlace";
+ this.textBoxPlace.Size = new System.Drawing.Size(141, 23);
+ this.textBoxPlace.TabIndex = 3;
+ //
+ // textBoxSubject
+ //
+ this.textBoxSubject.Location = new System.Drawing.Point(647, 103);
+ this.textBoxSubject.Name = "textBoxSubject";
+ this.textBoxSubject.Size = new System.Drawing.Size(141, 23);
+ this.textBoxSubject.TabIndex = 4;
+ //
+ // comboBoxCom
+ //
+ this.comboBoxCom.FormattingEnabled = true;
+ this.comboBoxCom.Location = new System.Drawing.Point(647, 149);
+ this.comboBoxCom.Name = "comboBoxCom";
+ this.comboBoxCom.Size = new System.Drawing.Size(141, 23);
+ this.comboBoxCom.TabIndex = 5;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(559, 20);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(82, 15);
+ this.label1.TabIndex = 6;
+ this.label1.Text = "Дата и время:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(579, 59);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(45, 15);
+ this.label2.TabIndex = 7;
+ this.label2.Text = "Место:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(579, 106);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(58, 15);
+ this.label3.TabIndex = 8;
+ this.label3.Text = "Предмет:";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(572, 157);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(65, 15);
+ this.label4.TabIndex = 9;
+ this.label4.Text = "Комиссия:";
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Location = new System.Drawing.Point(713, 194);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(75, 23);
+ this.buttonCreate.TabIndex = 10;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // buttonUpdate
+ //
+ this.buttonUpdate.Location = new System.Drawing.Point(713, 236);
+ this.buttonUpdate.Name = "buttonUpdate";
+ this.buttonUpdate.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpdate.TabIndex = 11;
+ this.buttonUpdate.Text = "Изменить";
+ this.buttonUpdate.UseVisualStyleBackColor = true;
+ this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
+ //
+ // buttonDelete
+ //
+ this.buttonDelete.Location = new System.Drawing.Point(713, 284);
+ this.buttonDelete.Name = "buttonDelete";
+ this.buttonDelete.Size = new System.Drawing.Size(75, 23);
+ this.buttonDelete.TabIndex = 12;
+ this.buttonDelete.Text = "Удалить";
+ this.buttonDelete.UseVisualStyleBackColor = true;
+ this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
+ //
+ // FormExam
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.buttonDelete);
+ this.Controls.Add(this.buttonUpdate);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.comboBoxCom);
+ this.Controls.Add(this.textBoxSubject);
+ this.Controls.Add(this.textBoxPlace);
+ this.Controls.Add(this.textBoxDateTime);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormExam";
+ this.Text = "FormExam";
+ this.Load += new System.EventHandler(this.FormExam_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private TextBox textBoxDateTime;
+ private TextBox textBoxPlace;
+ private TextBox textBoxSubject;
+ private ComboBox comboBoxCom;
+ private Label label1;
+ private Label label2;
+ private Label label3;
+ private Label label4;
+ private Button buttonCreate;
+ private Button buttonUpdate;
+ private Button buttonDelete;
+ }
+}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/FormExam.cs b/ExamTimetable/ExamTimetable/FormExam.cs
new file mode 100644
index 0000000..4cb3590
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormExam.cs
@@ -0,0 +1,134 @@
+using ExamTimetable_Database;
+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;
+
+namespace ExamTimetable_Forms
+{
+ public partial class FormExam : Form
+ {
+ private Abstractions bd;
+ public FormExam(Abstractions _bd)
+ {
+ InitializeComponent();
+ bd = _bd;
+ }
+ private void loadData()
+ {
+ List exams = bd.GetExams();
+
+ // Очищаем dataGridView перед заполнением новыми данными
+ dataGridView.Rows.Clear();
+
+ // Предварительно определяем столбцы, если это не было сделано ранее
+ if (dataGridView.ColumnCount == 0)
+ {
+ dataGridView.Columns.Add("Id", "ID");
+ dataGridView.Columns.Add("DateTime", "Дата и время");
+ dataGridView.Columns.Add("Place", "Место");
+ dataGridView.Columns.Add("Subject", "Предмет");
+ dataGridView.Columns.Add("Comm", "Комиссия");
+ }
+
+ // Заполняем dataGridView данными из списка моделей автомобилей
+ foreach (Exam exam in exams)
+ {
+ dataGridView.Rows.Add(exam.exam_id, exam.exam_date + " " + exam.exam_time, exam.exam_place, exam.exam_subject, bd.GetComissionById(exam.com_id).teaching_stuff);
+ }
+ }
+
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ // Создаем новый объект с данными из текстовых полей и комбо-бокса
+ Exam newExam = new Exam
+ {
+ exam_date = DateTime.Parse(textBoxDateTime.Text),
+ exam_place = textBoxPlace.Text,
+ exam_subject = textBoxSubject.Text,
+ com_id = ((helpCombobox)comboBoxCom.SelectedItem).Id,
+ exam_time = DateTime.Parse(textBoxDateTime.Text)
+ };
+
+ // Добавляем новый факультет в базу данных
+ bd.AddExam(newExam);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonUpdate_Click(object sender, EventArgs e)
+ {
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Создаем объект CarModel с обновленными данными из текстовых полей и комбо-бокса
+ Exam updatedExam = new Exam
+ {
+ exam_id = selectedRowId,
+ exam_date = DateTime.Parse(textBoxDateTime.Text),
+ exam_place = textBoxPlace.Text,
+ exam_subject = textBoxSubject.Text,
+ com_id = ((helpCombobox)comboBoxCom.SelectedItem).Id,
+ exam_time = DateTime.Parse(textBoxDateTime.Text)
+ };
+
+ // Обновляем модель автомобиля в базе данных
+ bd.UpdateExam(updatedExam);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonDelete_Click(object sender, EventArgs e)
+ {
+ // Получаем Id выбранной строки
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Удаляем факультет из базы данных
+ bd.DeleteExam(selectedRowId);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void FormExam_Load(object sender, EventArgs e)
+ {
+ loadData();
+ }
+
+ private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex >= 0)
+ {
+ DataGridViewRow row = dataGridView.Rows[e.RowIndex];
+
+ // Заполняем текстовые поля данными из выбранной строки
+ textBoxDateTime.Text = row.Cells["Date"].Value.ToString();
+ textBoxPlace.Text = row.Cells["Place"].Value.ToString();
+ textBoxSubject.Text = row.Cells["Subject"].Value.ToString();
+
+ // Получаем значение из выбранной строки
+ string selectedCom = row.Cells["Comm"].Value.ToString();
+
+ // Загружаем список в комбо-бокс
+ comboBoxCom.DataSource = bd.GetComissions()
+ .Select(x => new helpCombobox()
+ {
+ Text = bd.GetComissionById(x.comm_id).teaching_stuff,
+ Id = x.comm_id
+ })
+ .ToList();
+ comboBoxCom.DisplayMember = "Text";
+ comboBoxCom.ValueMember = "Id";
+
+ // Выбираем универ, который соответствует выбранному значению в строке
+ comboBoxCom.SelectedItem = selectedCom;
+ }
+ }
+ }
+}
diff --git a/ExamTimetable/ExamTimetable/FormExam.resx b/ExamTimetable/ExamTimetable/FormExam.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormExam.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/ExamTimetable/ExamTimetable/FormFaculty.Designer.cs b/ExamTimetable/ExamTimetable/FormFaculty.Designer.cs
new file mode 100644
index 0000000..8063b70
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormFaculty.Designer.cs
@@ -0,0 +1,148 @@
+namespace ExamTimetable_Forms
+{
+ partial class FormFaculty
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.textBoxName = new System.Windows.Forms.TextBox();
+ this.comboBoxUni = new System.Windows.Forms.ComboBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonUpdate = new System.Windows.Forms.Button();
+ this.buttonDelete = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(514, 333);
+ this.dataGridView.TabIndex = 0;
+ this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick);
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(638, 25);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(150, 23);
+ this.textBoxName.TabIndex = 1;
+ //
+ // comboBoxUni
+ //
+ this.comboBoxUni.FormattingEnabled = true;
+ this.comboBoxUni.Location = new System.Drawing.Point(638, 65);
+ this.comboBoxUni.Name = "comboBoxUni";
+ this.comboBoxUni.Size = new System.Drawing.Size(150, 23);
+ this.comboBoxUni.TabIndex = 2;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(570, 28);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(62, 15);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Название:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(553, 68);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(79, 15);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Университет:";
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Location = new System.Drawing.Point(713, 110);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(75, 23);
+ this.buttonCreate.TabIndex = 5;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // buttonUpdate
+ //
+ this.buttonUpdate.Location = new System.Drawing.Point(713, 150);
+ this.buttonUpdate.Name = "buttonUpdate";
+ this.buttonUpdate.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpdate.TabIndex = 6;
+ this.buttonUpdate.Text = "Изменить";
+ this.buttonUpdate.UseVisualStyleBackColor = true;
+ this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
+ //
+ // buttonDelete
+ //
+ this.buttonDelete.Location = new System.Drawing.Point(713, 193);
+ this.buttonDelete.Name = "buttonDelete";
+ this.buttonDelete.Size = new System.Drawing.Size(75, 23);
+ this.buttonDelete.TabIndex = 7;
+ this.buttonDelete.Text = "Удалить";
+ this.buttonDelete.UseVisualStyleBackColor = true;
+ this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
+ //
+ // FormFaculty
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 357);
+ this.Controls.Add(this.buttonDelete);
+ this.Controls.Add(this.buttonUpdate);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.comboBoxUni);
+ this.Controls.Add(this.textBoxName);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormFaculty";
+ this.Text = "FormFaculty";
+ this.Load += new System.EventHandler(this.FormFaculty_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private TextBox textBoxName;
+ private ComboBox comboBoxUni;
+ private Label label1;
+ private Label label2;
+ private Button buttonCreate;
+ private Button buttonUpdate;
+ private Button buttonDelete;
+ }
+}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/FormFaculty.cs b/ExamTimetable/ExamTimetable/FormFaculty.cs
new file mode 100644
index 0000000..241d889
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormFaculty.cs
@@ -0,0 +1,126 @@
+using ExamTimetable_Database;
+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 System.Windows.Forms.VisualStyles;
+
+namespace ExamTimetable_Forms
+{
+ public partial class FormFaculty : Form
+ {
+ private Abstractions bd;
+ public FormFaculty(Abstractions _bd)
+ {
+ InitializeComponent();
+ bd = _bd;
+ }
+ private void loadData()
+ {
+ List faculties = bd.GetFaculties();
+
+ // Очищаем dataGridView перед заполнением новыми данными
+ dataGridView.Rows.Clear();
+
+ // Предварительно определяем столбцы, если это не было сделано ранее
+ if (dataGridView.ColumnCount == 0)
+ {
+ dataGridView.Columns.Add("Id", "ID");
+ dataGridView.Columns.Add("Name", "Название");
+ dataGridView.Columns.Add("Univer", "Университет");
+ }
+
+ // Заполняем dataGridView данными из списка моделей автомобилей
+ foreach (Faculty faculty in faculties)
+ {
+ dataGridView.Rows.Add(faculty.faculty_id, faculty.faculty_name, bd.GetUniversityById(faculty.uni_id).univer_name);
+ }
+ }
+
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ // Создаем новый объект с данными из текстовых полей и комбо-бокса
+ Faculty newFaculty = new Faculty
+ {
+ faculty_name = textBoxName.Text,
+ uni_id = ((helpCombobox)comboBoxUni.SelectedItem).Id
+ };
+
+ // Добавляем новый факультет в базу данных
+ bd.AddFaculty(newFaculty);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonUpdate_Click(object sender, EventArgs e)
+ {
+ // Получаем Id выбранной строки
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Создаем объект CarModel с обновленными данными из текстовых полей и комбо-бокса
+ Faculty updatedFaculty = new Faculty
+ {
+ faculty_id = selectedRowId,
+ faculty_name = textBoxName.Text,
+ uni_id = ((helpCombobox)comboBoxUni.SelectedItem).Id
+ };
+
+ // Обновляем модель автомобиля в базе данных
+ bd.UpdateFaculty(updatedFaculty);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonDelete_Click(object sender, EventArgs e)
+ {
+ // Получаем Id выбранной строки
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Удаляем факультет из базы данных
+ bd.DeleteFaculty(selectedRowId);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void FormFaculty_Load(object sender, EventArgs e)
+ {
+ loadData();
+ }
+
+ private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex >= 0)
+ {
+ DataGridViewRow row = dataGridView.Rows[e.RowIndex];
+
+ // Заполняем текстовые поля данными из выбранной строки
+ textBoxName.Text = row.Cells["Name"].Value.ToString();
+
+ // Получаем значение из выбранной строки
+ string selectedUni = row.Cells["Univer"].Value.ToString();
+
+ // Загружаем список в комбо-бокс
+ comboBoxUni.DataSource = bd.GetUniversities()
+ .Select(x => new helpCombobox()
+ {
+ Text = bd.GetUniversityById(x.univer_id).univer_name,
+ Id = x.univer_id
+ })
+ .ToList();
+ comboBoxUni.DisplayMember = "Text";
+ comboBoxUni.ValueMember = "Id";
+
+ // Выбираем универ, который соответствует выбранному значению в строке
+ comboBoxUni.SelectedItem = selectedUni;
+ }
+ }
+ }
+}
diff --git a/ExamTimetable/ExamTimetable/FormFaculty.resx b/ExamTimetable/ExamTimetable/FormFaculty.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormFaculty.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/ExamTimetable/ExamTimetable/FormMain.Designer.cs b/ExamTimetable/ExamTimetable/FormMain.Designer.cs
new file mode 100644
index 0000000..486e674
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormMain.Designer.cs
@@ -0,0 +1,136 @@
+namespace ExamTimetable
+{
+ 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()
+ {
+ this.buttonUnivers = new System.Windows.Forms.Button();
+ this.buttonFaculties = new System.Windows.Forms.Button();
+ this.buttonSpecs = new System.Windows.Forms.Button();
+ this.buttonComms = new System.Windows.Forms.Button();
+ this.buttonExams = new System.Windows.Forms.Button();
+ this.textBoxTest = new System.Windows.Forms.TextBox();
+ this.buttonTest = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // buttonUnivers
+ //
+ this.buttonUnivers.Location = new System.Drawing.Point(22, 12);
+ this.buttonUnivers.Name = "buttonUnivers";
+ this.buttonUnivers.Size = new System.Drawing.Size(94, 23);
+ this.buttonUnivers.TabIndex = 0;
+ this.buttonUnivers.Text = "Университеты";
+ this.buttonUnivers.UseVisualStyleBackColor = true;
+ this.buttonUnivers.Click += new System.EventHandler(this.buttonUnivers_Click);
+ //
+ // buttonFaculties
+ //
+ this.buttonFaculties.Location = new System.Drawing.Point(144, 12);
+ this.buttonFaculties.Name = "buttonFaculties";
+ this.buttonFaculties.Size = new System.Drawing.Size(91, 23);
+ this.buttonFaculties.TabIndex = 1;
+ this.buttonFaculties.Text = "Факультеты";
+ this.buttonFaculties.UseVisualStyleBackColor = true;
+ this.buttonFaculties.Click += new System.EventHandler(this.buttonFaculties_Click);
+ //
+ // buttonSpecs
+ //
+ this.buttonSpecs.Location = new System.Drawing.Point(263, 12);
+ this.buttonSpecs.Name = "buttonSpecs";
+ this.buttonSpecs.Size = new System.Drawing.Size(108, 23);
+ this.buttonSpecs.TabIndex = 2;
+ this.buttonSpecs.Text = "Специализации";
+ this.buttonSpecs.UseVisualStyleBackColor = true;
+ this.buttonSpecs.Click += new System.EventHandler(this.buttonSpecs_Click);
+ //
+ // buttonComms
+ //
+ this.buttonComms.Location = new System.Drawing.Point(398, 12);
+ this.buttonComms.Name = "buttonComms";
+ this.buttonComms.Size = new System.Drawing.Size(75, 23);
+ this.buttonComms.TabIndex = 3;
+ this.buttonComms.Text = "Комиссии";
+ this.buttonComms.UseVisualStyleBackColor = true;
+ this.buttonComms.Click += new System.EventHandler(this.buttonComms_Click);
+ //
+ // buttonExams
+ //
+ this.buttonExams.Location = new System.Drawing.Point(499, 12);
+ this.buttonExams.Name = "buttonExams";
+ this.buttonExams.Size = new System.Drawing.Size(75, 23);
+ this.buttonExams.TabIndex = 4;
+ this.buttonExams.Text = "Экзамены";
+ this.buttonExams.UseVisualStyleBackColor = true;
+ this.buttonExams.Click += new System.EventHandler(this.buttonExams_Click);
+ //
+ // textBoxTest
+ //
+ this.textBoxTest.Location = new System.Drawing.Point(22, 54);
+ this.textBoxTest.Name = "textBoxTest";
+ this.textBoxTest.Size = new System.Drawing.Size(552, 23);
+ this.textBoxTest.TabIndex = 5;
+ //
+ // buttonTest
+ //
+ this.buttonTest.Location = new System.Drawing.Point(590, 53);
+ this.buttonTest.Name = "buttonTest";
+ this.buttonTest.Size = new System.Drawing.Size(75, 23);
+ this.buttonTest.TabIndex = 6;
+ this.buttonTest.Text = "Тест";
+ this.buttonTest.UseVisualStyleBackColor = true;
+ this.buttonTest.Click += new System.EventHandler(this.buttonTest_Click);
+ //
+ // FormMain
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(677, 122);
+ this.Controls.Add(this.buttonTest);
+ this.Controls.Add(this.textBoxTest);
+ this.Controls.Add(this.buttonExams);
+ this.Controls.Add(this.buttonComms);
+ this.Controls.Add(this.buttonSpecs);
+ this.Controls.Add(this.buttonFaculties);
+ this.Controls.Add(this.buttonUnivers);
+ this.Name = "FormMain";
+ this.Text = "Form1";
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private Button buttonUnivers;
+ private Button buttonFaculties;
+ private Button buttonSpecs;
+ private Button buttonComms;
+ private Button buttonExams;
+ private TextBox textBoxTest;
+ private Button buttonTest;
+ }
+}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/FormMain.cs b/ExamTimetable/ExamTimetable/FormMain.cs
new file mode 100644
index 0000000..780f73e
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormMain.cs
@@ -0,0 +1,74 @@
+using ExamTimetable_Database;
+using ExamTimetable_Forms;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace ExamTimetable
+{
+ public partial class FormMain : Form
+ {
+ public FormMain()
+ {
+ InitializeComponent();
+ }
+
+ private void buttonUnivers_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormUniversity));
+ if (service is FormUniversity form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonFaculties_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormFaculty));
+ if (service is FormFaculty form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonSpecs_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormSpecialization));
+ if (service is FormSpecialization form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonComms_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormComission));
+ if (service is FormComission form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonExams_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(FormExam));
+ if (service is FormExam form)
+ {
+ form.ShowDialog();
+ }
+ }
+
+ private void buttonTest_Click(object sender, EventArgs e)
+ {
+ var service = Program.ServiceProvider?.GetService(typeof(Abstractions));
+ if (service is Abstractions bd)
+ {
+ // "GetCars" ,
+ DateTime startTime = DateTime.Now;
+ var result = bd.GetExams(); //
+ DateTime endTime = DateTime.Now;
+
+ //
+ textBoxTest.Text = $" : {(endTime - startTime).TotalMilliseconds} ";
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/FormMain.resx b/ExamTimetable/ExamTimetable/FormMain.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/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/ExamTimetable/ExamTimetable/FormSpecialization.Designer.cs b/ExamTimetable/ExamTimetable/FormSpecialization.Designer.cs
new file mode 100644
index 0000000..0e5ebed
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormSpecialization.Designer.cs
@@ -0,0 +1,148 @@
+namespace ExamTimetable_Forms
+{
+ partial class FormSpecialization
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.comboBoxFuc = new System.Windows.Forms.ComboBox();
+ this.textBoxName = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonUpdate = new System.Windows.Forms.Button();
+ this.buttonDelete = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(463, 360);
+ this.dataGridView.TabIndex = 0;
+ this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick);
+ //
+ // comboBoxFuc
+ //
+ this.comboBoxFuc.FormattingEnabled = true;
+ this.comboBoxFuc.Location = new System.Drawing.Point(592, 76);
+ this.comboBoxFuc.Name = "comboBoxFuc";
+ this.comboBoxFuc.Size = new System.Drawing.Size(178, 23);
+ this.comboBoxFuc.TabIndex = 1;
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(592, 37);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(178, 23);
+ this.textBoxName.TabIndex = 2;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(524, 40);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(62, 15);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Название:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(520, 79);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(66, 15);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Факультет:";
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Location = new System.Drawing.Point(695, 118);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(75, 23);
+ this.buttonCreate.TabIndex = 5;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // buttonUpdate
+ //
+ this.buttonUpdate.Location = new System.Drawing.Point(695, 158);
+ this.buttonUpdate.Name = "buttonUpdate";
+ this.buttonUpdate.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpdate.TabIndex = 6;
+ this.buttonUpdate.Text = "Изменить";
+ this.buttonUpdate.UseVisualStyleBackColor = true;
+ this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
+ //
+ // buttonDelete
+ //
+ this.buttonDelete.Location = new System.Drawing.Point(695, 199);
+ this.buttonDelete.Name = "buttonDelete";
+ this.buttonDelete.Size = new System.Drawing.Size(75, 23);
+ this.buttonDelete.TabIndex = 7;
+ this.buttonDelete.Text = "Удалить";
+ this.buttonDelete.UseVisualStyleBackColor = true;
+ this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
+ //
+ // FormSpecialization
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(782, 384);
+ this.Controls.Add(this.buttonDelete);
+ this.Controls.Add(this.buttonUpdate);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.textBoxName);
+ this.Controls.Add(this.comboBoxFuc);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormSpecialization";
+ this.Text = "FormSpecialization";
+ this.Load += new System.EventHandler(this.FormSpecialization_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private ComboBox comboBoxFuc;
+ private TextBox textBoxName;
+ private Label label1;
+ private Label label2;
+ private Button buttonCreate;
+ private Button buttonUpdate;
+ private Button buttonDelete;
+ }
+}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/FormSpecialization.cs b/ExamTimetable/ExamTimetable/FormSpecialization.cs
new file mode 100644
index 0000000..81d436a
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormSpecialization.cs
@@ -0,0 +1,126 @@
+using ExamTimetable_Database;
+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;
+
+namespace ExamTimetable_Forms
+{
+ public partial class FormSpecialization : Form
+ {
+ private Abstractions bd;
+ public FormSpecialization(Abstractions _bd)
+ {
+ InitializeComponent();
+ bd = _bd;
+ }
+ private void loadData()
+ {
+ List specializations = bd.GetSpecializations();
+
+ // Очищаем dataGridView перед заполнением новыми данными
+ dataGridView.Rows.Clear();
+
+ // Предварительно определяем столбцы, если это не было сделано ранее
+ if (dataGridView.ColumnCount == 0)
+ {
+ dataGridView.Columns.Add("Id", "ID");
+ dataGridView.Columns.Add("Name", "Название");
+ dataGridView.Columns.Add("Fuc", "Факультет");
+ }
+
+ // Заполняем dataGridView данными из списка моделей автомобилей
+ foreach (Specialization specialization in specializations)
+ {
+ dataGridView.Rows.Add(specialization.spec_id, specialization.spec_name, bd.GetFacultyById(specialization.fuc_id).faculty_name);
+ }
+ }
+
+
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ // Создаем новый объект с данными из текстовых полей и комбо-бокса
+ Specialization newSpecialization = new Specialization
+ {
+ spec_name = textBoxName.Text,
+ fuc_id = ((helpCombobox)comboBoxFuc.SelectedItem).Id
+ };
+
+ // Добавляем новый факультет в базу данных
+ bd.AddSpecialization(newSpecialization);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonUpdate_Click(object sender, EventArgs e)
+ {
+ // Получаем Id выбранной строки
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Создаем объект CarModel с обновленными данными из текстовых полей и комбо-бокса
+ Specialization updatedSpecialization = new Specialization
+ {
+ spec_id = selectedRowId,
+ spec_name = textBoxName.Text,
+ fuc_id = ((helpCombobox)comboBoxFuc.SelectedItem).Id
+ };
+
+ // Обновляем модель автомобиля в базе данных
+ bd.UpdateSpecialization(updatedSpecialization);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void buttonDelete_Click(object sender, EventArgs e)
+ {
+ // Получаем Id выбранной строки
+ int selectedRowId = (int)dataGridView.SelectedRows[0].Cells["Id"].Value;
+
+ // Удаляем факультет из базы данных
+ bd.DeleteSpecialization(selectedRowId);
+
+ // Перезагружаем данные в таблицу
+ loadData();
+ }
+
+ private void FormSpecialization_Load(object sender, EventArgs e)
+ {
+ loadData();
+ }
+
+ private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex >= 0)
+ {
+ DataGridViewRow row = dataGridView.Rows[e.RowIndex];
+
+ // Заполняем текстовые поля данными из выбранной строки
+ textBoxName.Text = row.Cells["Name"].Value.ToString();
+
+ // Получаем значение из выбранной строки
+ string selectedFuc = row.Cells["Fuc"].Value.ToString();
+
+ // Загружаем список в комбо-бокс
+ comboBoxFuc.DataSource = bd.GetFaculties()
+ .Select(x => new helpCombobox()
+ {
+ Text = bd.GetFacultyById(x.faculty_id).faculty_name,
+ Id = x.faculty_id
+ })
+ .ToList();
+ comboBoxFuc.DisplayMember = "Text";
+ comboBoxFuc.ValueMember = "Id";
+
+ // Выбираем универ, который соответствует выбранному значению в строке
+ comboBoxFuc.SelectedItem = selectedFuc;
+ }
+ }
+ }
+}
diff --git a/ExamTimetable/ExamTimetable/FormSpecialization.resx b/ExamTimetable/ExamTimetable/FormSpecialization.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormSpecialization.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/ExamTimetable/ExamTimetable/FormUniversity.Designer.cs b/ExamTimetable/ExamTimetable/FormUniversity.Designer.cs
new file mode 100644
index 0000000..208bc3d
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormUniversity.Designer.cs
@@ -0,0 +1,191 @@
+namespace ExamTimetable_Forms
+{
+ partial class FormUniversity
+ {
+ ///
+ /// 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.dataGridView = new System.Windows.Forms.DataGridView();
+ this.textBoxName = new System.Windows.Forms.TextBox();
+ this.textBoxAddress = new System.Windows.Forms.TextBox();
+ this.textBoxPhone = new System.Windows.Forms.TextBox();
+ this.textBoxEmail = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonUpdate = new System.Windows.Forms.Button();
+ this.buttonDelete = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+ this.SuspendLayout();
+ //
+ // dataGridView
+ //
+ this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+ this.dataGridView.Location = new System.Drawing.Point(12, 12);
+ this.dataGridView.Name = "dataGridView";
+ this.dataGridView.RowTemplate.Height = 25;
+ this.dataGridView.Size = new System.Drawing.Size(496, 390);
+ this.dataGridView.TabIndex = 0;
+ this.dataGridView.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView_CellClick);
+ //
+ // textBoxName
+ //
+ this.textBoxName.Location = new System.Drawing.Point(617, 26);
+ this.textBoxName.Name = "textBoxName";
+ this.textBoxName.Size = new System.Drawing.Size(177, 23);
+ this.textBoxName.TabIndex = 1;
+ //
+ // textBoxAddress
+ //
+ this.textBoxAddress.Location = new System.Drawing.Point(617, 64);
+ this.textBoxAddress.Name = "textBoxAddress";
+ this.textBoxAddress.Size = new System.Drawing.Size(177, 23);
+ this.textBoxAddress.TabIndex = 2;
+ //
+ // textBoxPhone
+ //
+ this.textBoxPhone.Location = new System.Drawing.Point(617, 104);
+ this.textBoxPhone.Name = "textBoxPhone";
+ this.textBoxPhone.Size = new System.Drawing.Size(177, 23);
+ this.textBoxPhone.TabIndex = 3;
+ //
+ // textBoxEmail
+ //
+ this.textBoxEmail.Location = new System.Drawing.Point(617, 144);
+ this.textBoxEmail.Name = "textBoxEmail";
+ this.textBoxEmail.Size = new System.Drawing.Size(177, 23);
+ this.textBoxEmail.TabIndex = 4;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(545, 29);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(62, 15);
+ this.label1.TabIndex = 5;
+ this.label1.Text = "Название:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(555, 67);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(43, 15);
+ this.label2.TabIndex = 6;
+ this.label2.Text = "Адрес:";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(545, 107);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(58, 15);
+ this.label3.TabIndex = 7;
+ this.label3.Text = "Телефон:";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(555, 152);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(39, 15);
+ this.label4.TabIndex = 8;
+ this.label4.Text = "Email:";
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Location = new System.Drawing.Point(719, 185);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(75, 23);
+ this.buttonCreate.TabIndex = 9;
+ this.buttonCreate.Text = "Создать";
+ this.buttonCreate.UseVisualStyleBackColor = true;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // buttonUpdate
+ //
+ this.buttonUpdate.Location = new System.Drawing.Point(719, 223);
+ this.buttonUpdate.Name = "buttonUpdate";
+ this.buttonUpdate.Size = new System.Drawing.Size(75, 23);
+ this.buttonUpdate.TabIndex = 10;
+ this.buttonUpdate.Text = "Изменить";
+ this.buttonUpdate.UseVisualStyleBackColor = true;
+ this.buttonUpdate.Click += new System.EventHandler(this.buttonUpdate_Click);
+ //
+ // buttonDelete
+ //
+ this.buttonDelete.Location = new System.Drawing.Point(719, 263);
+ this.buttonDelete.Name = "buttonDelete";
+ this.buttonDelete.Size = new System.Drawing.Size(75, 23);
+ this.buttonDelete.TabIndex = 11;
+ this.buttonDelete.Text = "Удалить";
+ this.buttonDelete.UseVisualStyleBackColor = true;
+ this.buttonDelete.Click += new System.EventHandler(this.buttonDelete_Click);
+ //
+ // FormUniversity
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(806, 414);
+ this.Controls.Add(this.buttonDelete);
+ this.Controls.Add(this.buttonUpdate);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.textBoxEmail);
+ this.Controls.Add(this.textBoxPhone);
+ this.Controls.Add(this.textBoxAddress);
+ this.Controls.Add(this.textBoxName);
+ this.Controls.Add(this.dataGridView);
+ this.Name = "FormUniversity";
+ this.Text = "FormUniversity";
+ this.Load += new System.EventHandler(this.FormUniversity_Load);
+ ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private DataGridView dataGridView;
+ private TextBox textBoxName;
+ private TextBox textBoxAddress;
+ private TextBox textBoxPhone;
+ private TextBox textBoxEmail;
+ private Label label1;
+ private Label label2;
+ private Label label3;
+ private Label label4;
+ private Button buttonCreate;
+ private Button buttonUpdate;
+ private Button buttonDelete;
+ }
+}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable/FormUniversity.cs b/ExamTimetable/ExamTimetable/FormUniversity.cs
new file mode 100644
index 0000000..8345165
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormUniversity.cs
@@ -0,0 +1,135 @@
+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 ExamTimetable_Database;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement.TreeView;
+
+namespace ExamTimetable_Forms
+{
+ public partial class FormUniversity : Form
+ {
+ private Abstractions bd;
+ public FormUniversity(Abstractions _bd)
+ {
+ InitializeComponent();
+ bd = _bd;
+ }
+
+ private void loadData()
+ {
+ // Получаем список
+ List univers = bd.GetUniversities();
+
+ // Очищаем dataGridView перед заполнением новыми данными
+ dataGridView.Rows.Clear();
+
+ // Предварительно определяем столбцы, если это не было сделано ранее
+ if (dataGridView.ColumnCount == 0)
+ {
+ dataGridView.Columns.Add("Id", "ID");
+ dataGridView.Columns.Add("Name", "Название");
+ dataGridView.Columns.Add("Address", "Адрес");
+ dataGridView.Columns.Add("Phone", "Номер");
+ dataGridView.Columns.Add("Email", "Email");
+ }
+
+ // Заполняем dataGridView данными из списка
+ foreach (University univer in univers)
+ {
+ dataGridView.Rows.Add(univer.univer_id, univer.univer_name, univer.univer_adress, univer.phone_number, univer.email_addr);
+ }
+
+ }
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ // Создаем новый объект и заполняем его данными из текстовых полей
+ University newUniversity = new University
+ {
+ univer_name = textBoxName.Text,
+ univer_adress = textBoxAddress.Text,
+ phone_number = textBoxPhone.Text,
+ email_addr = textBoxEmail.Text
+ };
+
+ // Вызываем метод добавления нового универа в базу данных
+ bd.AddUniversity(newUniversity);
+
+ // Перезагружаем данные в dataGridView
+ loadData();
+ }
+
+ private void buttonUpdate_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count > 0)
+ {
+ // Получаем выбранный филиал из dataGridView
+ DataGridViewRow selectedRow = dataGridView.SelectedRows[0];
+ int univerId = Convert.ToInt32(selectedRow.Cells["Id"].Value);
+
+ // Создаем объект с обновленными данными из текстовых полей
+ University updatedUniver = new University
+ {
+ univer_id = univerId,
+ univer_name = textBoxName.Text,
+ univer_adress = textBoxAddress.Text,
+ phone_number = textBoxPhone.Text,
+ email_addr = textBoxEmail.Text
+ };
+
+ // Вызываем метод обновления в базе данных
+ bd.UpdateUniversity(updatedUniver);
+
+ // Перезагружаем данные в dataGridView
+ loadData();
+ }
+ else
+ {
+ MessageBox.Show("Please select an univer to update.");
+ }
+ }
+
+ private void buttonDelete_Click(object sender, EventArgs e)
+ {
+ if (dataGridView.SelectedRows.Count > 0)
+ {
+ // Получаем выбранный филиал из dataGridView
+ DataGridViewRow selectedRow = dataGridView.SelectedRows[0];
+ int univerId = Convert.ToInt32(selectedRow.Cells["Id"].Value);
+
+ // Вызываем метод удаления филиала из базы данных
+ bd.DeleteUniversity(univerId);
+
+ // Перезагружаем данные в dataGridView
+ loadData();
+ }
+ else
+ {
+ MessageBox.Show("Please select a univer to delete.");
+ }
+ }
+
+ private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
+ {
+ if (e.RowIndex >= 0)
+ {
+ DataGridViewRow row = dataGridView.Rows[e.RowIndex];
+
+ textBoxName.Text = row.Cells["Name"].Value.ToString();
+ textBoxAddress.Text = row.Cells["Address"].Value.ToString();
+ textBoxPhone.Text = row.Cells["Phone"].Value.ToString();
+ textBoxEmail.Text = row.Cells["Email"].Value.ToString();
+ }
+ }
+
+ private void FormUniversity_Load(object sender, EventArgs e)
+ {
+ loadData();
+ }
+ }
+}
diff --git a/ExamTimetable/ExamTimetable/FormUniversity.resx b/ExamTimetable/ExamTimetable/FormUniversity.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/ExamTimetable/ExamTimetable/FormUniversity.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/ExamTimetable/ExamTimetable/Program.cs b/ExamTimetable/ExamTimetable/Program.cs
index 8be64be..f854714 100644
--- a/ExamTimetable/ExamTimetable/Program.cs
+++ b/ExamTimetable/ExamTimetable/Program.cs
@@ -1,7 +1,14 @@
+using ExamTimetable_Database;
+using ExamTimetable_Forms;
+using Microsoft.Extensions.DependencyInjection;
+using static System.Windows.Forms.DataFormats;
+
namespace ExamTimetable
{
internal static class Program
{
+ private static ServiceProvider? _serviceProvider;
+ public static ServiceProvider? ServiceProvider => _serviceProvider;
///
/// The main entry point for the application.
///
@@ -11,7 +18,20 @@ namespace ExamTimetable
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
- Application.Run(new Form1());
+ var services = new ServiceCollection();
+ ConfigureServices(services);
+ _serviceProvider = services.BuildServiceProvider();
+ Application.Run(_serviceProvider.GetRequiredService());
+ }
+ private static void ConfigureServices(ServiceCollection services)
+ {
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
+ services.AddTransient();
}
}
}
\ No newline at end of file
diff --git a/ExamTimetable/ExamTimetable_Database/Entity_models.cs b/ExamTimetable/ExamTimetable_Database/Entity_models.cs
index 4ae6b44..df07840 100644
--- a/ExamTimetable/ExamTimetable_Database/Entity_models.cs
+++ b/ExamTimetable/ExamTimetable_Database/Entity_models.cs
@@ -36,4 +36,9 @@ namespace ExamTimetable_Database
public int com_id { get; set; }
public DateTime exam_time { get; set; }
}
+ public class helpCombobox
+ {
+ public string Text { get; set; }
+ public int Id { get; set; }
+ }
}
diff --git a/ExamTimetable/ExamTimetable_Database/ExamTimetable_Database.csproj b/ExamTimetable/ExamTimetable_Database/ExamTimetable_Database.csproj
index 132c02c..715d83b 100644
--- a/ExamTimetable/ExamTimetable_Database/ExamTimetable_Database.csproj
+++ b/ExamTimetable/ExamTimetable_Database/ExamTimetable_Database.csproj
@@ -6,4 +6,8 @@
enable
+
+
+
+