формы и правки
This commit is contained in:
parent
31a881056d
commit
b7b255ea9e
@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.4.33122.133
|
VisualStudioVersion = 17.4.33122.133
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
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
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{073BFD8D-BE81-4F92-963C-F36385B2337C}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -8,4 +8,12 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\ExamTimetable_Database\ExamTimetable_Database.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
39
ExamTimetable/ExamTimetable/Form1.Designer.cs
generated
39
ExamTimetable/ExamTimetable/Form1.Designer.cs
generated
@ -1,39 +0,0 @@
|
|||||||
namespace ExamTimetable
|
|
||||||
{
|
|
||||||
partial class Form1
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Required designer variable.
|
|
||||||
/// </summary>
|
|
||||||
private System.ComponentModel.IContainer components = null;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Clean up any resources being used.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
|
||||||
protected override void Dispose(bool disposing)
|
|
||||||
{
|
|
||||||
if (disposing && (components != null))
|
|
||||||
{
|
|
||||||
components.Dispose();
|
|
||||||
}
|
|
||||||
base.Dispose(disposing);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Required method for Designer support - do not modify
|
|
||||||
/// the contents of this method with the code editor.
|
|
||||||
/// </summary>
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
namespace ExamTimetable
|
|
||||||
{
|
|
||||||
public partial class Form1 : Form
|
|
||||||
{
|
|
||||||
public Form1()
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,120 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:choice maxOccurs="unbounded">
|
|
||||||
<xsd:element name="metadata">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="assembly">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:attribute name="alias" type="xsd:string" />
|
|
||||||
<xsd:attribute name="name" type="xsd:string" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="data">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
|
||||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
|
||||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
|
||||||
<xsd:attribute ref="xml:space" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
<xsd:element name="resheader">
|
|
||||||
<xsd:complexType>
|
|
||||||
<xsd:sequence>
|
|
||||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
|
||||||
</xsd:sequence>
|
|
||||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:choice>
|
|
||||||
</xsd:complexType>
|
|
||||||
</xsd:element>
|
|
||||||
</xsd:schema>
|
|
||||||
<resheader name="resmimetype">
|
|
||||||
<value>text/microsoft-resx</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="version">
|
|
||||||
<value>2.0</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="reader">
|
|
||||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
<resheader name="writer">
|
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
|
||||||
</resheader>
|
|
||||||
</root>
|
|
148
ExamTimetable/ExamTimetable/FormComission.Designer.cs
generated
Normal file
148
ExamTimetable/ExamTimetable/FormComission.Designer.cs
generated
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
namespace ExamTimetable_Forms
|
||||||
|
{
|
||||||
|
partial class FormComission
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
}
|
126
ExamTimetable/ExamTimetable/FormComission.cs
Normal file
126
ExamTimetable/ExamTimetable/FormComission.cs
Normal file
@ -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<Comission> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
ExamTimetable/ExamTimetable/FormComission.resx
Normal file
60
ExamTimetable/ExamTimetable/FormComission.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
192
ExamTimetable/ExamTimetable/FormExam.Designer.cs
generated
Normal file
192
ExamTimetable/ExamTimetable/FormExam.Designer.cs
generated
Normal file
@ -0,0 +1,192 @@
|
|||||||
|
namespace ExamTimetable_Forms
|
||||||
|
{
|
||||||
|
partial class FormExam
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
}
|
134
ExamTimetable/ExamTimetable/FormExam.cs
Normal file
134
ExamTimetable/ExamTimetable/FormExam.cs
Normal file
@ -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<Exam> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
ExamTimetable/ExamTimetable/FormExam.resx
Normal file
60
ExamTimetable/ExamTimetable/FormExam.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
148
ExamTimetable/ExamTimetable/FormFaculty.Designer.cs
generated
Normal file
148
ExamTimetable/ExamTimetable/FormFaculty.Designer.cs
generated
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
namespace ExamTimetable_Forms
|
||||||
|
{
|
||||||
|
partial class FormFaculty
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
126
ExamTimetable/ExamTimetable/FormFaculty.cs
Normal file
126
ExamTimetable/ExamTimetable/FormFaculty.cs
Normal file
@ -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<Faculty> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
ExamTimetable/ExamTimetable/FormFaculty.resx
Normal file
60
ExamTimetable/ExamTimetable/FormFaculty.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
136
ExamTimetable/ExamTimetable/FormMain.Designer.cs
generated
Normal file
136
ExamTimetable/ExamTimetable/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,136 @@
|
|||||||
|
namespace ExamTimetable
|
||||||
|
{
|
||||||
|
partial class FormMain
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
74
ExamTimetable/ExamTimetable/FormMain.cs
Normal file
74
ExamTimetable/ExamTimetable/FormMain.cs
Normal file
@ -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} ìèëëèñåêóíä";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
ExamTimetable/ExamTimetable/FormMain.resx
Normal file
60
ExamTimetable/ExamTimetable/FormMain.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
148
ExamTimetable/ExamTimetable/FormSpecialization.Designer.cs
generated
Normal file
148
ExamTimetable/ExamTimetable/FormSpecialization.Designer.cs
generated
Normal file
@ -0,0 +1,148 @@
|
|||||||
|
namespace ExamTimetable_Forms
|
||||||
|
{
|
||||||
|
partial class FormSpecialization
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </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();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
}
|
126
ExamTimetable/ExamTimetable/FormSpecialization.cs
Normal file
126
ExamTimetable/ExamTimetable/FormSpecialization.cs
Normal file
@ -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<Specialization> 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
ExamTimetable/ExamTimetable/FormSpecialization.resx
Normal file
60
ExamTimetable/ExamTimetable/FormSpecialization.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
191
ExamTimetable/ExamTimetable/FormUniversity.Designer.cs
generated
Normal file
191
ExamTimetable/ExamTimetable/FormUniversity.Designer.cs
generated
Normal file
@ -0,0 +1,191 @@
|
|||||||
|
namespace ExamTimetable_Forms
|
||||||
|
{
|
||||||
|
partial class FormUniversity
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Required designer variable.
|
||||||
|
/// </summary>
|
||||||
|
private System.ComponentModel.IContainer components = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean up any resources being used.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (disposing && (components != null))
|
||||||
|
{
|
||||||
|
components.Dispose();
|
||||||
|
}
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Required method for Designer support - do not modify
|
||||||
|
/// the contents of this method with the code editor.
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
135
ExamTimetable/ExamTimetable/FormUniversity.cs
Normal file
135
ExamTimetable/ExamTimetable/FormUniversity.cs
Normal file
@ -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<University> 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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
60
ExamTimetable/ExamTimetable/FormUniversity.resx
Normal file
60
ExamTimetable/ExamTimetable/FormUniversity.resx
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<root>
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="metadata">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="assembly">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:attribute name="alias" type="xsd:string" />
|
||||||
|
<xsd:attribute name="name" type="xsd:string" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
<xsd:attribute ref="xml:space" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -1,7 +1,14 @@
|
|||||||
|
using ExamTimetable_Database;
|
||||||
|
using ExamTimetable_Forms;
|
||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using static System.Windows.Forms.DataFormats;
|
||||||
|
|
||||||
namespace ExamTimetable
|
namespace ExamTimetable
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
private static ServiceProvider? _serviceProvider;
|
||||||
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -11,7 +18,20 @@ namespace ExamTimetable
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
Application.Run(new Form1());
|
var services = new ServiceCollection();
|
||||||
|
ConfigureServices(services);
|
||||||
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
|
}
|
||||||
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
|
{
|
||||||
|
services.AddTransient<Abstractions, Implementation>();
|
||||||
|
services.AddTransient<FormMain>();
|
||||||
|
services.AddTransient<FormUniversity>();
|
||||||
|
services.AddTransient<FormFaculty>();
|
||||||
|
services.AddTransient<FormSpecialization>();
|
||||||
|
services.AddTransient<FormComission>();
|
||||||
|
services.AddTransient<FormExam>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -36,4 +36,9 @@ namespace ExamTimetable_Database
|
|||||||
public int com_id { get; set; }
|
public int com_id { get; set; }
|
||||||
public DateTime exam_time { get; set; }
|
public DateTime exam_time { get; set; }
|
||||||
}
|
}
|
||||||
|
public class helpCombobox
|
||||||
|
{
|
||||||
|
public string Text { get; set; }
|
||||||
|
public int Id { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,8 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Npgsql" Version="8.0.2" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
Loading…
Reference in New Issue
Block a user