Завершение работы с формами
This commit is contained in:
parent
c90f675d67
commit
f1703099c7
@ -98,14 +98,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic
|
||||
}
|
||||
|
||||
_logger.LogInformation("Discipline. Title:{Title}.Id:{Id}", model.Title, model.Id);
|
||||
var element = _disciplineStorage.GetElement(new DisciplineSearchModel
|
||||
{
|
||||
Title = model.Title
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Дисциплина с таким названием уже есть");
|
||||
}
|
||||
//var element = _disciplineStorage.GetElement(new DisciplineSearchModel
|
||||
//{
|
||||
// Title = model.Title
|
||||
//});
|
||||
//if (element != null && element.Id != model.Id)
|
||||
//{
|
||||
// throw new InvalidOperationException("Дисциплина с таким названием уже есть");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,14 +98,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic
|
||||
}
|
||||
|
||||
_logger.LogInformation("Group. Title:{Title}.Id:{Id}", model.Title, model.Id);
|
||||
var element = _groupStorage.GetElement(new GroupSearchModel
|
||||
{
|
||||
Title = model.Title
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Группа с таким названием уже есть");
|
||||
}
|
||||
//var element = _groupStorage.GetElement(new GroupSearchModel
|
||||
//{
|
||||
// Title = model.Title
|
||||
//});
|
||||
//if (element != null && element.Id != model.Id)
|
||||
//{
|
||||
// throw new InvalidOperationException("Группа с таким названием уже есть");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -96,14 +96,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic
|
||||
|
||||
_logger.LogInformation("Student. Name:{Name}.GroupId:{GroupId}.Id:{Id}",
|
||||
model.Name, model.GroupId, model.Id);
|
||||
var element = _studentStorage.GetElement(new StudentSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Студент с таким именем уже есть");
|
||||
}
|
||||
//var element = _studentStorage.GetElement(new StudentSearchModel
|
||||
//{
|
||||
// Name = model.Name
|
||||
//});
|
||||
//if (element != null && element.Id != model.Id)
|
||||
//{
|
||||
// throw new InvalidOperationException("Студент с таким именем уже есть");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,14 +98,14 @@ namespace ElectronicJournalBusinessLogic.BusinessLogic
|
||||
}
|
||||
|
||||
_logger.LogInformation("Teacher. Name:{Name}.Id:{Id}", model.Name, model.Id);
|
||||
var element = _teacherStorage.GetElement(new TeacherSearchModel
|
||||
{
|
||||
Name = model.Name
|
||||
});
|
||||
if (element != null && element.Id != model.Id)
|
||||
{
|
||||
throw new InvalidOperationException("Преподаватель с таким именем уже есть");
|
||||
}
|
||||
//var element = _teacherStorage.GetElement(new TeacherSearchModel
|
||||
//{
|
||||
// Name = model.Name
|
||||
//});
|
||||
//if (element != null && element.Id != model.Id)
|
||||
//{
|
||||
// throw new InvalidOperationException("Преподаватель с таким именем уже есть");
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
39
SUBD/SUBD/FormElectronicJournal.Designer.cs
generated
39
SUBD/SUBD/FormElectronicJournal.Designer.cs
generated
@ -1,39 +0,0 @@
|
||||
namespace SUBD
|
||||
{
|
||||
partial class FormElectronicJournal
|
||||
{
|
||||
/// <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 SUBD
|
||||
{
|
||||
public partial class FormElectronicJournal : Form
|
||||
{
|
||||
public FormElectronicJournal()
|
||||
{
|
||||
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>
|
137
SUBD/SUBD/FormMain.Designer.cs
generated
Normal file
137
SUBD/SUBD/FormMain.Designer.cs
generated
Normal file
@ -0,0 +1,137 @@
|
||||
namespace SUBD
|
||||
{
|
||||
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()
|
||||
{
|
||||
buttonDiscipline = new Button();
|
||||
buttonTeacher = new Button();
|
||||
buttonGroup = new Button();
|
||||
buttonStudent = new Button();
|
||||
buttonStatement = new Button();
|
||||
buttonResultOfControl = new Button();
|
||||
buttonGenerate = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// buttonDiscipline
|
||||
//
|
||||
buttonDiscipline.Location = new Point(12, 12);
|
||||
buttonDiscipline.Name = "buttonDiscipline";
|
||||
buttonDiscipline.Size = new Size(149, 67);
|
||||
buttonDiscipline.TabIndex = 0;
|
||||
buttonDiscipline.Text = "Дисциплины";
|
||||
buttonDiscipline.UseVisualStyleBackColor = true;
|
||||
buttonDiscipline.Click += buttonDiscipline_Click;
|
||||
//
|
||||
// buttonTeacher
|
||||
//
|
||||
buttonTeacher.Location = new Point(167, 12);
|
||||
buttonTeacher.Name = "buttonTeacher";
|
||||
buttonTeacher.Size = new Size(149, 67);
|
||||
buttonTeacher.TabIndex = 1;
|
||||
buttonTeacher.Text = "Преподаватели";
|
||||
buttonTeacher.UseVisualStyleBackColor = true;
|
||||
buttonTeacher.Click += buttonTeacher_Click;
|
||||
//
|
||||
// buttonGroup
|
||||
//
|
||||
buttonGroup.Location = new Point(322, 12);
|
||||
buttonGroup.Name = "buttonGroup";
|
||||
buttonGroup.Size = new Size(149, 67);
|
||||
buttonGroup.TabIndex = 2;
|
||||
buttonGroup.Text = "Группы";
|
||||
buttonGroup.UseVisualStyleBackColor = true;
|
||||
buttonGroup.Click += buttonGroup_Click;
|
||||
//
|
||||
// buttonStudent
|
||||
//
|
||||
buttonStudent.Location = new Point(12, 85);
|
||||
buttonStudent.Name = "buttonStudent";
|
||||
buttonStudent.Size = new Size(149, 67);
|
||||
buttonStudent.TabIndex = 3;
|
||||
buttonStudent.Text = "Студенты";
|
||||
buttonStudent.UseVisualStyleBackColor = true;
|
||||
buttonStudent.Click += buttonStudent_Click;
|
||||
//
|
||||
// buttonStatement
|
||||
//
|
||||
buttonStatement.Location = new Point(167, 85);
|
||||
buttonStatement.Name = "buttonStatement";
|
||||
buttonStatement.Size = new Size(149, 67);
|
||||
buttonStatement.TabIndex = 4;
|
||||
buttonStatement.Text = "Ведомости";
|
||||
buttonStatement.UseVisualStyleBackColor = true;
|
||||
buttonStatement.Click += buttonStatement_Click;
|
||||
//
|
||||
// buttonResultOfControl
|
||||
//
|
||||
buttonResultOfControl.Location = new Point(322, 85);
|
||||
buttonResultOfControl.Name = "buttonResultOfControl";
|
||||
buttonResultOfControl.Size = new Size(149, 67);
|
||||
buttonResultOfControl.TabIndex = 5;
|
||||
buttonResultOfControl.Text = "Результаты контроля";
|
||||
buttonResultOfControl.UseVisualStyleBackColor = true;
|
||||
buttonResultOfControl.Click += buttonResultOfControl_Click;
|
||||
//
|
||||
// buttonGenerate
|
||||
//
|
||||
buttonGenerate.Location = new Point(167, 158);
|
||||
buttonGenerate.Name = "buttonGenerate";
|
||||
buttonGenerate.Size = new Size(149, 67);
|
||||
buttonGenerate.TabIndex = 6;
|
||||
buttonGenerate.Text = "Сгенерировать";
|
||||
buttonGenerate.UseVisualStyleBackColor = true;
|
||||
buttonGenerate.Click += buttonGenerate_Click;
|
||||
//
|
||||
// FormMain
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(486, 255);
|
||||
Controls.Add(buttonGenerate);
|
||||
Controls.Add(buttonResultOfControl);
|
||||
Controls.Add(buttonStatement);
|
||||
Controls.Add(buttonStudent);
|
||||
Controls.Add(buttonGroup);
|
||||
Controls.Add(buttonTeacher);
|
||||
Controls.Add(buttonDiscipline);
|
||||
Name = "FormMain";
|
||||
Text = "Электронный журнал";
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Button buttonDiscipline;
|
||||
private Button buttonTeacher;
|
||||
private Button buttonGroup;
|
||||
private Button buttonStudent;
|
||||
private Button buttonStatement;
|
||||
private Button buttonResultOfControl;
|
||||
private Button buttonGenerate;
|
||||
}
|
||||
}
|
80
SUBD/SUBD/FormMain.cs
Normal file
80
SUBD/SUBD/FormMain.cs
Normal file
@ -0,0 +1,80 @@
|
||||
namespace SUBD
|
||||
{
|
||||
public partial class FormMain : Form
|
||||
{
|
||||
public FormMain()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void buttonDiscipline_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormDiscipline));
|
||||
|
||||
if (service is FormDiscipline form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonTeacher_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormTeacher));
|
||||
|
||||
if (service is FormTeacher form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonGroup_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormGroup));
|
||||
|
||||
if (service is FormGroup form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonStudent_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStudent));
|
||||
|
||||
if (service is FormStudent form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonStatement_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormStatement));
|
||||
|
||||
if (service is FormStatement form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonResultOfControl_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormResultOfControl));
|
||||
|
||||
if (service is FormResultOfControl form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonGenerate_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormRandom));
|
||||
|
||||
if (service is FormRandom form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
SUBD/SUBD/FormMain.resx
Normal file
60
SUBD/SUBD/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>
|
95
SUBD/SUBD/FormRandom.Designer.cs
generated
Normal file
95
SUBD/SUBD/FormRandom.Designer.cs
generated
Normal file
@ -0,0 +1,95 @@
|
||||
namespace SUBD
|
||||
{
|
||||
partial class FormRandom
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
comboBoxWhat = new ComboBox();
|
||||
ButtonAdd = new Button();
|
||||
textBoxCount = new TextBox();
|
||||
labelTime = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxWhat
|
||||
//
|
||||
comboBoxWhat.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxWhat.FormattingEnabled = true;
|
||||
comboBoxWhat.Items.AddRange(new object[] { "Преподаватель", "Дисциплина", "Группа", "Студент", "Ведомость", "Результат" });
|
||||
comboBoxWhat.Location = new Point(111, 12);
|
||||
comboBoxWhat.Name = "comboBoxWhat";
|
||||
comboBoxWhat.Size = new Size(139, 28);
|
||||
comboBoxWhat.TabIndex = 0;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(111, 79);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(139, 29);
|
||||
ButtonAdd.TabIndex = 1;
|
||||
ButtonAdd.Text = "Добавить";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// textBoxCount
|
||||
//
|
||||
textBoxCount.Location = new Point(111, 46);
|
||||
textBoxCount.Name = "textBoxCount";
|
||||
textBoxCount.Size = new Size(139, 27);
|
||||
textBoxCount.TabIndex = 2;
|
||||
//
|
||||
// labelTime
|
||||
//
|
||||
labelTime.AutoSize = true;
|
||||
labelTime.Location = new Point(151, 111);
|
||||
labelTime.Name = "labelTime";
|
||||
labelTime.Size = new Size(54, 20);
|
||||
labelTime.TabIndex = 3;
|
||||
labelTime.Text = "Время";
|
||||
//
|
||||
// FormRandom
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(339, 140);
|
||||
Controls.Add(labelTime);
|
||||
Controls.Add(textBoxCount);
|
||||
Controls.Add(ButtonAdd);
|
||||
Controls.Add(comboBoxWhat);
|
||||
Name = "FormRandom";
|
||||
Text = "Генерация";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxWhat;
|
||||
private Button ButtonAdd;
|
||||
private TextBox textBoxCount;
|
||||
private Label labelTime;
|
||||
}
|
||||
}
|
180
SUBD/SUBD/FormRandom.cs
Normal file
180
SUBD/SUBD/FormRandom.cs
Normal file
@ -0,0 +1,180 @@
|
||||
using ElectronicJournalContracts.BindingModels;
|
||||
using ElectronicJournalContracts.BusinessLogicContracts;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SUBD
|
||||
{
|
||||
public partial class FormRandom : Form
|
||||
{
|
||||
private readonly IDisciplineLogic _Dlogic;
|
||||
private readonly ITeacherLogic _Tlogic;
|
||||
private readonly IGroupLogic _Glogic;
|
||||
private readonly IStudentLogic _STlogic;
|
||||
private readonly IStatementLogic _Slogic;
|
||||
private readonly IResultOfControlLogic _Rlogic;
|
||||
public FormRandom(IDisciplineLogic dlogic, ITeacherLogic tlogic, IGroupLogic glogic, IStudentLogic stlogic, IStatementLogic slogic, IResultOfControlLogic rlogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_Dlogic = dlogic;
|
||||
_Tlogic = tlogic;
|
||||
_Glogic = glogic;
|
||||
_STlogic = stlogic;
|
||||
_Slogic = slogic;
|
||||
_Rlogic = rlogic;
|
||||
}
|
||||
string[] names = new string[] { "Илья", "Татьяна", "Сергей", "Максим", "Владимир", "Александр", "Олег", "Анатаолий", "София", "Стела", "Аким", "Матвей", "Анисия", "Василий", "Лукьян", "Руслан", "Клара", "Андрей", "Мстислав", "Федот", "Олег", "Аркадий", "Ангелина", "Анжелика", "Стефания", "Мариам", "Дементий", "Андрон", "Даниил", "Адам", "Евдоким", "Валерий", "Дамир", "Фёдор", "Василиса", "Сафина", "Даниэль", "Дарина", "Мир", "Феофан", "Всеслава", "Инна", "Платон", "Ирина", "Рафаэль", "Милана", "Клавдий", "Лейла", "Роза", "Тимофей", "Пимен", "Модест", "Эмма", "Георгий", "Дарья", "Дмитрий", "Эрик", "Филипп", "Владилен", "Евсей", "Даниль", "Ростислав", "Тихон", "Тея", "Наум", "Виолетта", "Анатолий", "Рустам", "Юлия", "Дана", "Самсон", "Ариадна", "Ибрагим", "Светлана", "Инга", "Али", "Виталий", "Алисия", "Оксана", "Тимур", "Аида", "Камиль", "Иннокентий", "Элина", "Виктория", "Анна", "Амелия", "Япсина", "Эвелина", "Кира", "Артур", "Владлена", "Никифор", "Марина", "Артем", "Моисей", "Иван", "Лидия", "Трофим", "Игорь" };
|
||||
string[] groupName = new string[] { "ПИбд-21", "ИСЭбд-21", "ИСТбд-21", "ПСбд-21", "ИВТАбд-21", "РВбд-21", "НГбд-21", "ХТбд-21", "ПИбд-22", "ИСЭбд-22", "ИСТбд-22", "ПСбд-22", "ИВТАбд-22", "РВбд-22", "НГбд-22", "ХТбд-22", "ПИбд-23", "ИСЭбд-23", "ИСТбд-23", "ПСбд-23", "ИВТАбд-23", "РВбд-23", "НГбд-23", "ХТбд-23" };
|
||||
string[] disciplineName = new string[] { "Математический анализ", "Теория вероятности", "СУБД", "БД", "Интернет программирование", "Операционные системы", "МЛИТА", "СИТ", "РПП", "ТСЧМИ", "Технология программирования", "Физика", "ОЭВМИС", "Электротехника", "Философия", "Античная литература", "ОТС", "ОИТ", "Истормя", "Иностранный язык", "Музыка", "Археология", "Физическая культура", "Этика", "ОАИП" };
|
||||
string[] academicTitle = new string[] { "Доцент", "Профессор" };
|
||||
string[] form = new string[] { "Экзамен", "Зачет", "Курсовая", "Практика" };
|
||||
string[] mark = new string[] { "Отлично", "Хорошо", "Удовлетворительно", "Неудовлетворительно", "Зачтено", "Не зачтено" };
|
||||
Random rd = new Random();
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
switch (comboBoxWhat.SelectedItem)
|
||||
{
|
||||
case "Преподаватель":
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++)
|
||||
{
|
||||
var modelT = new TeacherBindingModel
|
||||
{
|
||||
Id = 0,
|
||||
Name = names[rd.Next(0, names.Length)],
|
||||
AcademicTitle = academicTitle[rd.Next(0, academicTitle.Length)]
|
||||
};
|
||||
_Tlogic.Create(modelT);
|
||||
}
|
||||
stopwatch.Stop();
|
||||
TimeSpan ts = stopwatch.Elapsed;
|
||||
string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
|
||||
ts.Hours, ts.Minutes, ts.Seconds,
|
||||
ts.Milliseconds / 10);
|
||||
labelTime.Text = ("RunTime " + elapsedTime);
|
||||
break;
|
||||
case "Дисциплина":
|
||||
Stopwatch stopwatch1 = new Stopwatch();
|
||||
stopwatch1.Start();
|
||||
for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++)
|
||||
{
|
||||
var modelD = new DisciplineBindingModel
|
||||
{
|
||||
Id = 0,
|
||||
Title = disciplineName[rd.Next(0, disciplineName.Length)]
|
||||
};
|
||||
_Dlogic.Create(modelD);
|
||||
}
|
||||
stopwatch1.Stop();
|
||||
TimeSpan ts1 = stopwatch1.Elapsed;
|
||||
string elapsedTime1 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
|
||||
ts1.Hours, ts1.Minutes, ts1.Seconds,
|
||||
ts1.Milliseconds / 10);
|
||||
labelTime.Text = ("RunTime " + elapsedTime1);
|
||||
break;
|
||||
case "Группа":
|
||||
Stopwatch stopwatch2 = new Stopwatch();
|
||||
stopwatch2.Start();
|
||||
for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++)
|
||||
{
|
||||
var modelG = new GroupBindingModel
|
||||
{
|
||||
Id = 0,
|
||||
Title = groupName[rd.Next(0, groupName.Length)],
|
||||
Course = rd.Next(1, 7)
|
||||
};
|
||||
_Glogic.Create(modelG);
|
||||
}
|
||||
stopwatch2.Stop();
|
||||
TimeSpan ts2 = stopwatch2.Elapsed;
|
||||
string elapsedTime2 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
|
||||
ts2.Hours, ts2.Minutes, ts2.Seconds,
|
||||
ts2.Milliseconds / 10);
|
||||
labelTime.Text = ("RunTime " + elapsedTime2);
|
||||
break;
|
||||
case "Студент":
|
||||
Stopwatch stopwatch3 = new Stopwatch();
|
||||
stopwatch3.Start();
|
||||
int grouplist = _Glogic.ReadList(null).Count();
|
||||
for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++)
|
||||
{
|
||||
var modelST = new StudentBindingModel
|
||||
{
|
||||
Id = 0,
|
||||
Name = names[rd.Next(0, names.Length)],
|
||||
GroupId = rd.Next(1, grouplist - 1)
|
||||
};
|
||||
_STlogic.Create(modelST);
|
||||
}
|
||||
stopwatch3.Stop();
|
||||
TimeSpan ts3 = stopwatch3.Elapsed;
|
||||
string elapsedTime3 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
|
||||
ts3.Hours, ts3.Minutes, ts3.Seconds,
|
||||
ts3.Milliseconds / 10);
|
||||
labelTime.Text = ("RunTime " + elapsedTime3);
|
||||
break;
|
||||
case "Ведомость":
|
||||
Stopwatch stopwatch4 = new Stopwatch();
|
||||
stopwatch4.Start();
|
||||
int teachlist = _Tlogic.ReadList(null).Count();
|
||||
int grouplist1 = _Glogic.ReadList(null).Count();
|
||||
int disciplinelist = _Dlogic.ReadList(null).Count();
|
||||
for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++)
|
||||
{
|
||||
var modelS = new StatementBindingModel
|
||||
{
|
||||
Id = 0,
|
||||
Date = DateOnly.FromDateTime(DateTime.Now),
|
||||
DisciplineId = rd.Next(1, disciplinelist),
|
||||
GroupId = rd.Next(1, grouplist1),
|
||||
TeacherId = rd.Next(1, teachlist)
|
||||
};
|
||||
_Slogic.Create(modelS);
|
||||
}
|
||||
stopwatch4.Stop();
|
||||
TimeSpan ts4 = stopwatch4.Elapsed;
|
||||
string elapsedTime4 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
|
||||
ts4.Hours, ts4.Minutes, ts4.Seconds,
|
||||
ts4.Milliseconds / 10);
|
||||
labelTime.Text = ("RunTime " + elapsedTime4);
|
||||
break;
|
||||
case "Результат":
|
||||
Stopwatch stopwatch5 = new Stopwatch();
|
||||
stopwatch5.Start();
|
||||
int studlist = _Tlogic.ReadList(null).Count();
|
||||
int statlist = _Glogic.ReadList(null).Count();
|
||||
for (int i = 0; i < Convert.ToInt32(textBoxCount.Text); i++)
|
||||
{
|
||||
var modelR = new ResultOfControlBindingModel
|
||||
{
|
||||
Id = 0,
|
||||
Form = form[rd.Next(0, form.Length)],
|
||||
Date = DateOnly.FromDateTime(DateTime.Now),
|
||||
Mark = mark[rd.Next(0, mark.Length)],
|
||||
StudentId = rd.Next(1, studlist),
|
||||
StatementId = rd.Next(1, statlist)
|
||||
};
|
||||
_Rlogic.Create(modelR);
|
||||
}
|
||||
stopwatch5.Stop();
|
||||
TimeSpan ts5 = stopwatch5.Elapsed;
|
||||
string elapsedTime5 = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
|
||||
ts5.Hours, ts5.Minutes, ts5.Seconds,
|
||||
ts5.Milliseconds / 10);
|
||||
labelTime.Text = ("RunTime " + elapsedTime5);
|
||||
break;
|
||||
|
||||
}
|
||||
MessageBox.Show("Данные добавлены");
|
||||
}
|
||||
}
|
||||
}
|
60
SUBD/SUBD/FormRandom.resx
Normal file
60
SUBD/SUBD/FormRandom.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>
|
@ -22,7 +22,7 @@ namespace SUBD
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormResultOfControl>());
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||
}
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
@ -55,6 +55,8 @@ namespace SUBD
|
||||
services.AddTransient<FormCreateStudent>();
|
||||
services.AddTransient<FormCreateStatement>();
|
||||
services.AddTransient<FormCreateResultOfControl>();
|
||||
services.AddTransient<FormRandom>();
|
||||
services.AddTransient<FormMain>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user