Лабораторная работа 3
This commit is contained in:
parent
2fc3adecc4
commit
197a2ab8da
@ -0,0 +1,36 @@
|
||||
using SessionResults_Kudyaeva.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Entities;
|
||||
|
||||
public class Retake
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
|
||||
public int StudentId { get; private set; }
|
||||
|
||||
public int TeacherId { get; private set; }
|
||||
|
||||
public int DisciplineId { get; private set; }
|
||||
|
||||
public Mark Mark { get; private set; }
|
||||
|
||||
public DateTime Date { get; private set; }
|
||||
|
||||
public static Retake CreateOperation(int id, int studentId, int teacherId, int disciplineId, Mark mark, DateTime date)
|
||||
{
|
||||
return new Retake
|
||||
{
|
||||
Id = id,
|
||||
StudentId = studentId,
|
||||
TeacherId = teacherId,
|
||||
DisciplineId = disciplineId,
|
||||
Mark = mark,
|
||||
Date = date
|
||||
};
|
||||
}
|
||||
}
|
@ -8,14 +8,26 @@ public class Statement
|
||||
public DateTime Date { get; private set; }
|
||||
public IEnumerable<StatementStudent> StatementStudents { get; private set; } = [];
|
||||
|
||||
public static Statement CreateOperation(int id, int teacherId, int disciplineId, IEnumerable<StatementStudent> statementStudents)
|
||||
public static Statement CreateOperation(int id, int teacherId, int disciplineId, DateTime date, IEnumerable<StatementStudent> statementStudents)
|
||||
{
|
||||
return new Statement
|
||||
{
|
||||
Id = id,
|
||||
TeacherId = teacherId,
|
||||
DisciplineId = disciplineId,
|
||||
Date = DateTime.Now,
|
||||
Date = date,
|
||||
StatementStudents = statementStudents
|
||||
};
|
||||
}
|
||||
|
||||
public static Statement CreateOperation(TempStatementStudent tempStatementStudent, IEnumerable<StatementStudent> statementStudents)
|
||||
{
|
||||
return new Statement
|
||||
{
|
||||
Id = tempStatementStudent.Id,
|
||||
TeacherId = tempStatementStudent.TeacherId,
|
||||
DisciplineId = tempStatementStudent.DisciplineId,
|
||||
Date = tempStatementStudent.Date,
|
||||
StatementStudents = statementStudents
|
||||
};
|
||||
}
|
||||
|
@ -0,0 +1,18 @@
|
||||
using SessionResults_Kudyaeva.Entities.Enums;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Entities;
|
||||
|
||||
public class TempStatementStudent
|
||||
{
|
||||
public int Id { get; private set; }
|
||||
public int TeacherId { get; private set; }
|
||||
public int DisciplineId { get; private set; }
|
||||
public DateTime Date { get; private set; }
|
||||
public int StudentId { get; private set; }
|
||||
public Mark Mark { get; private set; }
|
||||
}
|
@ -36,7 +36,11 @@
|
||||
DisciplinesToolStripMenuItem = new ToolStripMenuItem();
|
||||
опереToolStripMenuItem = new ToolStripMenuItem();
|
||||
AddMarksToolStripMenuItem = new ToolStripMenuItem();
|
||||
toolStripMenuItemRetake = new ToolStripMenuItem();
|
||||
отчетыToolStripMenuItem = new ToolStripMenuItem();
|
||||
toolStripMenuItemDocReport = new ToolStripMenuItem();
|
||||
toolStripMenuItemStudentReport = new ToolStripMenuItem();
|
||||
toolStripMenuItemMarksDistribution = new ToolStripMenuItem();
|
||||
menuStrip1.SuspendLayout();
|
||||
SuspendLayout();
|
||||
//
|
||||
@ -59,34 +63,34 @@
|
||||
// StudentsToolStripMenuItem
|
||||
//
|
||||
StudentsToolStripMenuItem.Name = "StudentsToolStripMenuItem";
|
||||
StudentsToolStripMenuItem.Size = new Size(180, 22);
|
||||
StudentsToolStripMenuItem.Size = new Size(159, 22);
|
||||
StudentsToolStripMenuItem.Text = "Студенты";
|
||||
StudentsToolStripMenuItem.Click += StudentsToolStripMenuItem_Click;
|
||||
//
|
||||
// GroupsToolStripMenuItem
|
||||
//
|
||||
GroupsToolStripMenuItem.Name = "GroupsToolStripMenuItem";
|
||||
GroupsToolStripMenuItem.Size = new Size(180, 22);
|
||||
GroupsToolStripMenuItem.Size = new Size(159, 22);
|
||||
GroupsToolStripMenuItem.Text = "Группы";
|
||||
GroupsToolStripMenuItem.Click += GroupsToolStripMenuItem_Click;
|
||||
//
|
||||
// TeachersToolStripMenuItem
|
||||
//
|
||||
TeachersToolStripMenuItem.Name = "TeachersToolStripMenuItem";
|
||||
TeachersToolStripMenuItem.Size = new Size(180, 22);
|
||||
TeachersToolStripMenuItem.Size = new Size(159, 22);
|
||||
TeachersToolStripMenuItem.Text = "Преподаватели";
|
||||
TeachersToolStripMenuItem.Click += TeachersToolStripMenuItem_Click;
|
||||
//
|
||||
// DisciplinesToolStripMenuItem
|
||||
//
|
||||
DisciplinesToolStripMenuItem.Name = "DisciplinesToolStripMenuItem";
|
||||
DisciplinesToolStripMenuItem.Size = new Size(180, 22);
|
||||
DisciplinesToolStripMenuItem.Size = new Size(159, 22);
|
||||
DisciplinesToolStripMenuItem.Text = "Дисциплины";
|
||||
DisciplinesToolStripMenuItem.Click += DisciplinesToolStripMenuItem_Click;
|
||||
//
|
||||
// опереToolStripMenuItem
|
||||
//
|
||||
опереToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { AddMarksToolStripMenuItem });
|
||||
опереToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { AddMarksToolStripMenuItem, toolStripMenuItemRetake });
|
||||
опереToolStripMenuItem.Name = "опереToolStripMenuItem";
|
||||
опереToolStripMenuItem.Size = new Size(75, 20);
|
||||
опереToolStripMenuItem.Text = "Операции";
|
||||
@ -98,12 +102,41 @@
|
||||
AddMarksToolStripMenuItem.Text = "Создание результатов сессии";
|
||||
AddMarksToolStripMenuItem.Click += AddMarksToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripMenuItemRetake
|
||||
//
|
||||
toolStripMenuItemRetake.Name = "toolStripMenuItemRetake";
|
||||
toolStripMenuItemRetake.Size = new Size(236, 22);
|
||||
toolStripMenuItemRetake.Text = "Создание пересдачи";
|
||||
toolStripMenuItemRetake.Click += toolStripMenuItemRetake_Click;
|
||||
//
|
||||
// отчетыToolStripMenuItem
|
||||
//
|
||||
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { toolStripMenuItemDocReport, toolStripMenuItemStudentReport, toolStripMenuItemMarksDistribution });
|
||||
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
|
||||
отчетыToolStripMenuItem.Size = new Size(60, 20);
|
||||
отчетыToolStripMenuItem.Text = "Отчеты";
|
||||
//
|
||||
// toolStripMenuItemDocReport
|
||||
//
|
||||
toolStripMenuItemDocReport.Name = "toolStripMenuItemDocReport";
|
||||
toolStripMenuItemDocReport.Size = new Size(235, 22);
|
||||
toolStripMenuItemDocReport.Text = "Документ со справочниками";
|
||||
toolStripMenuItemDocReport.Click += toolStripMenuItemDocReport_Click;
|
||||
//
|
||||
// toolStripMenuItemStudentReport
|
||||
//
|
||||
toolStripMenuItemStudentReport.Name = "toolStripMenuItemStudentReport";
|
||||
toolStripMenuItemStudentReport.Size = new Size(235, 22);
|
||||
toolStripMenuItemStudentReport.Text = "Успеваемость студента";
|
||||
toolStripMenuItemStudentReport.Click += toolStripMenuItemStudentReport_Click;
|
||||
//
|
||||
// toolStripMenuItemMarksDistribution
|
||||
//
|
||||
toolStripMenuItemMarksDistribution.Name = "toolStripMenuItemMarksDistribution";
|
||||
toolStripMenuItemMarksDistribution.Size = new Size(235, 22);
|
||||
toolStripMenuItemMarksDistribution.Text = "Выставленные оценки";
|
||||
toolStripMenuItemMarksDistribution.Click += toolStripMenuItemMarksDistribution_Click;
|
||||
//
|
||||
// FormSessionResults
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
@ -133,5 +166,9 @@
|
||||
private ToolStripMenuItem опереToolStripMenuItem;
|
||||
private ToolStripMenuItem отчетыToolStripMenuItem;
|
||||
private ToolStripMenuItem AddMarksToolStripMenuItem;
|
||||
private ToolStripMenuItem toolStripMenuItemRetake;
|
||||
private ToolStripMenuItem toolStripMenuItemDocReport;
|
||||
private ToolStripMenuItem toolStripMenuItemStudentReport;
|
||||
private ToolStripMenuItem toolStripMenuItemMarksDistribution;
|
||||
}
|
||||
}
|
@ -81,4 +81,52 @@ public partial class FormSessionResults : Form
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemRetake_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<RetakeListForm>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemDocReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormDirectoryReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemStudentReport_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormStudentReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void toolStripMenuItemMarksDistribution_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<FormMarksDistributionReport>().ShowDialog();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
112
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/FormDirectoryReport.Designer.cs
generated
Normal file
112
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/FormDirectoryReport.Designer.cs
generated
Normal file
@ -0,0 +1,112 @@
|
||||
namespace SessionResults_Kudyaeva.Forms
|
||||
{
|
||||
partial class FormDirectoryReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
checkBoxDisciplines = new CheckBox();
|
||||
checkBoxGroups = new CheckBox();
|
||||
checkBoxStudents = new CheckBox();
|
||||
checkBoxTeachers = new CheckBox();
|
||||
buttonBuild = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// checkBoxDisciplines
|
||||
//
|
||||
checkBoxDisciplines.AutoSize = true;
|
||||
checkBoxDisciplines.Location = new Point(12, 12);
|
||||
checkBoxDisciplines.Name = "checkBoxDisciplines";
|
||||
checkBoxDisciplines.Size = new Size(83, 19);
|
||||
checkBoxDisciplines.TabIndex = 0;
|
||||
checkBoxDisciplines.Text = "Предметы";
|
||||
checkBoxDisciplines.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxGroups
|
||||
//
|
||||
checkBoxGroups.AutoSize = true;
|
||||
checkBoxGroups.Location = new Point(12, 46);
|
||||
checkBoxGroups.Name = "checkBoxGroups";
|
||||
checkBoxGroups.Size = new Size(68, 19);
|
||||
checkBoxGroups.TabIndex = 1;
|
||||
checkBoxGroups.Text = "Группы";
|
||||
checkBoxGroups.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxStudents
|
||||
//
|
||||
checkBoxStudents.AutoSize = true;
|
||||
checkBoxStudents.Location = new Point(12, 82);
|
||||
checkBoxStudents.Name = "checkBoxStudents";
|
||||
checkBoxStudents.Size = new Size(78, 19);
|
||||
checkBoxStudents.TabIndex = 2;
|
||||
checkBoxStudents.Text = "Студенты";
|
||||
checkBoxStudents.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// checkBoxTeachers
|
||||
//
|
||||
checkBoxTeachers.AutoSize = true;
|
||||
checkBoxTeachers.Location = new Point(12, 118);
|
||||
checkBoxTeachers.Name = "checkBoxTeachers";
|
||||
checkBoxTeachers.Size = new Size(111, 19);
|
||||
checkBoxTeachers.TabIndex = 3;
|
||||
checkBoxTeachers.Text = "Преподаватели";
|
||||
checkBoxTeachers.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.Location = new Point(12, 159);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(139, 23);
|
||||
buttonBuild.TabIndex = 4;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = true;
|
||||
buttonBuild.Click += buttonBuild_Click;
|
||||
//
|
||||
// FormDirectoryReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(167, 197);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(checkBoxTeachers);
|
||||
Controls.Add(checkBoxStudents);
|
||||
Controls.Add(checkBoxGroups);
|
||||
Controls.Add(checkBoxDisciplines);
|
||||
Name = "FormDirectoryReport";
|
||||
Text = "FormDirectoryReport";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private CheckBox checkBoxDisciplines;
|
||||
private CheckBox checkBoxGroups;
|
||||
private CheckBox checkBoxStudents;
|
||||
private CheckBox checkBoxTeachers;
|
||||
private Button buttonBuild;
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
using SessionResults_Kudyaeva.Reports;
|
||||
using Unity;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Forms;
|
||||
|
||||
public partial class FormDirectoryReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
public FormDirectoryReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void buttonBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!checkBoxDisciplines.Checked && !checkBoxGroups.Checked && !checkBoxStudents.Checked && !checkBoxTeachers.Checked)
|
||||
{
|
||||
throw new Exception("Не выбран ни один справочник для выгрузки");
|
||||
}
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Docx Files | *.docx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
throw new Exception("Не выбран файла для отчета");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<DocReport>().CreateDoc(sfd.FileName, checkBoxDisciplines.Checked, checkBoxGroups.Checked, checkBoxStudents.Checked, checkBoxTeachers.Checked))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании отчета", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
107
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/FormMarksDistributionReport.Designer.cs
generated
Normal file
107
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/FormMarksDistributionReport.Designer.cs
generated
Normal file
@ -0,0 +1,107 @@
|
||||
namespace SessionResults_Kudyaeva.Forms
|
||||
{
|
||||
partial class FormMarksDistributionReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dateTimePicker = new DateTimePicker();
|
||||
label1 = new Label();
|
||||
labelFileName = new Label();
|
||||
buttonFile = new Button();
|
||||
buttonBuild = new Button();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dateTimePicker
|
||||
//
|
||||
dateTimePicker.Location = new Point(70, 44);
|
||||
dateTimePicker.Name = "dateTimePicker";
|
||||
dateTimePicker.Size = new Size(200, 23);
|
||||
dateTimePicker.TabIndex = 0;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(29, 50);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(35, 15);
|
||||
label1.TabIndex = 1;
|
||||
label1.Text = "Дата:";
|
||||
//
|
||||
// labelFileName
|
||||
//
|
||||
labelFileName.AutoSize = true;
|
||||
labelFileName.Location = new Point(111, 16);
|
||||
labelFileName.Name = "labelFileName";
|
||||
labelFileName.Size = new Size(36, 15);
|
||||
labelFileName.TabIndex = 2;
|
||||
labelFileName.Text = "Файл";
|
||||
//
|
||||
// buttonFile
|
||||
//
|
||||
buttonFile.Location = new Point(29, 12);
|
||||
buttonFile.Name = "buttonFile";
|
||||
buttonFile.Size = new Size(75, 23);
|
||||
buttonFile.TabIndex = 3;
|
||||
buttonFile.Text = "Выбрать";
|
||||
buttonFile.UseVisualStyleBackColor = true;
|
||||
buttonFile.Click += buttonFile_Click;
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.Location = new Point(29, 85);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(241, 23);
|
||||
buttonBuild.TabIndex = 4;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = true;
|
||||
buttonBuild.Click += buttonBuild_Click;
|
||||
//
|
||||
// FormContractorFuelDistributionReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(291, 137);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(buttonFile);
|
||||
Controls.Add(labelFileName);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(dateTimePicker);
|
||||
Name = "FormContractorFuelDistributionReport";
|
||||
Text = "FormContractorFuelDistributionReport";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePicker;
|
||||
private Label label1;
|
||||
private Label labelFileName;
|
||||
private Button buttonFile;
|
||||
private Button buttonBuild;
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
using SessionResults_Kudyaeva.Reports;
|
||||
using Unity;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Forms
|
||||
{
|
||||
public partial class FormMarksDistributionReport : Form
|
||||
{
|
||||
private string _fileName = string.Empty;
|
||||
private readonly IUnityContainer _container;
|
||||
public FormMarksDistributionReport(IUnityContainer container)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
}
|
||||
|
||||
private void buttonBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(_fileName))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
if
|
||||
(_container.Resolve<ChartReport>().CreateChart(_fileName, dateTimePicker.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании очета",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buttonFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Pdf Files | *.pdf"
|
||||
};
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_fileName = sfd.FileName;
|
||||
labelFileName.Text = Path.GetFileName(_fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
162
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/FormStudentReport.Designer.cs
generated
Normal file
162
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/FormStudentReport.Designer.cs
generated
Normal file
@ -0,0 +1,162 @@
|
||||
namespace SessionResults_Kudyaeva.Forms
|
||||
{
|
||||
partial class FormStudentReport
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
dateTimePickerEnd = new DateTimePicker();
|
||||
dateTimePickerStart = new DateTimePicker();
|
||||
comboBoxStudent = new ComboBox();
|
||||
textBoxFilePath = new TextBox();
|
||||
buttonFile = new Button();
|
||||
buttonBuild = new Button();
|
||||
label1 = new Label();
|
||||
label2 = new Label();
|
||||
label3 = new Label();
|
||||
label4 = new Label();
|
||||
SuspendLayout();
|
||||
//
|
||||
// dateTimePickerEnd
|
||||
//
|
||||
dateTimePickerEnd.Location = new Point(118, 137);
|
||||
dateTimePickerEnd.Name = "dateTimePickerEnd";
|
||||
dateTimePickerEnd.Size = new Size(200, 23);
|
||||
dateTimePickerEnd.TabIndex = 0;
|
||||
//
|
||||
// dateTimePickerStart
|
||||
//
|
||||
dateTimePickerStart.Location = new Point(118, 99);
|
||||
dateTimePickerStart.Name = "dateTimePickerStart";
|
||||
dateTimePickerStart.Size = new Size(200, 23);
|
||||
dateTimePickerStart.TabIndex = 1;
|
||||
//
|
||||
// comboBoxStudent
|
||||
//
|
||||
comboBoxStudent.FormattingEnabled = true;
|
||||
comboBoxStudent.Location = new Point(118, 59);
|
||||
comboBoxStudent.Name = "comboBoxStudent";
|
||||
comboBoxStudent.Size = new Size(198, 23);
|
||||
comboBoxStudent.TabIndex = 2;
|
||||
//
|
||||
// textBoxFilePath
|
||||
//
|
||||
textBoxFilePath.Location = new Point(118, 20);
|
||||
textBoxFilePath.Name = "textBoxFilePath";
|
||||
textBoxFilePath.Size = new Size(166, 23);
|
||||
textBoxFilePath.TabIndex = 3;
|
||||
//
|
||||
// buttonFile
|
||||
//
|
||||
buttonFile.Location = new Point(290, 20);
|
||||
buttonFile.Name = "buttonFile";
|
||||
buttonFile.Size = new Size(26, 23);
|
||||
buttonFile.TabIndex = 4;
|
||||
buttonFile.Text = "...";
|
||||
buttonFile.UseVisualStyleBackColor = true;
|
||||
buttonFile.Click += buttonFile_Click;
|
||||
//
|
||||
// buttonBuild
|
||||
//
|
||||
buttonBuild.Location = new Point(22, 181);
|
||||
buttonBuild.Name = "buttonBuild";
|
||||
buttonBuild.Size = new Size(296, 23);
|
||||
buttonBuild.TabIndex = 5;
|
||||
buttonBuild.Text = "Сформировать";
|
||||
buttonBuild.UseVisualStyleBackColor = true;
|
||||
buttonBuild.Click += buttonBuild_Click;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.Location = new Point(22, 23);
|
||||
label1.Name = "label1";
|
||||
label1.Size = new Size(90, 15);
|
||||
label1.TabIndex = 6;
|
||||
label1.Text = "Путь до файла:";
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.Location = new Point(22, 62);
|
||||
label2.Name = "label2";
|
||||
label2.Size = new Size(53, 15);
|
||||
label2.TabIndex = 7;
|
||||
label2.Text = "Студент:";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
label3.AutoSize = true;
|
||||
label3.Location = new Point(22, 105);
|
||||
label3.Name = "label3";
|
||||
label3.Size = new Size(77, 15);
|
||||
label3.TabIndex = 8;
|
||||
label3.Text = "Дата начала:";
|
||||
//
|
||||
// label4
|
||||
//
|
||||
label4.AutoSize = true;
|
||||
label4.Location = new Point(22, 143);
|
||||
label4.Name = "label4";
|
||||
label4.Size = new Size(71, 15);
|
||||
label4.TabIndex = 9;
|
||||
label4.Text = "Дата конца:";
|
||||
//
|
||||
// FormStudentReport
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(345, 227);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(buttonBuild);
|
||||
Controls.Add(buttonFile);
|
||||
Controls.Add(textBoxFilePath);
|
||||
Controls.Add(comboBoxStudent);
|
||||
Controls.Add(dateTimePickerStart);
|
||||
Controls.Add(dateTimePickerEnd);
|
||||
Name = "FormStudentReport";
|
||||
Text = "Отчет по студенту";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private DateTimePicker dateTimePickerEnd;
|
||||
private DateTimePicker dateTimePickerStart;
|
||||
private ComboBox comboBoxStudent;
|
||||
private TextBox textBoxFilePath;
|
||||
private Button buttonFile;
|
||||
private Button buttonBuild;
|
||||
private Label label1;
|
||||
private Label label2;
|
||||
private Label label3;
|
||||
private Label label4;
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
using SessionResults_Kudyaeva.Reports;
|
||||
using SessionResults_Kudyaeva.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Forms
|
||||
{
|
||||
public partial class FormStudentReport : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
|
||||
public FormStudentReport(IUnityContainer container, IStudentRepository studentRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
|
||||
comboBoxStudent.DataSource = studentRepository.GetAllStudents();
|
||||
comboBoxStudent.DisplayMember = "DisplayName";
|
||||
comboBoxStudent.ValueMember = "Id";
|
||||
}
|
||||
|
||||
private void buttonFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
var sfd = new SaveFileDialog()
|
||||
{
|
||||
Filter = "Excel Files | *.xlsx"
|
||||
};
|
||||
if (sfd.ShowDialog() != DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
textBoxFilePath.Text = sfd.FileName;
|
||||
}
|
||||
|
||||
private void buttonBuild_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(textBoxFilePath.Text))
|
||||
{
|
||||
throw new Exception("Отсутствует имя файла для отчета");
|
||||
}
|
||||
if (comboBoxStudent.SelectedIndex < 0)
|
||||
{
|
||||
throw new Exception("Не выбран студент");
|
||||
}
|
||||
if (dateTimePickerEnd.Value <= dateTimePickerStart.Value)
|
||||
{
|
||||
throw new Exception("Дата начала должна быть раньше даты окончания");
|
||||
}
|
||||
if (_container.Resolve<TableReport>().CreateTable(textBoxFilePath.Text,(int)comboBoxStudent.SelectedValue!, dateTimePickerStart.Value, dateTimePickerEnd.Value))
|
||||
{
|
||||
MessageBox.Show("Документ сформирован",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Возникли ошибки при формировании документа.Подробности в логах",
|
||||
"Формирование документа",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при создании очета",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -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>
|
172
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/RetakeForm.Designer.cs
generated
Normal file
172
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/RetakeForm.Designer.cs
generated
Normal file
@ -0,0 +1,172 @@
|
||||
namespace SessionResults_Kudyaeva.Forms
|
||||
{
|
||||
partial class RetakeForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
lblSurname = new Label();
|
||||
lblName = new Label();
|
||||
lblMiddleName = new Label();
|
||||
lblGroup = new Label();
|
||||
ButtonSave = new Button();
|
||||
ButtonCancel = new Button();
|
||||
comboBoxStudent = new ComboBox();
|
||||
comboBoxTeacher = new ComboBox();
|
||||
comboBoxDiscipline = new ComboBox();
|
||||
comboBoxMark = new ComboBox();
|
||||
SuspendLayout();
|
||||
//
|
||||
// lblSurname
|
||||
//
|
||||
lblSurname.AutoSize = true;
|
||||
lblSurname.Location = new Point(38, 39);
|
||||
lblSurname.Name = "lblSurname";
|
||||
lblSurname.Size = new Size(50, 15);
|
||||
lblSurname.TabIndex = 0;
|
||||
lblSurname.Text = "Студент";
|
||||
//
|
||||
// lblName
|
||||
//
|
||||
lblName.AutoSize = true;
|
||||
lblName.Location = new Point(38, 69);
|
||||
lblName.Name = "lblName";
|
||||
lblName.Size = new Size(91, 15);
|
||||
lblName.TabIndex = 1;
|
||||
lblName.Text = "Преподаватель";
|
||||
//
|
||||
// lblMiddleName
|
||||
//
|
||||
lblMiddleName.AutoSize = true;
|
||||
lblMiddleName.Location = new Point(38, 101);
|
||||
lblMiddleName.Name = "lblMiddleName";
|
||||
lblMiddleName.Size = new Size(55, 15);
|
||||
lblMiddleName.TabIndex = 2;
|
||||
lblMiddleName.Text = "Предмет";
|
||||
//
|
||||
// lblGroup
|
||||
//
|
||||
lblGroup.AutoSize = true;
|
||||
lblGroup.Location = new Point(38, 130);
|
||||
lblGroup.Name = "lblGroup";
|
||||
lblGroup.Size = new Size(48, 15);
|
||||
lblGroup.TabIndex = 3;
|
||||
lblGroup.Text = "Оценка";
|
||||
//
|
||||
// ButtonSave
|
||||
//
|
||||
ButtonSave.Location = new Point(38, 176);
|
||||
ButtonSave.Name = "ButtonSave";
|
||||
ButtonSave.Size = new Size(96, 23);
|
||||
ButtonSave.TabIndex = 8;
|
||||
ButtonSave.Text = "Сохранить";
|
||||
ButtonSave.UseVisualStyleBackColor = true;
|
||||
ButtonSave.Click += ButtonSave_Click;
|
||||
//
|
||||
// ButtonCancel
|
||||
//
|
||||
ButtonCancel.Location = new Point(183, 176);
|
||||
ButtonCancel.Name = "ButtonCancel";
|
||||
ButtonCancel.Size = new Size(96, 23);
|
||||
ButtonCancel.TabIndex = 9;
|
||||
ButtonCancel.Text = "Отменить";
|
||||
ButtonCancel.UseVisualStyleBackColor = true;
|
||||
ButtonCancel.Click += ButtonCancel_Click;
|
||||
//
|
||||
// comboBoxStudent
|
||||
//
|
||||
comboBoxStudent.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxStudent.FormattingEnabled = true;
|
||||
comboBoxStudent.Location = new Point(138, 36);
|
||||
comboBoxStudent.Name = "comboBoxStudent";
|
||||
comboBoxStudent.Size = new Size(141, 23);
|
||||
comboBoxStudent.TabIndex = 10;
|
||||
//
|
||||
// comboBoxTeacher
|
||||
//
|
||||
comboBoxTeacher.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxTeacher.FormattingEnabled = true;
|
||||
comboBoxTeacher.Location = new Point(138, 66);
|
||||
comboBoxTeacher.Name = "comboBoxTeacher";
|
||||
comboBoxTeacher.Size = new Size(141, 23);
|
||||
comboBoxTeacher.TabIndex = 11;
|
||||
//
|
||||
// comboBoxDiscipline
|
||||
//
|
||||
comboBoxDiscipline.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxDiscipline.FormattingEnabled = true;
|
||||
comboBoxDiscipline.Location = new Point(138, 98);
|
||||
comboBoxDiscipline.Name = "comboBoxDiscipline";
|
||||
comboBoxDiscipline.Size = new Size(141, 23);
|
||||
comboBoxDiscipline.TabIndex = 12;
|
||||
//
|
||||
// comboBoxMark
|
||||
//
|
||||
comboBoxMark.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||
comboBoxMark.FormattingEnabled = true;
|
||||
comboBoxMark.Location = new Point(138, 127);
|
||||
comboBoxMark.Name = "comboBoxMark";
|
||||
comboBoxMark.Size = new Size(141, 23);
|
||||
comboBoxMark.TabIndex = 13;
|
||||
//
|
||||
// RetakeForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(331, 224);
|
||||
Controls.Add(comboBoxMark);
|
||||
Controls.Add(comboBoxDiscipline);
|
||||
Controls.Add(comboBoxTeacher);
|
||||
Controls.Add(comboBoxStudent);
|
||||
Controls.Add(ButtonCancel);
|
||||
Controls.Add(ButtonSave);
|
||||
Controls.Add(lblGroup);
|
||||
Controls.Add(lblMiddleName);
|
||||
Controls.Add(lblName);
|
||||
Controls.Add(lblSurname);
|
||||
Name = "RetakeForm";
|
||||
Text = "Пересдача";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Label lblSurname;
|
||||
private Label lblName;
|
||||
private Label lblMiddleName;
|
||||
private Label lblGroup;
|
||||
private TextBox textBoxSurname;
|
||||
private TextBox textBoxName;
|
||||
private TextBox textBoxMiddleName;
|
||||
private Button ButtonSave;
|
||||
private Button ButtonCancel;
|
||||
private ComboBox comboBoxStudent;
|
||||
private ComboBox comboBoxTeacher;
|
||||
private ComboBox comboBoxDiscipline;
|
||||
private ComboBox comboBoxMark;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
using SessionResults_Kudyaeva.Entities.Enums;
|
||||
using SessionResults_Kudyaeva.Repositories;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Forms;
|
||||
|
||||
public partial class RetakeForm : Form
|
||||
{
|
||||
private readonly IRetakeRepository _retakeRepository;
|
||||
|
||||
public RetakeForm(IRetakeRepository retakeRepository, IStudentRepository studentRepository, ITeacherRepository teacherRepository, IDisciplineRepository disciplineRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
comboBoxStudent.DataSource = studentRepository.GetAllStudents();
|
||||
comboBoxStudent.DisplayMember = "DisplayName";
|
||||
comboBoxStudent.ValueMember = "Id";
|
||||
|
||||
comboBoxTeacher.DataSource = teacherRepository.GetAllTeachers();
|
||||
comboBoxTeacher.DisplayMember = "DisplayName";
|
||||
comboBoxTeacher.ValueMember = "Id";
|
||||
|
||||
comboBoxDiscipline.DataSource = disciplineRepository.GetAllDisciplines();
|
||||
comboBoxDiscipline.DisplayMember = "Name";
|
||||
comboBoxDiscipline.ValueMember = "Id";
|
||||
|
||||
comboBoxMark.DataSource = Enum.GetValues(typeof(Mark)).Cast<int>().ToList();
|
||||
|
||||
_retakeRepository = retakeRepository ??
|
||||
throw new ArgumentNullException(nameof(retakeRepository));
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (comboBoxDiscipline.SelectedItem == null ||
|
||||
comboBoxTeacher.SelectedItem == null ||
|
||||
comboBoxStudent.SelectedItem == null)
|
||||
{
|
||||
throw new Exception("Имеются незаполненные поля");
|
||||
}
|
||||
|
||||
_retakeRepository.CreateRetake(Retake.CreateOperation(0, (int)comboBoxStudent.SelectedValue!, (int)comboBoxTeacher.SelectedValue!, (int)comboBoxDiscipline.SelectedValue!, (Mark)comboBoxMark.SelectedValue!, DateTime.Now ));
|
||||
Close();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при сохранении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void ButtonCancel_Click(object sender, EventArgs e) => Close();
|
||||
}
|
@ -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>
|
97
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/RetakeListForm.Designer.cs
generated
Normal file
97
SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/RetakeListForm.Designer.cs
generated
Normal file
@ -0,0 +1,97 @@
|
||||
namespace SessionResults_Kudyaeva.Forms
|
||||
{
|
||||
partial class RetakeListForm
|
||||
{
|
||||
/// <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()
|
||||
{
|
||||
panel1 = new Panel();
|
||||
ButtonAdd = new Button();
|
||||
dataGridViewData = new DataGridView();
|
||||
panel1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).BeginInit();
|
||||
SuspendLayout();
|
||||
//
|
||||
// panel1
|
||||
//
|
||||
panel1.Controls.Add(ButtonAdd);
|
||||
panel1.Dock = DockStyle.Right;
|
||||
panel1.Location = new Point(845, 0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Size = new Size(114, 449);
|
||||
panel1.TabIndex = 0;
|
||||
//
|
||||
// ButtonAdd
|
||||
//
|
||||
ButtonAdd.BackgroundImage = Properties.Resources.Add;
|
||||
ButtonAdd.BackgroundImageLayout = ImageLayout.Stretch;
|
||||
ButtonAdd.Location = new Point(6, 12);
|
||||
ButtonAdd.Name = "ButtonAdd";
|
||||
ButtonAdd.Size = new Size(100, 100);
|
||||
ButtonAdd.TabIndex = 3;
|
||||
ButtonAdd.UseVisualStyleBackColor = true;
|
||||
ButtonAdd.Click += ButtonAdd_Click;
|
||||
//
|
||||
// dataGridViewData
|
||||
//
|
||||
dataGridViewData.AllowUserToAddRows = false;
|
||||
dataGridViewData.AllowUserToDeleteRows = false;
|
||||
dataGridViewData.AllowUserToResizeColumns = false;
|
||||
dataGridViewData.AllowUserToResizeRows = false;
|
||||
dataGridViewData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
|
||||
dataGridViewData.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
dataGridViewData.Dock = DockStyle.Fill;
|
||||
dataGridViewData.Location = new Point(0, 0);
|
||||
dataGridViewData.MultiSelect = false;
|
||||
dataGridViewData.Name = "dataGridViewData";
|
||||
dataGridViewData.ReadOnly = true;
|
||||
dataGridViewData.RowHeadersVisible = false;
|
||||
dataGridViewData.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||
dataGridViewData.Size = new Size(845, 449);
|
||||
dataGridViewData.TabIndex = 4;
|
||||
//
|
||||
// RetakeListForm
|
||||
//
|
||||
AutoScaleDimensions = new SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
ClientSize = new Size(959, 449);
|
||||
Controls.Add(dataGridViewData);
|
||||
Controls.Add(panel1);
|
||||
Name = "RetakeListForm";
|
||||
Text = "Создание пересдачи";
|
||||
Load += RetakeListForm_Load;
|
||||
panel1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)dataGridViewData).EndInit();
|
||||
ResumeLayout(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private Panel panel1;
|
||||
private Button ButtonAdd;
|
||||
private DataGridView dataGridViewData;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
using SessionResults_Kudyaeva.Repositories;
|
||||
using Unity;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Forms;
|
||||
|
||||
public partial class RetakeListForm : Form
|
||||
{
|
||||
private readonly IUnityContainer _container;
|
||||
private readonly IRetakeRepository _retakeRepository;
|
||||
|
||||
public RetakeListForm(IUnityContainer container, IRetakeRepository retakeRepository)
|
||||
{
|
||||
InitializeComponent();
|
||||
_container = container ?? throw new ArgumentNullException(nameof(container));
|
||||
_retakeRepository = retakeRepository ?? throw new ArgumentNullException(nameof(retakeRepository));
|
||||
}
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_container.Resolve<RetakeForm>().ShowDialog();
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при добавлении", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadList() => dataGridViewData.DataSource = _retakeRepository.GetAllRetakes();
|
||||
|
||||
private void RetakeListForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
LoadList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(ex.Message, "Ошибка при загрузке", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
@ -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>
|
@ -44,6 +44,7 @@ public partial class StatementForm : Form
|
||||
_statementRepository.CreateStatement(Statement.CreateOperation(0,
|
||||
(int)comboBoxTeacher.SelectedValue!,
|
||||
(int)comboBoxDiscipline.SelectedValue!,
|
||||
DateTime.Now,
|
||||
CreateListStatementStudentFromDataGrid()));
|
||||
|
||||
Close();
|
||||
|
@ -1,21 +1,11 @@
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
using SessionResults_Kudyaeva.Repositories;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Forms;
|
||||
|
||||
public partial class StudentForm : Form
|
||||
{
|
||||
private readonly IStudentRepository _studentRepository;
|
||||
private readonly IGroupRepository _groupRepository;
|
||||
private int? _studentId;
|
||||
|
||||
public int Id
|
||||
@ -51,9 +41,6 @@ public partial class StudentForm : Form
|
||||
comboBoxGroup.ValueMember = "Id";
|
||||
_studentRepository = studentRepository ??
|
||||
throw new ArgumentNullException(nameof(studentRepository));
|
||||
_groupRepository = groupRepository ??
|
||||
throw new ArgumentNullException(nameof(groupRepository));
|
||||
|
||||
}
|
||||
|
||||
private void ButtonSave_Click(object sender, EventArgs e)
|
||||
|
@ -6,8 +6,6 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Serilog;
|
||||
using Unity.Microsoft.Logging;
|
||||
using ProjectGasStation.Repositories.Implementations;
|
||||
using ProjectGasStation.Repositories;
|
||||
|
||||
namespace SessionResults_Kudyaeva
|
||||
{
|
||||
@ -36,6 +34,7 @@ namespace SessionResults_Kudyaeva
|
||||
container.RegisterType<ITeacherRepository, TeacherRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IDisciplineRepository, DisciplineRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IStatementRepository, StatementRepository>(new TransientLifetimeManager());
|
||||
container.RegisterType<IRetakeRepository, RetakeRepository>(new TransientLifetimeManager());
|
||||
|
||||
container.RegisterType<IConnectionString, ConnectionString>();
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SessionResults_Kudyaeva.Repositories;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Reports;
|
||||
|
||||
internal class ChartReport
|
||||
{
|
||||
private readonly IStatementRepository _statementRepository;
|
||||
private readonly ILogger<ChartReport> _logger;
|
||||
|
||||
public ChartReport(IStatementRepository statementRepository, ILogger<ChartReport> logger)
|
||||
{
|
||||
_statementRepository = statementRepository ?? throw new ArgumentNullException(nameof(statementRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateChart(string filePath, DateTime dateTime)
|
||||
{
|
||||
try
|
||||
{
|
||||
new PdfBuilder(filePath)
|
||||
.AddHeader("Выставленные оценки по предметам")
|
||||
.AddPieChart("Предметы", GetData(dateTime))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
private List<(string Caption, double Value)> GetData(DateTime dateTime)
|
||||
{
|
||||
return _statementRepository
|
||||
.GetAllStatements()
|
||||
.Where(x => x.Date.Date == dateTime.Date)
|
||||
.GroupBy(x => x.DisciplineId, (key, group) => new {
|
||||
Id = key,
|
||||
Count = group.Sum(statement => statement.StatementStudents.Count())
|
||||
})
|
||||
.Select(x => (x.Id.ToString(), (double)x.Count))
|
||||
.ToList();
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SessionResults_Kudyaeva.Repositories;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Reports;
|
||||
|
||||
public class DocReport
|
||||
{
|
||||
private readonly IDisciplineRepository _disciplineRepository;
|
||||
private readonly IGroupRepository _groupRepository;
|
||||
private readonly IStudentRepository _studentRepository;
|
||||
private readonly ITeacherRepository _teacherRepository;
|
||||
private readonly ILogger<DocReport> _logger;
|
||||
|
||||
public DocReport(IDisciplineRepository disciplineRepository, IGroupRepository groupRepository, IStudentRepository studentRepository, ITeacherRepository teacherRepository, ILogger<DocReport> logger)
|
||||
{
|
||||
_disciplineRepository = disciplineRepository ?? throw new ArgumentNullException(nameof(disciplineRepository));
|
||||
_groupRepository = groupRepository ?? throw new ArgumentNullException(nameof(groupRepository));
|
||||
_studentRepository = studentRepository ?? throw new ArgumentNullException(nameof(studentRepository));
|
||||
_teacherRepository = teacherRepository ?? throw new ArgumentNullException(nameof(teacherRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateDoc(string filePath, bool includeDisciplines, bool includeGroups, bool includeStudents, bool includeTeachers)
|
||||
{
|
||||
try
|
||||
{
|
||||
var builder = new WordBuilder(filePath).AddHeader("Документ со справочниками");
|
||||
if (includeDisciplines)
|
||||
{
|
||||
builder.AddParagraph("Предметы").AddTable([2400, 2400, 2400], GetDisciplines());
|
||||
}
|
||||
if (includeGroups)
|
||||
{
|
||||
builder.AddParagraph("Группы").AddTable([2400, 2400], GetGroups());
|
||||
}
|
||||
if (includeStudents)
|
||||
{
|
||||
builder.AddParagraph("Студенты").AddTable([2400, 2400, 2400], GetStudents());
|
||||
}
|
||||
if (includeTeachers)
|
||||
{
|
||||
builder.AddParagraph("Преподаватели").AddTable([2400, 2400, 2400], GetTeachers());
|
||||
}
|
||||
builder.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private List<string[]> GetDisciplines()
|
||||
{
|
||||
return [
|
||||
["Название", "Описание", "На каких курсах"],
|
||||
.. _disciplineRepository
|
||||
.GetAllDisciplines()
|
||||
.Select(x => new string[] { x.Name, x.Description, x.Courses.ToString() }),
|
||||
];
|
||||
}
|
||||
|
||||
private List<string[]> GetGroups()
|
||||
{
|
||||
return [
|
||||
["Название", "Тип"],
|
||||
.. _groupRepository
|
||||
.GetAllGroups()
|
||||
.Select(x => new string[] { x.Name, x.Type.ToString() }),
|
||||
];
|
||||
}
|
||||
|
||||
private List<string[]> GetStudents()
|
||||
{
|
||||
return [
|
||||
["Фамилия", "Имя", "Отчество"],
|
||||
.. _studentRepository
|
||||
.GetAllStudents()
|
||||
.Select(x => new string[] { x.Surname, x.Name, x.MiddleName }),
|
||||
];
|
||||
}
|
||||
|
||||
private List<string[]> GetTeachers()
|
||||
{
|
||||
return [
|
||||
["Фамилия", "Имя", "Отчество"],
|
||||
.. _teacherRepository
|
||||
.GetAllTeachers()
|
||||
.Select(x => new string[] { x.Surname, x.Name, x.MiddleName }),
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,311 @@
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
using DocumentFormat.OpenXml.Spreadsheet;
|
||||
using DocumentFormat.OpenXml;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Reports;
|
||||
|
||||
internal class ExcelBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly SheetData _sheetData;
|
||||
private readonly MergeCells _mergeCells;
|
||||
private readonly Columns _columns;
|
||||
private uint _rowIndex = 0;
|
||||
|
||||
public ExcelBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_sheetData = new SheetData();
|
||||
_mergeCells = new MergeCells();
|
||||
_columns = new Columns();
|
||||
_rowIndex = 1;
|
||||
}
|
||||
|
||||
public ExcelBuilder AddHeader(string header, int startIndex, int count)
|
||||
{
|
||||
CreateCell(startIndex, _rowIndex, header, StyleIndex.BoldTextWithoutBorder);
|
||||
for (int i = startIndex + 1; i < startIndex + count; ++i)
|
||||
{
|
||||
CreateCell(i, _rowIndex, "", StyleIndex.SimpleTextWithoutBorder);
|
||||
}
|
||||
_mergeCells.Append(new MergeCell()
|
||||
{
|
||||
Reference = new StringValue($"{GetExcelColumnName(startIndex)}{_rowIndex}:{GetExcelColumnName(startIndex + count - 1)}{_rowIndex}")
|
||||
});
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExcelBuilder AddParagraph(string text, int columnIndex)
|
||||
{
|
||||
CreateCell(columnIndex, _rowIndex++, text, StyleIndex.SimpleTextWithoutBorder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ExcelBuilder AddTable(int[] columnsWidths, List<string[]> data)
|
||||
{
|
||||
if (columnsWidths == null || columnsWidths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(columnsWidths));
|
||||
}
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
if (data.Any(x => x.Length != columnsWidths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("widths.Length != data.Length");
|
||||
}
|
||||
|
||||
uint counter = 1;
|
||||
int coef = 2;
|
||||
_columns.Append(columnsWidths.Select(x => new Column
|
||||
{
|
||||
Min = counter,
|
||||
Max = counter++,
|
||||
Width = x * coef,
|
||||
CustomWidth = true
|
||||
}));
|
||||
for (var j = 0; j < data.First().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.First()[j], StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
|
||||
for (var i = 1; i < data.Count - 1; ++i)
|
||||
{
|
||||
for (var j = 0; j < data[i].Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data[i][j], StyleIndex.SimpleTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
}
|
||||
for (var j = 0; j < data.Last().Length; ++j)
|
||||
{
|
||||
CreateCell(j, _rowIndex, data.Last()[j], StyleIndex.BoldTextWithBorder);
|
||||
}
|
||||
_rowIndex++;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
using var spreadsheetDocument = SpreadsheetDocument.Create(_filePath, SpreadsheetDocumentType.Workbook);
|
||||
var workbookpart = spreadsheetDocument.AddWorkbookPart();
|
||||
GenerateStyle(workbookpart);
|
||||
workbookpart.Workbook = new Workbook();
|
||||
var worksheetPart = workbookpart.AddNewPart<WorksheetPart>();
|
||||
worksheetPart.Worksheet = new Worksheet();
|
||||
|
||||
if (_columns.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.Append(_columns);
|
||||
}
|
||||
|
||||
worksheetPart.Worksheet.Append(_sheetData);
|
||||
var sheets = spreadsheetDocument.WorkbookPart!.Workbook.AppendChild(new Sheets());
|
||||
var sheet = new Sheet()
|
||||
{
|
||||
Id = spreadsheetDocument.WorkbookPart.GetIdOfPart(worksheetPart),
|
||||
SheetId = 1,
|
||||
Name = "Лист 1"
|
||||
};
|
||||
sheets.Append(sheet);
|
||||
if (_mergeCells.HasChildren)
|
||||
{
|
||||
worksheetPart.Worksheet.InsertAfter(_mergeCells,
|
||||
worksheetPart.Worksheet.Elements<SheetData>().First());
|
||||
}
|
||||
}
|
||||
|
||||
private static void GenerateStyle(WorkbookPart workbookPart)
|
||||
{
|
||||
var workbookStylesPart = workbookPart.AddNewPart<WorkbookStylesPart>();
|
||||
workbookStylesPart.Stylesheet = new Stylesheet();
|
||||
|
||||
var fonts = new Fonts()
|
||||
{
|
||||
Count = 2,
|
||||
KnownFonts = BooleanValue.FromBoolean(true)
|
||||
};
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme()
|
||||
{
|
||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
}
|
||||
});
|
||||
fonts.Append(new DocumentFormat.OpenXml.Spreadsheet.Font
|
||||
{
|
||||
FontSize = new FontSize() { Val = 11 },
|
||||
FontName = new FontName() { Val = "Calibri" },
|
||||
FontFamilyNumbering = new FontFamilyNumbering() { Val = 2 },
|
||||
FontScheme = new FontScheme()
|
||||
{
|
||||
Val = new EnumValue<FontSchemeValues>(FontSchemeValues.Minor)
|
||||
},
|
||||
Bold = new Bold() { Val = true }
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fonts);
|
||||
|
||||
// Default Fill
|
||||
var fills = new Fills() { Count = 1 };
|
||||
fills.Append(new Fill
|
||||
{
|
||||
PatternFill = new PatternFill()
|
||||
{
|
||||
PatternType = new EnumValue<PatternValues>(PatternValues.None)
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(fills);
|
||||
|
||||
// Default Border
|
||||
var borders = new Borders() { Count = 2 };
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder(),
|
||||
RightBorder = new RightBorder(),
|
||||
TopBorder = new TopBorder(),
|
||||
BottomBorder = new BottomBorder(),
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
borders.Append(new Border
|
||||
{
|
||||
LeftBorder = new LeftBorder() { Style = BorderStyleValues.Thin },
|
||||
RightBorder = new RightBorder() { Style = BorderStyleValues.Thin },
|
||||
TopBorder = new TopBorder() { Style = BorderStyleValues.Thin },
|
||||
BottomBorder = new BottomBorder() { Style = BorderStyleValues.Thin },
|
||||
DiagonalBorder = new DiagonalBorder()
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(borders);
|
||||
|
||||
// Default cell format and a date cell format
|
||||
var cellFormats = new CellFormats() { Count = 4 };
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Left,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 0,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Right,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 0,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
cellFormats.Append(new CellFormat
|
||||
{
|
||||
NumberFormatId = 0,
|
||||
FormatId = 0,
|
||||
FontId = 1,
|
||||
BorderId = 1,
|
||||
FillId = 0,
|
||||
Alignment = new Alignment()
|
||||
{
|
||||
Horizontal = HorizontalAlignmentValues.Center,
|
||||
Vertical = VerticalAlignmentValues.Center,
|
||||
WrapText = true
|
||||
}
|
||||
});
|
||||
workbookStylesPart.Stylesheet.Append(cellFormats);
|
||||
}
|
||||
|
||||
private enum StyleIndex
|
||||
{
|
||||
SimpleTextWithoutBorder = 0,
|
||||
SimpleTextWithBorder = 1,
|
||||
BoldTextWithoutBorder = 2,
|
||||
BoldTextWithBorder = 3,
|
||||
}
|
||||
|
||||
private void CreateCell(int columnIndex, uint rowIndex, string text, StyleIndex styleIndex)
|
||||
{
|
||||
var columnName = GetExcelColumnName(columnIndex);
|
||||
var cellReference = columnName + rowIndex;
|
||||
var row = _sheetData.Elements<Row>().FirstOrDefault(r => r.RowIndex! == rowIndex);
|
||||
if (row == null)
|
||||
{
|
||||
row = new Row() { RowIndex = rowIndex };
|
||||
_sheetData.Append(row);
|
||||
}
|
||||
var newCell = row.Elements<Cell>().FirstOrDefault(c => c.CellReference != null &&
|
||||
c.CellReference.Value == columnName + rowIndex);
|
||||
if (newCell == null)
|
||||
{
|
||||
Cell? refCell = null;
|
||||
foreach (Cell cell in row.Elements<Cell>())
|
||||
{
|
||||
if (cell.CellReference?.Value != null &&
|
||||
cell.CellReference.Value.Length == cellReference.Length)
|
||||
{
|
||||
if (string.Compare(cell.CellReference.Value, cellReference, true) > 0)
|
||||
{
|
||||
refCell = cell;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
newCell = new Cell() { CellReference = cellReference };
|
||||
row.InsertBefore(newCell, refCell);
|
||||
}
|
||||
newCell.CellValue = new CellValue(text);
|
||||
newCell.DataType = CellValues.String;
|
||||
newCell.StyleIndex = (uint)styleIndex;
|
||||
}
|
||||
|
||||
private static string GetExcelColumnName(int columnNumber)
|
||||
{
|
||||
columnNumber += 1;
|
||||
int dividend = columnNumber;
|
||||
string columnName = string.Empty;
|
||||
int modulo;
|
||||
while (dividend > 0)
|
||||
{
|
||||
modulo = (dividend - 1) % 26;
|
||||
columnName = Convert.ToChar(65 + modulo).ToString() + columnName;
|
||||
dividend = (dividend - modulo) / 26;
|
||||
}
|
||||
return columnName;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
using MigraDoc.DocumentObjectModel;
|
||||
using MigraDoc.DocumentObjectModel.Shapes.Charts;
|
||||
using MigraDoc.Rendering;
|
||||
using System.Text;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Reports;
|
||||
|
||||
internal class PdfBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
|
||||
public PdfBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
DefineStyles();
|
||||
}
|
||||
|
||||
public PdfBuilder AddHeader(string header)
|
||||
{
|
||||
_document.AddSection().AddParagraph(header, "NormalBold");
|
||||
return this;
|
||||
}
|
||||
|
||||
public PdfBuilder AddPieChart(string title, List<(string Caption, double Value)> data)
|
||||
{
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
return this;
|
||||
}
|
||||
var chart = new Chart(ChartType.Pie2D);
|
||||
var series = chart.SeriesCollection.AddSeries();
|
||||
series.Add(data.Select(x => x.Value).ToArray());
|
||||
var xseries = chart.XValues.AddXSeries();
|
||||
xseries.Add(data.Select(x => x.Caption).ToArray());
|
||||
chart.DataLabel.Type = DataLabelType.Percent;
|
||||
chart.DataLabel.Position = DataLabelPosition.OutsideEnd;
|
||||
chart.Width = Unit.FromCentimeter(16);
|
||||
chart.Height = Unit.FromCentimeter(12);
|
||||
chart.TopArea.AddParagraph(title);
|
||||
chart.XAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.MajorTickMark = TickMarkType.Outside;
|
||||
chart.YAxis.HasMajorGridlines = true;
|
||||
chart.PlotArea.LineFormat.Width = 1;
|
||||
chart.PlotArea.LineFormat.Visible = true;
|
||||
chart.TopArea.AddLegend();
|
||||
_document.LastSection.Add(chart);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||
var renderer = new PdfDocumentRenderer(true)
|
||||
{
|
||||
Document = _document
|
||||
};
|
||||
renderer.RenderDocument();
|
||||
renderer.PdfDocument.Save(_filePath);
|
||||
}
|
||||
private void DefineStyles()
|
||||
{
|
||||
var headerStyle = _document.Styles.AddStyle("NormalBold", "Normal");
|
||||
headerStyle.Font.Bold = true;
|
||||
headerStyle.Font.Size = 14;
|
||||
}
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using SessionResults_Kudyaeva.Entities.Enums;
|
||||
using SessionResults_Kudyaeva.Repositories;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Reports;
|
||||
|
||||
internal class TableReport
|
||||
{
|
||||
private readonly IStatementRepository _statementRepository;
|
||||
private readonly IRetakeRepository _retakeRepository;
|
||||
private readonly ILogger<TableReport> _logger;
|
||||
internal static readonly string[] item = ["Предмет", "Дата", "Оценка", "Пересдача"];
|
||||
|
||||
public TableReport(IStatementRepository statementRepository, IRetakeRepository retakeRepository, ILogger<TableReport> logger)
|
||||
{
|
||||
_statementRepository = statementRepository ?? throw new ArgumentNullException(nameof(statementRepository));
|
||||
_retakeRepository = retakeRepository ?? throw new ArgumentNullException(nameof(retakeRepository));
|
||||
_logger = logger ?? throw new ArgumentNullException(nameof(logger));
|
||||
}
|
||||
|
||||
public bool CreateTable(string filePath, int studentId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
new ExcelBuilder(filePath)
|
||||
.AddHeader("Сводка по оценкам студента", 0, 3)
|
||||
.AddParagraph("за период", 0)
|
||||
.AddTable([10, 15, 15, 15], GetData(studentId, startDate, endDate))
|
||||
.Build();
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при формировании документа");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private List<string[]> GetData(int studentId, DateTime startDate, DateTime endDate)
|
||||
{
|
||||
var statements = _statementRepository
|
||||
.GetAllStatements()
|
||||
.Where(x => x.Date >= startDate && x.Date <= endDate && x.StatementStudents.Any(y => y.StudentId == studentId))
|
||||
.Select(x => new {
|
||||
Discipline = x.DisciplineId.ToString(),
|
||||
x.Date,
|
||||
Mark = x.StatementStudents.FirstOrDefault(y => y.StudentId == studentId)?.Mark,
|
||||
RetakeMark = (int?)null
|
||||
});
|
||||
|
||||
var retakes = _retakeRepository
|
||||
.GetAllRetakes()
|
||||
.Where(x => x.Date >= startDate && x.Date <= endDate && x.StudentId == studentId)
|
||||
.Select(x => new {
|
||||
Discipline = x.DisciplineId.ToString(),
|
||||
x.Date,
|
||||
Mark = (Mark?)null,
|
||||
RetakeMark = (int?)x.Mark
|
||||
});
|
||||
|
||||
var data = statements
|
||||
.Union(retakes)
|
||||
.OrderBy(x => x.Date)
|
||||
.Select(x => new string[] {
|
||||
x.Discipline,
|
||||
x.Date.ToString("dd.MM.yyyy"),
|
||||
x.Mark.HasValue ? ((int)x.Mark.Value).ToString() : string.Empty,
|
||||
x.RetakeMark.HasValue ? x.RetakeMark.Value.ToString() : string.Empty
|
||||
})
|
||||
.ToList();
|
||||
|
||||
data.Insert(0, item);
|
||||
|
||||
var averageMark = data.Skip(1)
|
||||
.Select(row => double.TryParse(row[2], out var mark) ? mark : (double?)null)
|
||||
.Where(mark => mark != null)
|
||||
.Average(mark => mark.Value);
|
||||
|
||||
var averageRetakeMark = data.Skip(1)
|
||||
.Select(row => double.TryParse(row[3], out var retakeMark) ? retakeMark : (double?)null)
|
||||
.Where(retakeMark => retakeMark != null)
|
||||
.Average(retakeMark => retakeMark.Value);
|
||||
|
||||
var averageRow = new string[]
|
||||
{
|
||||
"Среднее",
|
||||
string.Empty,
|
||||
((double)averageMark) > 0 ? ((double)averageMark).ToString("F2") : string.Empty,
|
||||
((double)averageRetakeMark) > 0 ? ((double)averageRetakeMark).ToString("F2") : string.Empty
|
||||
};
|
||||
|
||||
data.Add(averageRow);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,129 @@
|
||||
using DocumentFormat.OpenXml;
|
||||
using DocumentFormat.OpenXml.Wordprocessing;
|
||||
using DocumentFormat.OpenXml.Packaging;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Reports;
|
||||
|
||||
public class WordBuilder
|
||||
{
|
||||
private readonly string _filePath;
|
||||
private readonly Document _document;
|
||||
private readonly Body _body;
|
||||
|
||||
public WordBuilder(string filePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filePath))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(filePath));
|
||||
}
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
File.Delete(filePath);
|
||||
}
|
||||
_filePath = filePath;
|
||||
_document = new Document();
|
||||
_body = _document.AppendChild(new Body());
|
||||
}
|
||||
|
||||
public WordBuilder AddHeader(string header)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
var runProperties = run.AppendChild(new RunProperties());
|
||||
runProperties.AppendChild(new Bold());
|
||||
run.AppendChild(new Text(header));
|
||||
return this;
|
||||
}
|
||||
|
||||
public WordBuilder AddParagraph(string text)
|
||||
{
|
||||
var paragraph = _body.AppendChild(new Paragraph());
|
||||
var run = paragraph.AppendChild(new Run());
|
||||
run.AppendChild(new Text(text));
|
||||
return this;
|
||||
}
|
||||
|
||||
public WordBuilder AddTable(int[] widths, List<string[]> data)
|
||||
{
|
||||
if (widths == null || widths.Length == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(widths));
|
||||
}
|
||||
if (data == null || data.Count == 0)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(data));
|
||||
}
|
||||
if (data.Any(x => x.Length != widths.Length))
|
||||
{
|
||||
throw new InvalidOperationException("widths.Length != data.Length");
|
||||
}
|
||||
var table = new Table();
|
||||
table.AppendChild(new TableProperties(
|
||||
new TableBorders(
|
||||
new TopBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new BottomBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new LeftBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new RightBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideHorizontalBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
},
|
||||
new InsideVerticalBorder()
|
||||
{
|
||||
Val = new
|
||||
EnumValue<BorderValues>(BorderValues.Single),
|
||||
Size = 12
|
||||
}
|
||||
)
|
||||
));
|
||||
|
||||
var tr = new TableRow();
|
||||
for (var j = 0; j < widths.Length; ++j)
|
||||
{
|
||||
tr.Append(new TableCell(
|
||||
new TableCellProperties(new TableCellWidth()
|
||||
{
|
||||
Width =
|
||||
widths[j].ToString()
|
||||
}),
|
||||
new Paragraph(new Run(new RunProperties(new Bold()), new
|
||||
Text(data.First()[j])))));
|
||||
}
|
||||
table.Append(tr);
|
||||
|
||||
table.Append(data.Skip(1).Select(x =>
|
||||
new TableRow(x.Select(y => new TableCell(new Paragraph(new Run(new Text(y))))))));
|
||||
_body.Append(table);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Build()
|
||||
{
|
||||
using var wordDocument = WordprocessingDocument.Create(_filePath,
|
||||
WordprocessingDocumentType.Document);
|
||||
var mainPart = wordDocument.AddMainDocumentPart();
|
||||
mainPart.Document = _document;
|
||||
}
|
||||
}
|
@ -4,7 +4,7 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ProjectGasStation.Repositories;
|
||||
namespace SessionResults_Kudyaeva.Repositories;
|
||||
|
||||
public interface IConnectionString
|
||||
{
|
||||
|
@ -0,0 +1,14 @@
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Repositories;
|
||||
|
||||
public interface IRetakeRepository
|
||||
{
|
||||
void CreateRetake(Retake retake);
|
||||
IEnumerable<Retake> GetAllRetakes();
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
namespace ProjectGasStation.Repositories.Implementations;
|
||||
namespace SessionResults_Kudyaeva.Repositories.Implementations;
|
||||
|
||||
public class ConnectionString : IConnectionString
|
||||
{
|
||||
|
@ -2,12 +2,10 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectGasStation.Repositories;
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Repositories.Implementations;
|
||||
|
||||
|
||||
public class DisciplineRepository : IDisciplineRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
|
@ -2,7 +2,6 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectGasStation.Repositories;
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Repositories.Implementations;
|
||||
|
@ -0,0 +1,58 @@
|
||||
using Dapper;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Repositories.Implementations;
|
||||
|
||||
public class RetakeRepository : IRetakeRepository
|
||||
{
|
||||
private readonly IConnectionString _connectionString;
|
||||
private readonly ILogger<RetakeRepository> _logger;
|
||||
|
||||
public RetakeRepository(IConnectionString connectionString, ILogger<RetakeRepository> logger)
|
||||
{
|
||||
_connectionString = connectionString;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void CreateRetake(Retake retake)
|
||||
{
|
||||
_logger.LogInformation("Добавление объекта");
|
||||
_logger.LogDebug("Объект: {json}", JsonConvert.SerializeObject(retake));
|
||||
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var queryInsert = @"
|
||||
INSERT INTO Retake (StudentId, TeacherId, DisciplineId, Mark, Date)
|
||||
VALUES (@StudentId, @TeacherId, @DisciplineId, @Mark, @Date)";
|
||||
connection.Execute(queryInsert, retake);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при добавлении объекта");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<Retake> GetAllRetakes()
|
||||
{
|
||||
_logger.LogInformation("Получение всех объектов");
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM Retake";
|
||||
var retakes = connection.Query<Retake>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(retakes));
|
||||
return retakes;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка при чтении объектов");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using ProjectGasStation.Repositories;
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
|
||||
namespace SessionResults_Kudyaeva.Repositories.Implementations;
|
||||
@ -61,11 +60,12 @@ public class StatementRepository : IStatementRepository
|
||||
try
|
||||
{
|
||||
using var connection = new NpgsqlConnection(_connectionString.ConnectionString);
|
||||
var querySelect = "SELECT * FROM Statement";
|
||||
var statements = connection.Query<Statement>(querySelect);
|
||||
var querySelect = @"SELECT s.*, ss.StudentId, ss.Mark FROM Statement s
|
||||
INNER JOIN StatementStudent ss on ss.StatementId = s.Id";
|
||||
var statements = connection.Query<TempStatementStudent>(querySelect);
|
||||
_logger.LogDebug("Полученные объекты: {json}",
|
||||
JsonConvert.SerializeObject(statements));
|
||||
return statements;
|
||||
return statements.GroupBy(x => x.Id, y => y, (key, value) => Statement.CreateOperation(value.First(), value.Select(z => StatementStudent.CreateOperation(0, z.StudentId, z.Mark)))).ToList();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectGasStation.Repositories;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using Dapper;
|
||||
|
@ -1,6 +1,5 @@
|
||||
using SessionResults_Kudyaeva.Entities;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using ProjectGasStation.Repositories;
|
||||
using Newtonsoft.Json;
|
||||
using Npgsql;
|
||||
using Dapper;
|
||||
|
@ -10,11 +10,13 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.1.35" />
|
||||
<PackageReference Include="DocumentFormat.OpenXml" Version="3.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Npgsql" Version="9.0.1" />
|
||||
<PackageReference Include="PdfSharp.MigraDoc.Standard" Version="1.51.15" />
|
||||
<PackageReference Include="Serilog" Version="4.1.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
|
||||
@ -24,6 +26,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Forms\RetakeForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Forms\RetakeListForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Update="Properties\Resources.Designer.cs">
|
||||
<DesignTime>True</DesignTime>
|
||||
<AutoGen>True</AutoGen>
|
||||
|
Loading…
x
Reference in New Issue
Block a user