From 2fc3adecc4bc622e1aad3a2362fcab95abf8471a Mon Sep 17 00:00:00 2001 From: Kudyaeva Date: Mon, 9 Dec 2024 10:25:58 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=B0=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/AddMark.cs | 31 --- .../Entities/Discipline.cs | 5 - .../Entities/Enums/Course.cs | 2 +- .../Entities/Enums/GroupType.cs | 8 +- .../Entities/Enums/Mark.cs | 1 - .../Entities/Statement.cs | 22 ++ .../Entities/StatementStudent.cs | 25 ++ .../Entities/Student.cs | 2 + .../Entities/Teacher.cs | 7 +- .../FormSessionResults.Designer.cs | 12 +- .../FormSessionResults.cs | 2 +- .../FormSessionResults.resx | 4 +- .../Forms/AddMarkForm.Designer.cs | 218 ------------------ .../Forms/AddMarkForm.cs | 86 ------- .../Forms/DisciplineForm.Designer.cs | 6 +- .../Forms/DisciplineForm.cs | 3 + .../Forms/DisciplineForm.resx | 4 +- .../Forms/StatementForm.Designer.cs | 172 ++++++++++++++ .../Forms/StatementForm.cs | 75 ++++++ .../{AddMarkForm.resx => StatementForm.resx} | 10 +- ...igner.cs => StatementListForm.Designer.cs} | 10 +- ...ddMarkListForm.cs => StatementListForm.cs} | 12 +- ...rkListForm.resx => StatementListForm.resx} | 0 .../Forms/StudentForm.cs | 9 +- .../Forms/TeacherForm.Designer.cs | 25 +- .../Forms/TeacherForm.cs | 4 +- .../Forms/TeacherForm.resx | 4 +- .../SessionResults_Kudyaeva/Program.cs | 24 +- .../Repositories/IAddMarkRepository.cs | 17 -- .../Repositories/IConnectionString.cs | 12 + .../Repositories/IStatementRepository.cs | 14 ++ .../Implementations/AddMarkRepository.cs | 39 ---- .../Implementations/ConnectionString.cs | 6 + .../Implementations/DisciplineRepository.cs | 109 ++++++++- .../Implementations/GroupRepository.cs | 108 ++++++++- .../Implementations/StatementRepository.cs | 76 ++++++ .../Implementations/StudentRepository.cs | 112 +++++++-- .../Implementations/TeacherRepository.cs | 115 +++++++-- .../SessionResults_Kudyaeva.csproj | 11 + .../SessionResults_Kudyaeva/appsettings.json | 15 ++ 40 files changed, 898 insertions(+), 519 deletions(-) delete mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/AddMark.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Statement.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/StatementStudent.cs delete mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/AddMarkForm.Designer.cs delete mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/AddMarkForm.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/StatementForm.Designer.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/StatementForm.cs rename SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/{AddMarkForm.resx => StatementForm.resx} (93%) rename SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/{AddMarkListForm.Designer.cs => StatementListForm.Designer.cs} (93%) rename SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/{AddMarkListForm.cs => StatementListForm.cs} (64%) rename SessionResults_Kudyaeva/SessionResults_Kudyaeva/Forms/{AddMarkListForm.resx => StatementListForm.resx} (100%) delete mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Repositories/IAddMarkRepository.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Repositories/IConnectionString.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Repositories/IStatementRepository.cs delete mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Repositories/Implementations/AddMarkRepository.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Repositories/Implementations/ConnectionString.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/Repositories/Implementations/StatementRepository.cs create mode 100644 SessionResults_Kudyaeva/SessionResults_Kudyaeva/appsettings.json diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/AddMark.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/AddMark.cs deleted file mode 100644 index f3507da..0000000 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/AddMark.cs +++ /dev/null @@ -1,31 +0,0 @@ -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 AddMark -{ - public int Id { get; private set; } - public int StudentId { get; private set; } - public int GroupId { get; private set; } - public int DisciplineId { get; private set; } - public Mark? Mark { get; private set; } // Оставляем тип Mark - public DateTime Date { get; private set; } - - public static AddMark CreateOperation(int id, int studentId, int groupId, int disciplineId, Mark mark) - { - return new AddMark - { - Id = id, - StudentId = studentId, - GroupId = groupId, - DisciplineId = disciplineId, - Mark = mark, // Если `Mark` имеет значение по умолчанию, его можно обработать - Date = DateTime.Now - }; - } -} diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Discipline.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Discipline.cs index 4e9b0e3..ab16ba8 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Discipline.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Discipline.cs @@ -1,9 +1,4 @@ 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; diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Course.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Course.cs index a074d75..53b31f7 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Course.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Course.cs @@ -9,7 +9,7 @@ namespace SessionResults_Kudyaeva.Entities.Enums; [Flags] public enum Course { - None = 0, + None, First = 1, // 1 курс Second = 2, // 2 курс Third = 4, // 3 курс diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/GroupType.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/GroupType.cs index 4e13716..d15e27b 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/GroupType.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/GroupType.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SessionResults_Kudyaeva.Entities.Enums; +namespace SessionResults_Kudyaeva.Entities.Enums; public enum GroupType { diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Mark.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Mark.cs index d368eee..9e91b1e 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Mark.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Enums/Mark.cs @@ -8,7 +8,6 @@ namespace SessionResults_Kudyaeva.Entities.Enums; public enum Mark { - None, One = 1, Two = 2, Three = 3, diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Statement.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Statement.cs new file mode 100644 index 0000000..80ec2ee --- /dev/null +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Statement.cs @@ -0,0 +1,22 @@ +namespace SessionResults_Kudyaeva.Entities; + +public class Statement +{ + 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 IEnumerable StatementStudents { get; private set; } = []; + + public static Statement CreateOperation(int id, int teacherId, int disciplineId, IEnumerable statementStudents) + { + return new Statement + { + Id = id, + TeacherId = teacherId, + DisciplineId = disciplineId, + Date = DateTime.Now, + StatementStudents = statementStudents + }; + } +} diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/StatementStudent.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/StatementStudent.cs new file mode 100644 index 0000000..18a00af --- /dev/null +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/StatementStudent.cs @@ -0,0 +1,25 @@ +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 StatementStudent +{ + public int Id { get; private set; } + public int StudentId { get; private set; } + public Mark Mark { get; private set; } + + public static StatementStudent CreateOperation(int id, int studentId, Mark mark) + { + return new StatementStudent + { + Id = id, + StudentId = studentId, + Mark = mark + }; + } +} diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Student.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Student.cs index 44add56..e65e02c 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Student.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Student.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using static System.Runtime.InteropServices.JavaScript.JSType; namespace SessionResults_Kudyaeva.Entities; @@ -14,6 +15,7 @@ public class Student public string Name { get; private set; } = string.Empty; public string MiddleName { get; private set; } = string.Empty; public int GroupID { get; private set; } + public string DisplayName => $"{Surname} {Name[0]}. {MiddleName[0]}."; public static Student Create(int id, string surname, string name, string middleName, int groupID) { diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Teacher.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Teacher.cs index 06b9fbe..297fd86 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Teacher.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/Entities/Teacher.cs @@ -12,17 +12,16 @@ public class Teacher public string Surname { get; private set; } = string.Empty; public string Name { get; private set; } = string.Empty; public string MiddleName { get; private set; } = string.Empty; - public int DisciplineID { get; private set; } + public string DisplayName => $"{Surname} {Name[0]}. {MiddleName[0]}."; - public static Teacher Create(int id, string surname, string name, string middleName, int disciplineID) + public static Teacher Create(int id, string surname, string name, string middleName) { return new Teacher { ID = id, Surname = surname, Name = name, - MiddleName = middleName, - DisciplineID = disciplineID + MiddleName = middleName }; } } diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.Designer.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.Designer.cs index 2681e00..95c4f20 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.Designer.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.Designer.cs @@ -59,28 +59,28 @@ // StudentsToolStripMenuItem // StudentsToolStripMenuItem.Name = "StudentsToolStripMenuItem"; - StudentsToolStripMenuItem.Size = new Size(159, 22); + StudentsToolStripMenuItem.Size = new Size(180, 22); StudentsToolStripMenuItem.Text = "Студенты"; StudentsToolStripMenuItem.Click += StudentsToolStripMenuItem_Click; // // GroupsToolStripMenuItem // GroupsToolStripMenuItem.Name = "GroupsToolStripMenuItem"; - GroupsToolStripMenuItem.Size = new Size(159, 22); + GroupsToolStripMenuItem.Size = new Size(180, 22); GroupsToolStripMenuItem.Text = "Группы"; GroupsToolStripMenuItem.Click += GroupsToolStripMenuItem_Click; // // TeachersToolStripMenuItem // TeachersToolStripMenuItem.Name = "TeachersToolStripMenuItem"; - TeachersToolStripMenuItem.Size = new Size(159, 22); + TeachersToolStripMenuItem.Size = new Size(180, 22); TeachersToolStripMenuItem.Text = "Преподаватели"; TeachersToolStripMenuItem.Click += TeachersToolStripMenuItem_Click; // // DisciplinesToolStripMenuItem // DisciplinesToolStripMenuItem.Name = "DisciplinesToolStripMenuItem"; - DisciplinesToolStripMenuItem.Size = new Size(159, 22); + DisciplinesToolStripMenuItem.Size = new Size(180, 22); DisciplinesToolStripMenuItem.Text = "Дисциплины"; DisciplinesToolStripMenuItem.Click += DisciplinesToolStripMenuItem_Click; // @@ -94,8 +94,8 @@ // AddMarksToolStripMenuItem // AddMarksToolStripMenuItem.Name = "AddMarksToolStripMenuItem"; - AddMarksToolStripMenuItem.Size = new Size(184, 22); - AddMarksToolStripMenuItem.Text = "Добавление оценки"; + AddMarksToolStripMenuItem.Size = new Size(236, 22); + AddMarksToolStripMenuItem.Text = "Создание результатов сессии"; AddMarksToolStripMenuItem.Click += AddMarksToolStripMenuItem_Click; // // отчетыToolStripMenuItem diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.cs b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.cs index a494cd8..b9dc61c 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.cs +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.cs @@ -74,7 +74,7 @@ public partial class FormSessionResults : Form { try { - _container.Resolve().ShowDialog(); + _container.Resolve().ShowDialog(); } catch (Exception ex) { diff --git a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.resx b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.resx index b48baf1..a0623c8 100644 --- a/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.resx +++ b/SessionResults_Kudyaeva/SessionResults_Kudyaeva/FormSessionResults.resx @@ -1,7 +1,7 @@