урааа

This commit is contained in:
AnnaLioness 2024-04-22 17:01:52 +04:00
parent a38c5d258b
commit 8bd5ec7e01
8 changed files with 432 additions and 398 deletions

View File

@ -28,109 +28,111 @@
/// </summary>
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();
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.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
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();
}

View File

@ -33,9 +33,19 @@ namespace ExamTimetable_Forms
dataGridView.Columns.Add("Teachers", "Преподавательский состав");
dataGridView.Columns.Add("Fuc", "Факультет");
}
// Загружаем список в комбо-бокс
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";
// Заполняем dataGridView данными из списка моделей автомобилей
foreach (Comission сomission in comissions)
// Заполняем dataGridView данными из списка моделей автомобилей
foreach (Comission сomission in comissions)
{
dataGridView.Rows.Add(сomission.comm_id, сomission.teaching_stuff, bd.GetFacultyById(сomission.fu_id).faculty_name);
}
@ -107,16 +117,7 @@ namespace ExamTimetable_Forms
// Получаем значение из выбранной строки
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;

View File

@ -28,156 +28,178 @@
/// </summary>
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();
this.dataGridView = new System.Windows.Forms.DataGridView();
this.textBoxDate = 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();
this.textBoxTime = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
//
// dataGridView
//
this.dataGridView.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
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);
//
// textBoxDate
//
this.textBoxDate.Location = new System.Drawing.Point(647, 12);
this.textBoxDate.Name = "textBoxDate";
this.textBoxDate.Size = new System.Drawing.Size(141, 23);
this.textBoxDate.TabIndex = 1;
//
// textBoxPlace
//
this.textBoxPlace.Location = new System.Drawing.Point(647, 113);
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, 158);
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, 211);
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(589, 15);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 15);
this.label1.TabIndex = 6;
this.label1.Text = "Дата:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(589, 121);
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, 166);
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, 211);
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, 256);
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, 301);
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, 339);
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);
//
// textBoxTime
//
this.textBoxTime.Location = new System.Drawing.Point(647, 60);
this.textBoxTime.Name = "textBoxTime";
this.textBoxTime.Size = new System.Drawing.Size(141, 23);
this.textBoxTime.TabIndex = 13;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(589, 68);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(45, 15);
this.label5.TabIndex = 14;
this.label5.Text = "Время:";
//
// 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.label5);
this.Controls.Add(this.textBoxTime);
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.textBoxDate);
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 textBoxDate;
private TextBox textBoxPlace;
private TextBox textBoxSubject;
private ComboBox comboBoxCom;
@ -188,5 +210,7 @@
private Button buttonCreate;
private Button buttonUpdate;
private Button buttonDelete;
}
private TextBox textBoxTime;
private Label label5;
}
}

View File

@ -30,16 +30,27 @@ namespace ExamTimetable_Forms
if (dataGridView.ColumnCount == 0)
{
dataGridView.Columns.Add("Id", "ID");
dataGridView.Columns.Add("DateTime", "Дата и время");
dataGridView.Columns.Add("Place", "Место");
dataGridView.Columns.Add("Date", "Дата");
dataGridView.Columns.Add("Time", "Время");
dataGridView.Columns.Add("Place", "Место");
dataGridView.Columns.Add("Subject", "Предмет");
dataGridView.Columns.Add("Comm", "Комиссия");
}
// Загружаем список в комбо-бокс
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";
// Заполняем dataGridView данными из списка моделей автомобилей
foreach (Exam exam in exams)
// Заполняем 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);
dataGridView.Rows.Add(exam.exam_id, exam.exam_date.ToString().Split(" ")[0], exam.exam_time, exam.exam_place, exam.exam_subject, bd.GetComissionById(exam.com_id).teaching_stuff);
}
}
@ -48,11 +59,11 @@ namespace ExamTimetable_Forms
// Создаем новый объект с данными из текстовых полей и комбо-бокса
Exam newExam = new Exam
{
exam_date = DateTime.Parse(textBoxDateTime.Text),
exam_date = DateTime.Parse(textBoxDate.Text + " 00:00:00"),
exam_place = textBoxPlace.Text,
exam_subject = textBoxSubject.Text,
com_id = ((helpCombobox)comboBoxCom.SelectedItem).Id,
exam_time = DateTime.Parse(textBoxDateTime.Text)
exam_time = TimeSpan.Parse(textBoxTime.Text)
};
// Добавляем новый факультет в базу данных
@ -70,11 +81,11 @@ namespace ExamTimetable_Forms
Exam updatedExam = new Exam
{
exam_id = selectedRowId,
exam_date = DateTime.Parse(textBoxDateTime.Text),
exam_date = DateTime.Parse(textBoxDate.Text + " 00:00:00"),
exam_place = textBoxPlace.Text,
exam_subject = textBoxSubject.Text,
com_id = ((helpCombobox)comboBoxCom.SelectedItem).Id,
exam_time = DateTime.Parse(textBoxDateTime.Text)
exam_time = TimeSpan.Parse(textBoxTime.Text)
};
// Обновляем модель автомобиля в базе данных
@ -108,23 +119,15 @@ namespace ExamTimetable_Forms
DataGridViewRow row = dataGridView.Rows[e.RowIndex];
// Заполняем текстовые поля данными из выбранной строки
textBoxDateTime.Text = row.Cells["Date"].Value.ToString();
textBoxDate.Text = row.Cells["Date"].Value.ToString().Split(" ")[0];
textBoxTime.Text= row.Cells["Time"].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;

View File

@ -28,109 +28,111 @@
/// </summary>
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();
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.AllowUserToAddRows = false;
this.dataGridView.AllowUserToDeleteRows = false;
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();
}

View File

@ -34,8 +34,19 @@ namespace ExamTimetable_Forms
dataGridView.Columns.Add("Fuc", "Факультет");
}
// Заполняем dataGridView данными из списка моделей автомобилей
foreach (Specialization specialization in specializations)
// Загружаем список в комбо-бокс
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";
// Заполняем dataGridView данными из списка моделей автомобилей
foreach (Specialization specialization in specializations)
{
dataGridView.Rows.Add(specialization.spec_id, specialization.spec_name, bd.GetFacultyById(specialization.fuc_id).faculty_name);
}
@ -107,16 +118,6 @@ namespace ExamTimetable_Forms
// Получаем значение из выбранной строки
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;

View File

@ -34,7 +34,7 @@ namespace ExamTimetable_Database
public string exam_place { get; set; }
public string exam_subject { get; set; }
public int com_id { get; set; }
public DateTime exam_time { get; set; }
public TimeSpan exam_time { get; set; }
}
public class helpCombobox
{

View File

@ -276,6 +276,7 @@ namespace ExamTimetable_Database
conn.Open();
using var cmd = new NpgsqlCommand("SELECT * FROM exam", conn);
using var reader = cmd.ExecuteReader();
var aboba = reader.GetDataTypeName(1);
while (reader.Read())
{
exams.Add(new Exam
@ -285,7 +286,7 @@ namespace ExamTimetable_Database
exam_place = reader.GetString(2),
exam_subject = reader.GetString(3),
com_id = reader.GetInt32(4),
exam_time = reader.GetDateTime(5)
exam_time = reader.GetTimeSpan(5)
});
}
return exams;
@ -305,7 +306,7 @@ namespace ExamTimetable_Database
exam_place = reader.GetString(2),
exam_subject = reader.GetString(3),
com_id = reader.GetInt32(4),
exam_time = reader.GetDateTime(5)
exam_time = reader.GetTimeSpan(5)
};
}
return null;