добавлены формы для всех сущностей
This commit is contained in:
parent
c267472976
commit
c90f675d67
190
SUBD/SUBD/FormCreateResultOfControl.Designer.cs
generated
Normal file
190
SUBD/SUBD/FormCreateResultOfControl.Designer.cs
generated
Normal file
@ -0,0 +1,190 @@
|
||||
namespace SUBD
|
||||
{
|
||||
partial class FormCreateResultOfControl
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
comboBoxStudent = new ComboBox();
|
||||
comboBoxStatement = new ComboBox();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
datePicker = new DateTimePicker();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
label5 = new Label();
|
||||
textBoxForm = new TextBox();
|
||||
textBoxMark = new TextBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxStudent
|
||||
//
|
||||
comboBoxStudent.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStudent.FormattingEnabled = true;
|
||||
comboBoxStudent.Location = new Point(119, 134);
|
||||
comboBoxStudent.Name = "comboBoxStudent";
|
||||
comboBoxStudent.Size = new Size(250, 28);
|
||||
comboBoxStudent.TabIndex = 0;
|
||||
//
|
||||
// comboBoxStatement
|
||||
//
|
||||
comboBoxStatement.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStatement.FormattingEnabled = true;
|
||||
comboBoxStatement.Location = new Point(119, 169);
|
||||
comboBoxStatement.Name = "comboBoxStatement";
|
||||
comboBoxStatement.Size = new Size(250, 28);
|
||||
comboBoxStatement.TabIndex = 1;
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(14, 229);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(94, 29);
|
||||
ButtonSave.TabIndex = 6;
|
||||
ButtonSave.Text = "Сохранить";
|
||||
ButtonSave.UseVisualStyleBackColor = true;
|
||||
ButtonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(119, 229);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(94, 29);
|
||||
ButtonCancel.TabIndex = 7;
|
||||
ButtonCancel.Text = "Отмена";
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// datePicker
|
||||
//
|
||||
datePicker.Location = new Point(119, 54);
|
||||
datePicker.Name = "datePicker";
|
||||
datePicker.Size = new Size(250, 27);
|
||||
datePicker.TabIndex = 3;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(14, 59);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(41, 20);
|
||||
label1.TabIndex = 8;
|
||||
label1.Text = "Дата";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 137);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(62, 20);
|
||||
label2.TabIndex = 9;
|
||||
label2.Text = "Студент";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(14, 172);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(84, 20);
|
||||
label3.TabIndex = 10;
|
||||
label3.Text = "Ведомость";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(14, 18);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(57, 20);
|
||||
label4.TabIndex = 11;
|
||||
label4.Text = "Форма";
|
||||
//
|
||||
// label5
|
||||
//
|
||||
label5.AutoSize = true;
|
||||
label5.Location = new Point(13, 94);
|
||||
label5.Name = "label5";
|
||||
label5.Size = new Size(61, 20);
|
||||
label5.TabIndex = 12;
|
||||
label5.Text = "Оценка";
|
||||
//
|
||||
// textBoxForm
|
||||
//
|
||||
textBoxForm.Location = new Point(119, 15);
|
||||
textBoxForm.Name = "textBoxForm";
|
||||
textBoxForm.Size = new Size(250, 27);
|
||||
textBoxForm.TabIndex = 13;
|
||||
//
|
||||
// textBoxMark
|
||||
//
|
||||
textBoxMark.Location = new Point(119, 91);
|
||||
textBoxMark.Name = "textBoxMark";
|
||||
textBoxMark.Size = new Size(250, 27);
|
||||
textBoxMark.TabIndex = 14;
|
||||
//
|
||||
// FormCreateResultOfControl
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(379, 274);
|
||||
Controls.Add(textBoxMark);
|
||||
Controls.Add(textBoxForm);
|
||||
Controls.Add(label5);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(datePicker);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
Controls.Add(comboBoxStatement);
|
||||
Controls.Add(comboBoxStudent);
|
||||
FormBorderStyle = FormBorderStyle.FixedToolWindow;
|
||||
Name = "FormCreateResultOfControl";
|
||||
Text = "Создание результата";
|
||||
Load += FormCreateResult_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxStudent;
|
||||
private ComboBox comboBoxStatement;
|
||||
private TextBox textBoxDate;
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
private DateTimePicker datePicker;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
private Label label5;
|
||||
private TextBox textBoxForm;
|
||||
private TextBox textBoxMark;
|
||||
}
|
||||
}
|
118
SUBD/SUBD/FormCreateResultOfControl.cs
Normal file
118
SUBD/SUBD/FormCreateResultOfControl.cs
Normal file
@ -0,0 +1,118 @@
|
||||
using ElectronicJournalContracts.BindingModels;
|
||||
using ElectronicJournalContracts.BusinessLogicContracts;
|
||||
using ElectronicJournalContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SUBD
|
||||
{
|
||||
public partial class FormCreateResultOfControl : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStudentLogic _STlogic;
|
||||
private readonly IStatementLogic _Slogic;
|
||||
private readonly IResultOfControlLogic _Rlogic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormCreateResultOfControl(ILogger<FormCreateResultOfControl> logger, IStudentLogic stlogic, IStatementLogic slogic, IResultOfControlLogic rlogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_STlogic = stlogic;
|
||||
_Slogic = slogic;
|
||||
_Rlogic = rlogic;
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Сохранение результата");
|
||||
try
|
||||
{
|
||||
var model = new ResultOfControlBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
Form = textBoxForm.Text,
|
||||
Date = DateOnly.FromDateTime(datePicker.Value.Date),
|
||||
Mark = textBoxMark.Text,
|
||||
StudentId = (int)comboBoxStudent.SelectedValue,
|
||||
StatementId = (int)comboBoxStatement.SelectedValue
|
||||
};
|
||||
var operationResult = _id.HasValue ? _Rlogic.Update(model) :
|
||||
_Rlogic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения результата");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void FormCreateResult_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Загрузка студента");
|
||||
var listST = _STlogic.ReadList(null).ToList();
|
||||
if (listST != null)
|
||||
{
|
||||
comboBoxStudent.DisplayMember = "Name";
|
||||
comboBoxStudent.ValueMember = "Id";
|
||||
comboBoxStudent.DataSource = listST;
|
||||
comboBoxStudent.SelectedItem = null;
|
||||
}
|
||||
_logger.LogInformation("Загрузка ведомости");
|
||||
var listS = _Slogic.ReadList(null).ToList();
|
||||
if (listS != null)
|
||||
{
|
||||
comboBoxStatement.DisplayMember = "Id";
|
||||
comboBoxStatement.ValueMember = "Id";
|
||||
comboBoxStatement.DataSource = listS;
|
||||
comboBoxStatement.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения получения списков. Доп информация в логах");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
var view = _Rlogic.ReadElement(new ResultOfControlSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
textBoxForm.Text = view.Form;
|
||||
datePicker.Text = Convert.ToString(view.Date);
|
||||
textBoxMark.Text = view.Mark;
|
||||
comboBoxStudent.SelectedValue = view.StudentId;
|
||||
comboBoxStatement.SelectedValue = view.StatementId;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения получения результата. Доп информация в логах");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
SUBD/SUBD/FormCreateResultOfControl.resx
Normal file
60
SUBD/SUBD/FormCreateResultOfControl.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>
|
170
SUBD/SUBD/FormCreateStatement.Designer.cs
generated
Normal file
170
SUBD/SUBD/FormCreateStatement.Designer.cs
generated
Normal file
@ -0,0 +1,170 @@
|
||||
namespace SUBD
|
||||
{
|
||||
partial class FormCreateStatement
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
comboBoxTeacher = new ComboBox();
|
||||
comboBoxGroup = new ComboBox();
|
||||
comboBoxDiscipline = new ComboBox();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
datePicker = new DateTimePicker();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// comboBoxTeacher
|
||||
//
|
||||
comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTeacher.FormattingEnabled = true;
|
||||
comboBoxTeacher.Location = new Point(119, 45);
|
||||
comboBoxTeacher.Name = "comboBoxTeacher";
|
||||
comboBoxTeacher.Size = new Size(250, 28);
|
||||
comboBoxTeacher.TabIndex = 0;
|
||||
//
|
||||
// comboBoxGroup
|
||||
//
|
||||
comboBoxGroup.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxGroup.FormattingEnabled = true;
|
||||
comboBoxGroup.Location = new Point(119, 80);
|
||||
comboBoxGroup.Name = "comboBoxGroup";
|
||||
comboBoxGroup.Size = new Size(250, 28);
|
||||
comboBoxGroup.TabIndex = 1;
|
||||
//
|
||||
// comboBoxDiscipline
|
||||
//
|
||||
comboBoxDiscipline.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDiscipline.FormattingEnabled = true;
|
||||
comboBoxDiscipline.Location = new Point(119, 114);
|
||||
comboBoxDiscipline.Name = "comboBoxDiscipline";
|
||||
comboBoxDiscipline.Size = new Size(250, 28);
|
||||
comboBoxDiscipline.TabIndex = 2;
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(14, 160);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(94, 29);
|
||||
ButtonSave.TabIndex = 6;
|
||||
ButtonSave.Text = "Сохранить";
|
||||
ButtonSave.UseVisualStyleBackColor = true;
|
||||
ButtonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(119, 160);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(94, 29);
|
||||
ButtonCancel.TabIndex = 7;
|
||||
ButtonCancel.Text = "Отмена";
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// datePicker
|
||||
//
|
||||
datePicker.Location = new Point(119, 8);
|
||||
datePicker.Name = "datePicker";
|
||||
datePicker.Size = new Size(250, 27);
|
||||
datePicker.TabIndex = 3;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(12, 15);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(41, 20);
|
||||
label1.TabIndex = 8;
|
||||
label1.Text = "Дата";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(12, 48);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(65, 20);
|
||||
label2.TabIndex = 9;
|
||||
label2.Text = "Учитель";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(12, 83);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(58, 20);
|
||||
label3.TabIndex = 10;
|
||||
label3.Text = "Группа";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(12, 117);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(96, 20);
|
||||
label4.TabIndex = 11;
|
||||
label4.Text = "Дисциплина";
|
||||
//
|
||||
// FormCreateStatement
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(379, 202);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(datePicker);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
Controls.Add(comboBoxDiscipline);
|
||||
Controls.Add(comboBoxGroup);
|
||||
Controls.Add(comboBoxTeacher);
|
||||
FormBorderStyle = FormBorderStyle.FixedToolWindow;
|
||||
Name = "FormCreateStatement";
|
||||
Text = "Создание ведомости";
|
||||
Load += FormCreateStatement_Load;
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ComboBox comboBoxTeacher;
|
||||
private ComboBox comboBoxGroup;
|
||||
private ComboBox comboBoxDiscipline;
|
||||
private TextBox textBoxDate;
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
private DateTimePicker datePicker;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
}
|
||||
}
|
126
SUBD/SUBD/FormCreateStatement.cs
Normal file
126
SUBD/SUBD/FormCreateStatement.cs
Normal file
@ -0,0 +1,126 @@
|
||||
using ElectronicJournalContracts.BindingModels;
|
||||
using ElectronicJournalContracts.BusinessLogicContracts;
|
||||
using ElectronicJournalContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace SUBD
|
||||
{
|
||||
public partial class FormCreateStatement : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IDisciplineLogic _Dlogic;
|
||||
private readonly IGroupLogic _Glogic;
|
||||
private readonly ITeacherLogic _Tlogic;
|
||||
private readonly IStatementLogic _Slogic;
|
||||
private int? _id;
|
||||
public int Id { set { _id = value; } }
|
||||
public FormCreateStatement(ILogger<FormCreateStatement> logger, IDisciplineLogic dlogic, IGroupLogic glogic, ITeacherLogic tlogic, IStatementLogic slogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_Dlogic = dlogic;
|
||||
_Glogic = glogic;
|
||||
_Tlogic = tlogic;
|
||||
_Slogic = slogic;
|
||||
}
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
_logger.LogInformation("Сохранение ведомости");
|
||||
try
|
||||
{
|
||||
var model = new StatementBindingModel
|
||||
{
|
||||
Id = _id ?? 0,
|
||||
Date = DateOnly.FromDateTime(datePicker.Value.Date),
|
||||
DisciplineId = (int)comboBoxDiscipline.SelectedValue,
|
||||
GroupId = (int)comboBoxGroup.SelectedValue,
|
||||
TeacherId = (int)comboBoxTeacher.SelectedValue
|
||||
};
|
||||
var operationResult = _id.HasValue ? _Slogic.Update(model) :
|
||||
_Slogic.Create(model);
|
||||
if (!operationResult)
|
||||
{
|
||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||
}
|
||||
MessageBox.Show("Сохранение прошло успешно", "Сообщение",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
DialogResult = DialogResult.OK;
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка сохранения ведомости");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
private void ButtonCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
DialogResult = DialogResult.Cancel;
|
||||
Close();
|
||||
}
|
||||
|
||||
private void FormCreateStatement_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Загрузка дисциплины");
|
||||
var listD = _Dlogic.ReadList(null).ToList();
|
||||
if (listD != null)
|
||||
{
|
||||
comboBoxDiscipline.DisplayMember = "Title";
|
||||
comboBoxDiscipline.ValueMember = "Id";
|
||||
comboBoxDiscipline.DataSource = listD;
|
||||
comboBoxDiscipline.SelectedItem = null;
|
||||
}
|
||||
_logger.LogInformation("Загрузка группы");
|
||||
var listG = _Glogic.ReadList(null).ToList();
|
||||
if (listG != null)
|
||||
{
|
||||
comboBoxGroup.DisplayMember = "Title";
|
||||
comboBoxGroup.ValueMember = "Id";
|
||||
comboBoxGroup.DataSource = listG;
|
||||
comboBoxGroup.SelectedItem = null;
|
||||
}
|
||||
_logger.LogInformation("Загрузка преодавателя");
|
||||
var listT = _Tlogic.ReadList(null).ToList();
|
||||
if (listT != null)
|
||||
{
|
||||
comboBoxTeacher.DisplayMember = "Name";
|
||||
comboBoxTeacher.ValueMember = "Id";
|
||||
comboBoxTeacher.DataSource = listT;
|
||||
comboBoxTeacher.SelectedItem = null;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения получения списков. Доп информация в логах");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
if (_id.HasValue)
|
||||
{
|
||||
try
|
||||
{
|
||||
var view = _Slogic.ReadElement(new StatementSearchModel
|
||||
{
|
||||
Id = _id.Value
|
||||
});
|
||||
if (view != null)
|
||||
{
|
||||
datePicker.Text = Convert.ToString(view.Date);
|
||||
comboBoxDiscipline.SelectedValue = view.DisciplineId;
|
||||
comboBoxGroup.SelectedValue = view.GroupId;
|
||||
comboBoxTeacher.SelectedValue = view.TeacherId;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка получения получения ведомости. Доп информация в логах");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
60
SUBD/SUBD/FormCreateStatement.resx
Normal file
60
SUBD/SUBD/FormCreateStatement.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>
|
209
SUBD/SUBD/FormResultOfControl.Designer.cs
generated
Normal file
209
SUBD/SUBD/FormResultOfControl.Designer.cs
generated
Normal file
@ -0,0 +1,209 @@
|
||||
namespace SUBD
|
||||
{
|
||||
partial class FormResultOfControl
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
ButtonAdd = new Button();
|
||||
ButtonUpd = new Button();
|
||||
ButtonDel = new Button();
|
||||
ButtonRef = new Button();
|
||||
ButtonFilter = new Button();
|
||||
ButtonDrop = new Button();
|
||||
comboBoxFilter = new ComboBox();
|
||||
textBoxFilter = new TextBox();
|
||||
dateTimePickerFilterEnd = new DateTimePicker();
|
||||
dateTimePickerFilterStart = new DateTimePicker();
|
||||
labelTime = new Label();
|
||||
labelCount = new Label();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(0, 31);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(976, 418);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(982, 31);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(147, 29);
|
||||
ButtonAdd.TabIndex = 2;
|
||||
ButtonAdd.Text = "Добавить";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// ButtonUpd
|
||||
//
|
||||
ButtonUpd.Location = new Point(982, 66);
|
||||
ButtonUpd.Name = "ButtonUpd";
|
||||
ButtonUpd.Size = new Size(147, 29);
|
||||
ButtonUpd.TabIndex = 3;
|
||||
ButtonUpd.Text = "Изменить";
|
||||
ButtonUpd.UseVisualStyleBackColor = true;
|
||||
ButtonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// ButtonDel
|
||||
//
|
||||
ButtonDel.Location = new Point(982, 101);
|
||||
ButtonDel.Name = "ButtonDel";
|
||||
ButtonDel.Size = new Size(147, 29);
|
||||
ButtonDel.TabIndex = 4;
|
||||
ButtonDel.Text = "Удалить";
|
||||
ButtonDel.UseVisualStyleBackColor = true;
|
||||
ButtonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// ButtonRef
|
||||
//
|
||||
ButtonRef.Location = new Point(982, 136);
|
||||
ButtonRef.Name = "ButtonRef";
|
||||
ButtonRef.Size = new Size(147, 29);
|
||||
ButtonRef.TabIndex = 5;
|
||||
ButtonRef.Text = "Обновить";
|
||||
ButtonRef.UseVisualStyleBackColor = true;
|
||||
ButtonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// ButtonFilter
|
||||
//
|
||||
ButtonFilter.Location = new Point(982, 379);
|
||||
ButtonFilter.Name = "ButtonFilter";
|
||||
ButtonFilter.Size = new Size(147, 29);
|
||||
ButtonFilter.TabIndex = 6;
|
||||
ButtonFilter.Text = "Наложить фильтр";
|
||||
ButtonFilter.UseVisualStyleBackColor = true;
|
||||
ButtonFilter.Click += ButtonFilter_Click;
|
||||
//
|
||||
// ButtonDrop
|
||||
//
|
||||
ButtonDrop.Location = new Point(982, 414);
|
||||
ButtonDrop.Name = "ButtonDrop";
|
||||
ButtonDrop.Size = new Size(147, 29);
|
||||
ButtonDrop.TabIndex = 7;
|
||||
ButtonDrop.Text = "Сбросить";
|
||||
ButtonDrop.UseVisualStyleBackColor = true;
|
||||
ButtonDrop.Click += ButtonDrop_Click;
|
||||
//
|
||||
// comboBoxFilter
|
||||
//
|
||||
comboBoxFilter.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxFilter.FormattingEnabled = true;
|
||||
comboBoxFilter.Items.AddRange(new object[] { "Дата", "Студент", "Ведомость" });
|
||||
comboBoxFilter.Location = new Point(982, 248);
|
||||
comboBoxFilter.Name = "comboBoxFilter";
|
||||
comboBoxFilter.Size = new Size(147, 28);
|
||||
comboBoxFilter.TabIndex = 8;
|
||||
//
|
||||
// textBoxFilter
|
||||
//
|
||||
textBoxFilter.Location = new Point(982, 282);
|
||||
textBoxFilter.Name = "textBoxFilter";
|
||||
textBoxFilter.Size = new Size(147, 27);
|
||||
textBoxFilter.TabIndex = 9;
|
||||
//
|
||||
// dateTimePickerFilterEnd
|
||||
//
|
||||
dateTimePickerFilterEnd.Location = new Point(982, 348);
|
||||
dateTimePickerFilterEnd.Name = "dateTimePickerFilterEnd";
|
||||
dateTimePickerFilterEnd.Size = new Size(147, 27);
|
||||
dateTimePickerFilterEnd.TabIndex = 10;
|
||||
//
|
||||
// dateTimePickerFilterStart
|
||||
//
|
||||
dateTimePickerFilterStart.Location = new Point(982, 315);
|
||||
dateTimePickerFilterStart.Name = "dateTimePickerFilterStart";
|
||||
dateTimePickerFilterStart.Size = new Size(147, 27);
|
||||
dateTimePickerFilterStart.TabIndex = 11;
|
||||
//
|
||||
// labelTime
|
||||
//
|
||||
labelTime.AutoSize = true;
|
||||
labelTime.Location = new Point(982, 216);
|
||||
labelTime.Name = "labelTime";
|
||||
labelTime.Size = new Size(42, 20);
|
||||
labelTime.TabIndex = 12;
|
||||
labelTime.Text = "Time";
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(982, 196);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(51, 20);
|
||||
labelCount.TabIndex = 13;
|
||||
labelCount.Text = "Count:";
|
||||
//
|
||||
// FormStatement
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1139, 449);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(labelTime);
|
||||
Controls.Add(dateTimePickerFilterStart);
|
||||
Controls.Add(dateTimePickerFilterEnd);
|
||||
Controls.Add(textBoxFilter);
|
||||
Controls.Add(comboBoxFilter);
|
||||
Controls.Add(ButtonDrop);
|
||||
Controls.Add(ButtonFilter);
|
||||
Controls.Add(ButtonRef);
|
||||
Controls.Add(ButtonDel);
|
||||
Controls.Add(ButtonUpd);
|
||||
Controls.Add(ButtonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
FormBorderStyle = FormBorderStyle.FixedToolWindow;
|
||||
Name = "FormStatement";
|
||||
Text = "Ведомость";
|
||||
Load += FormResultOfControl_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button ButtonAdd;
|
||||
private Button ButtonUpd;
|
||||
private Button ButtonDel;
|
||||
private Button ButtonRef;
|
||||
private Button ButtonFilter;
|
||||
private Button ButtonDrop;
|
||||
private ComboBox comboBoxFilter;
|
||||
private TextBox textBoxFilter;
|
||||
private DateTimePicker dateTimePickerFilterEnd;
|
||||
private DateTimePicker dateTimePickerFilterStart;
|
||||
private Label labelTime;
|
||||
private Label labelCount;
|
||||
}
|
||||
}
|
169
SUBD/SUBD/FormResultOfControl.cs
Normal file
169
SUBD/SUBD/FormResultOfControl.cs
Normal file
@ -0,0 +1,169 @@
|
||||
using ElectronicJournalContracts.BindingModels;
|
||||
using ElectronicJournalContracts.BusinessLogicContracts;
|
||||
using ElectronicJournalContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 FormResultOfControl : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IResultOfControlLogic _resultLogic;
|
||||
public FormResultOfControl(ILogger<FormResultOfControl> logger, IResultOfControlLogic resultLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_resultLogic = resultLogic;
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var list = _resultLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["StudentId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка результата");
|
||||
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);
|
||||
labelCount.Text = "Count: " + list.Count();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки результата");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(FormCreateResultOfControl));
|
||||
if (service is FormCreateResultOfControl form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(FormCreateResultOfControl));
|
||||
if (service is FormCreateResultOfControl form)
|
||||
{
|
||||
form.Id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить ведомость?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_logger.LogInformation("Результат удален");
|
||||
try
|
||||
{
|
||||
if (!_resultLogic.Delete(new ResultOfControlBindingModel
|
||||
{
|
||||
Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value),
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления результата");
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
ResultOfControlSearchModel model = new ResultOfControlSearchModel();
|
||||
model.Id = 9999;
|
||||
switch (comboBoxFilter.SelectedItem)
|
||||
{
|
||||
case "Дата":
|
||||
model.DateFrom = DateOnly.FromDateTime(dateTimePickerFilterStart.Value);
|
||||
model.DateTo = DateOnly.FromDateTime(dateTimePickerFilterEnd.Value);
|
||||
break;
|
||||
case "Студент":
|
||||
model.StudentName = textBoxFilter.Text;
|
||||
break;
|
||||
case "Ведомость":
|
||||
model.StatementId = Convert.ToInt32(textBoxFilter.Text);
|
||||
break;
|
||||
default:
|
||||
LoadData();
|
||||
break;
|
||||
}
|
||||
var list = _resultLogic.ReadList(model);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["StudentId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка результата");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки результата");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDrop_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void FormResultOfControl_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
SUBD/SUBD/FormResultOfControl.resx
Normal file
120
SUBD/SUBD/FormResultOfControl.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
209
SUBD/SUBD/FormStatement.Designer.cs
generated
Normal file
209
SUBD/SUBD/FormStatement.Designer.cs
generated
Normal file
@ -0,0 +1,209 @@
|
||||
namespace SUBD
|
||||
{
|
||||
partial class FormStatement
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dataGridView = new DataGridView();
|
||||
ButtonAdd = new Button();
|
||||
ButtonUpd = new Button();
|
||||
ButtonDel = new Button();
|
||||
ButtonRef = new Button();
|
||||
ButtonFilter = new Button();
|
||||
ButtonDrop = new Button();
|
||||
comboBoxFilter = new ComboBox();
|
||||
textBoxFilter = new TextBox();
|
||||
dateTimePickerFilterEnd = new DateTimePicker();
|
||||
dateTimePickerFilterStart = new DateTimePicker();
|
||||
labelTime = new Label();
|
||||
labelCount = new Label();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dataGridView
|
||||
//
|
||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridView.Location = new Point(0, 31);
|
||||
dataGridView.Name = "dataGridView";
|
||||
dataGridView.RowHeadersWidth = 51;
|
||||
dataGridView.RowTemplate.Height = 29;
|
||||
dataGridView.Size = new Size(976, 418);
|
||||
dataGridView.TabIndex = 1;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.Location = new Point(982, 31);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(147, 29);
|
||||
ButtonAdd.TabIndex = 2;
|
||||
ButtonAdd.Text = "Добавить";
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// ButtonUpd
|
||||
//
|
||||
ButtonUpd.Location = new Point(982, 66);
|
||||
ButtonUpd.Name = "ButtonUpd";
|
||||
ButtonUpd.Size = new Size(147, 29);
|
||||
ButtonUpd.TabIndex = 3;
|
||||
ButtonUpd.Text = "Изменить";
|
||||
ButtonUpd.UseVisualStyleBackColor = true;
|
||||
ButtonUpd.Click += ButtonUpd_Click;
|
||||
//
|
||||
// ButtonDel
|
||||
//
|
||||
ButtonDel.Location = new Point(982, 101);
|
||||
ButtonDel.Name = "ButtonDel";
|
||||
ButtonDel.Size = new Size(147, 29);
|
||||
ButtonDel.TabIndex = 4;
|
||||
ButtonDel.Text = "Удалить";
|
||||
ButtonDel.UseVisualStyleBackColor = true;
|
||||
ButtonDel.Click += ButtonDel_Click;
|
||||
//
|
||||
// ButtonRef
|
||||
//
|
||||
ButtonRef.Location = new Point(982, 136);
|
||||
ButtonRef.Name = "ButtonRef";
|
||||
ButtonRef.Size = new Size(147, 29);
|
||||
ButtonRef.TabIndex = 5;
|
||||
ButtonRef.Text = "Обновить";
|
||||
ButtonRef.UseVisualStyleBackColor = true;
|
||||
ButtonRef.Click += ButtonRef_Click;
|
||||
//
|
||||
// ButtonFilter
|
||||
//
|
||||
ButtonFilter.Location = new Point(982, 379);
|
||||
ButtonFilter.Name = "ButtonFilter";
|
||||
ButtonFilter.Size = new Size(147, 29);
|
||||
ButtonFilter.TabIndex = 6;
|
||||
ButtonFilter.Text = "Наложить фильтр";
|
||||
ButtonFilter.UseVisualStyleBackColor = true;
|
||||
ButtonFilter.Click += ButtonFilter_Click;
|
||||
//
|
||||
// ButtonDrop
|
||||
//
|
||||
ButtonDrop.Location = new Point(982, 414);
|
||||
ButtonDrop.Name = "ButtonDrop";
|
||||
ButtonDrop.Size = new Size(147, 29);
|
||||
ButtonDrop.TabIndex = 7;
|
||||
ButtonDrop.Text = "Сбросить";
|
||||
ButtonDrop.UseVisualStyleBackColor = true;
|
||||
ButtonDrop.Click += ButtonDrop_Click;
|
||||
//
|
||||
// comboBoxFilter
|
||||
//
|
||||
comboBoxFilter.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxFilter.FormattingEnabled = true;
|
||||
comboBoxFilter.Items.AddRange(new object[] { "Дата", "Дисциплина", "Группа", "Преподаватель" });
|
||||
comboBoxFilter.Location = new Point(982, 248);
|
||||
comboBoxFilter.Name = "comboBoxFilter";
|
||||
comboBoxFilter.Size = new Size(147, 28);
|
||||
comboBoxFilter.TabIndex = 8;
|
||||
//
|
||||
// textBoxFilter
|
||||
//
|
||||
textBoxFilter.Location = new Point(982, 282);
|
||||
textBoxFilter.Name = "textBoxFilter";
|
||||
textBoxFilter.Size = new Size(147, 27);
|
||||
textBoxFilter.TabIndex = 9;
|
||||
//
|
||||
// dateTimePickerFilterEnd
|
||||
//
|
||||
dateTimePickerFilterEnd.Location = new Point(982, 348);
|
||||
dateTimePickerFilterEnd.Name = "dateTimePickerFilterEnd";
|
||||
dateTimePickerFilterEnd.Size = new Size(147, 27);
|
||||
dateTimePickerFilterEnd.TabIndex = 10;
|
||||
//
|
||||
// dateTimePickerFilterStart
|
||||
//
|
||||
dateTimePickerFilterStart.Location = new Point(982, 315);
|
||||
dateTimePickerFilterStart.Name = "dateTimePickerFilterStart";
|
||||
dateTimePickerFilterStart.Size = new Size(147, 27);
|
||||
dateTimePickerFilterStart.TabIndex = 11;
|
||||
//
|
||||
// labelTime
|
||||
//
|
||||
labelTime.AutoSize = true;
|
||||
labelTime.Location = new Point(982, 216);
|
||||
labelTime.Name = "labelTime";
|
||||
labelTime.Size = new Size(42, 20);
|
||||
labelTime.TabIndex = 12;
|
||||
labelTime.Text = "Time";
|
||||
//
|
||||
// labelCount
|
||||
//
|
||||
labelCount.AutoSize = true;
|
||||
labelCount.Location = new Point(982, 196);
|
||||
labelCount.Name = "labelCount";
|
||||
labelCount.Size = new Size(51, 20);
|
||||
labelCount.TabIndex = 13;
|
||||
labelCount.Text = "Count:";
|
||||
//
|
||||
// FormStatement
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(1139, 449);
|
||||
Controls.Add(labelCount);
|
||||
Controls.Add(labelTime);
|
||||
Controls.Add(dateTimePickerFilterStart);
|
||||
Controls.Add(dateTimePickerFilterEnd);
|
||||
Controls.Add(textBoxFilter);
|
||||
Controls.Add(comboBoxFilter);
|
||||
Controls.Add(ButtonDrop);
|
||||
Controls.Add(ButtonFilter);
|
||||
Controls.Add(ButtonRef);
|
||||
Controls.Add(ButtonDel);
|
||||
Controls.Add(ButtonUpd);
|
||||
Controls.Add(ButtonAdd);
|
||||
Controls.Add(dataGridView);
|
||||
FormBorderStyle = FormBorderStyle.FixedToolWindow;
|
||||
Name = "FormStatement";
|
||||
Text = "Ведомость";
|
||||
Load += FormStatement_Load;
|
||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DataGridView dataGridView;
|
||||
private Button ButtonAdd;
|
||||
private Button ButtonUpd;
|
||||
private Button ButtonDel;
|
||||
private Button ButtonRef;
|
||||
private Button ButtonFilter;
|
||||
private Button ButtonDrop;
|
||||
private ComboBox comboBoxFilter;
|
||||
private TextBox textBoxFilter;
|
||||
private DateTimePicker dateTimePickerFilterEnd;
|
||||
private DateTimePicker dateTimePickerFilterStart;
|
||||
private Label labelTime;
|
||||
private Label labelCount;
|
||||
}
|
||||
}
|
176
SUBD/SUBD/FormStatement.cs
Normal file
176
SUBD/SUBD/FormStatement.cs
Normal file
@ -0,0 +1,176 @@
|
||||
using ElectronicJournalContracts.BindingModels;
|
||||
using ElectronicJournalContracts.BusinessLogicContracts;
|
||||
using ElectronicJournalContracts.SearchModels;
|
||||
using Microsoft.Extensions.Logging;
|
||||
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 FormStatement : Form
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IStatementLogic _statementLogic;
|
||||
public FormStatement(ILogger<FormStatement> logger, IStatementLogic statementLogic)
|
||||
{
|
||||
InitializeComponent();
|
||||
_logger = logger;
|
||||
_statementLogic = statementLogic;
|
||||
}
|
||||
private void LoadData()
|
||||
{
|
||||
try
|
||||
{
|
||||
Stopwatch stopwatch = new Stopwatch();
|
||||
stopwatch.Start();
|
||||
var list = _statementLogic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["DisciplineId"].Visible = false;
|
||||
dataGridView.Columns["GroupId"].Visible = false;
|
||||
dataGridView.Columns["TeacherId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка ведомости");
|
||||
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);
|
||||
labelCount.Text = "Count: " + list.Count();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки ведомости");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonRef_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(FormCreateStatement));
|
||||
if (service is FormCreateStatement form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service =
|
||||
Program.ServiceProvider?.GetService(typeof(FormCreateStatement));
|
||||
if (service is FormCreateStatement form)
|
||||
{
|
||||
form.Id =
|
||||
Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MessageBox.Show("Удалить ведомость?", "Вопрос",
|
||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||
{
|
||||
_logger.LogInformation("Ведомость удалена");
|
||||
try
|
||||
{
|
||||
if (!_statementLogic.Delete(new StatementBindingModel
|
||||
{
|
||||
Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value),
|
||||
}))
|
||||
{
|
||||
throw new Exception("Ошибка при удалении. Дополнительная информация в логах.");
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка удаления ведомости");
|
||||
MessageBox.Show(ex.Message, "Ошибка",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonFilter_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
StatementSearchModel model = new StatementSearchModel();
|
||||
model.Id = 9999;
|
||||
switch (comboBoxFilter.SelectedItem)
|
||||
{
|
||||
case "Дата":
|
||||
model.DateFrom = DateOnly.FromDateTime(dateTimePickerFilterStart.Value);
|
||||
model.DateTo = DateOnly.FromDateTime(dateTimePickerFilterEnd.Value);
|
||||
break;
|
||||
case "Преподаватель":
|
||||
model.TeacherName = textBoxFilter.Text;
|
||||
break;
|
||||
case "Дисциплина":
|
||||
model.DisciplineName = textBoxFilter.Text;
|
||||
break;
|
||||
case "Группа":
|
||||
model.GroupName = textBoxFilter.Text;
|
||||
break;
|
||||
default:
|
||||
LoadData();
|
||||
break;
|
||||
}
|
||||
var list = _statementLogic.ReadList(model);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["DisciplineId"].Visible = false;
|
||||
dataGridView.Columns["GroupId"].Visible = false;
|
||||
dataGridView.Columns["TeacherId"].Visible = false;
|
||||
}
|
||||
_logger.LogInformation("Загрузка ведомости");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки ведомости");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void ButtonDrop_Click(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
|
||||
private void FormStatement_Load(object sender, EventArgs e)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
120
SUBD/SUBD/FormStatement.resx
Normal file
120
SUBD/SUBD/FormStatement.resx
Normal file
@ -0,0 +1,120 @@
|
||||
<?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>
|
@ -22,7 +22,7 @@ namespace SUBD
|
||||
var services = new ServiceCollection();
|
||||
ConfigureServices(services);
|
||||
_serviceProvider = services.BuildServiceProvider();
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormStudent>());
|
||||
Application.Run(_serviceProvider.GetRequiredService<FormResultOfControl>());
|
||||
}
|
||||
private static void ConfigureServices(ServiceCollection services)
|
||||
{
|
||||
@ -47,10 +47,14 @@ namespace SUBD
|
||||
services.AddTransient<FormTeacher>();
|
||||
services.AddTransient<FormGroup>();
|
||||
services.AddTransient<FormStudent>();
|
||||
services.AddTransient<FormStatement>();
|
||||
services.AddTransient<FormResultOfControl>();
|
||||
services.AddTransient<FormCreateDiscipline>();
|
||||
services.AddTransient<FormCreateTeacher>();
|
||||
services.AddTransient<FormCreateGroup>();
|
||||
services.AddTransient<FormCreateStudent>();
|
||||
services.AddTransient<FormCreateStatement>();
|
||||
services.AddTransient<FormCreateResultOfControl>();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user