diff --git a/StudentProgressRecord/Entity/Department.cs b/StudentProgressRecord/Entity/Department.cs deleted file mode 100644 index bbad602..0000000 --- a/StudentProgressRecord/Entity/Department.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.Entity -{ - public class Department - { - - public long Id { get; set; } - - public string DepartmentName { get; set; } - - public long FacultyId { get; set; } - - public static Department CreateEntity(long id, string DepartmentName, long facultyId) - { - return new Department - { - Id = id, - DepartmentName = DepartmentName, - FacultyId = facultyId - }; - } - } -} diff --git a/StudentProgressRecord/Entity/Enums/Operations.cs b/StudentProgressRecord/Entity/Enums/Operations.cs new file mode 100644 index 0000000..bb295a8 --- /dev/null +++ b/StudentProgressRecord/Entity/Enums/Operations.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentProgressRecord.Entity.Enums +{ + [Flags] + public enum Operations + { + None = 0, + + Transfer = 1 << 0, + + Enroll = 1 << 1, + + Expel = 1 << 2, + } +} diff --git a/StudentProgressRecord/Entity/Faculty.cs b/StudentProgressRecord/Entity/Faculty.cs deleted file mode 100644 index b7e1acd..0000000 --- a/StudentProgressRecord/Entity/Faculty.cs +++ /dev/null @@ -1,25 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.Entity -{ - public class Faculty - { - public long Id { get; set; } - - public string FacultyName { get; set; } - - public static Faculty CreateEntity(long id, string facultyName) - { - return new Faculty() - { - Id = id, - FacultyName = facultyName - }; - - } - } -} diff --git a/StudentProgressRecord/Entity/Group.cs b/StudentProgressRecord/Entity/Group.cs deleted file mode 100644 index 91bbec0..0000000 --- a/StudentProgressRecord/Entity/Group.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.Entity -{ - public class Group - { - public long Id { get; set; } - - public string GroupName { get; set; } - - public long DepartmentId { get; set; } - - public static Group CreateEntity(long id, string groupName, long departmentId) - { - return new Group - { - Id = id, - GroupName = groupName, - DepartmentId = departmentId - }; - } - - } -} diff --git a/StudentProgressRecord/Entity/Marks.cs b/StudentProgressRecord/Entity/Marks.cs new file mode 100644 index 0000000..5338d97 --- /dev/null +++ b/StudentProgressRecord/Entity/Marks.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentProgressRecord.Entity +{ + public class Marks + { + public long Id { get; set; } + + public long StatementId { get; set; } + + public long StudentId { get; set; } + + public int Mark { get; set; } + + public static Marks CreateElement(long id, long statementId, long studentId) + { + return new Marks + { + Id = id, + StatementId = statementId, + StudentId = studentId + }; + } + } +} diff --git a/StudentProgressRecord/Entity/Statement.cs b/StudentProgressRecord/Entity/Statement.cs index 8b272f9..a6ec764 100644 --- a/StudentProgressRecord/Entity/Statement.cs +++ b/StudentProgressRecord/Entity/Statement.cs @@ -9,26 +9,28 @@ namespace StudentProgressRecord.Entity { public class Statement { + public long Id { get; set; } public long SubjectId { get; set; } public long TeacherId { get; set; } - public long StudentId { get; set; } - public DateTime Date { get; set; } - public int Mark { get; set; } + public IEnumerable Marks { get; private set; } = []; - public static Statement CreateEntity(long subjectId, long teacherId, long studentId, DateTime timeStamp, int mark) + public static Statement CreateOperation(long id, long subjectId, long teacherId, + DateTime timeStamp, IEnumerable marks) { - return new Statement - { - SubjectId = subjectId, + return new Statement + { + Id = id, + SubjectId = subjectId, TeacherId = teacherId, - StudentId = studentId, Date = timeStamp, - Mark = mark }; + Marks = marks + }; } + } } diff --git a/StudentProgressRecord/Entity/Student.cs b/StudentProgressRecord/Entity/Student.cs index aad65b5..3afdc6f 100644 --- a/StudentProgressRecord/Entity/Student.cs +++ b/StudentProgressRecord/Entity/Student.cs @@ -17,17 +17,16 @@ namespace StudentProgressRecord.Entity public bool Domitory { get; set; } - public long GroupId { get; set; } - public static Student CreateEntity(long id, string fio, bool familyPos, bool domitory, long groupId) + public static Student CreateEntity(long id, string fio, bool familyPos, + bool domitory) { return new Student { Id = id, Fio = fio, FamilyPos = familyPos, - Domitory = domitory, - GroupId = groupId + Domitory = domitory }; } } diff --git a/StudentProgressRecord/Entity/StudentTransition.cs b/StudentProgressRecord/Entity/StudentTransition.cs new file mode 100644 index 0000000..ab970b1 --- /dev/null +++ b/StudentProgressRecord/Entity/StudentTransition.cs @@ -0,0 +1,32 @@ +using StudentProgressRecord.Entity.Enums; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentProgressRecord.Entity +{ + public class StudentTransition + { + + public long Id { get; set; } + + public long StudentId { get; set; } + + public Operations Operation { get; set; } + + public DateTime timeStamp { get; set; } + + public static StudentTransition CreateOperation(long id, long studentId, Operations operation, DateTime time) + { + return new StudentTransition + { + Id = id, + StudentId = studentId, + Operation = operation, + timeStamp = time + }; + } + } +} diff --git a/StudentProgressRecord/FormFaculty.Designer.cs b/StudentProgressRecord/FormFaculty.Designer.cs deleted file mode 100644 index 34707db..0000000 --- a/StudentProgressRecord/FormFaculty.Designer.cs +++ /dev/null @@ -1,93 +0,0 @@ -namespace StudentProgressRecord -{ - partial class FormFaculty - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - labelFaculty = new Label(); - textBoxFaculty = new TextBox(); - buttonApply = new Button(); - buttonCancel = new Button(); - SuspendLayout(); - // - // labelFaculty - // - labelFaculty.AutoSize = true; - labelFaculty.Location = new Point(12, 95); - labelFaculty.Name = "labelFaculty"; - labelFaculty.Size = new Size(157, 20); - labelFaculty.TabIndex = 0; - labelFaculty.Text = "Название факультета"; - // - // textBoxFaculty - // - textBoxFaculty.Location = new Point(175, 92); - textBoxFaculty.Name = "textBoxFaculty"; - textBoxFaculty.Size = new Size(348, 27); - textBoxFaculty.TabIndex = 1; - // - // buttonApply - // - buttonApply.Location = new Point(85, 144); - buttonApply.Name = "buttonApply"; - buttonApply.Size = new Size(180, 29); - buttonApply.TabIndex = 2; - buttonApply.Text = "Сохранить"; - buttonApply.UseVisualStyleBackColor = true; - // - // buttonCancel - // - buttonCancel.Location = new Point(271, 144); - buttonCancel.Name = "buttonCancel"; - buttonCancel.Size = new Size(180, 29); - buttonCancel.TabIndex = 3; - buttonCancel.Text = "Отмена"; - buttonCancel.UseVisualStyleBackColor = true; - // - // FormFaculty - // - AutoScaleDimensions = new SizeF(8F, 20F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(535, 263); - Controls.Add(buttonCancel); - Controls.Add(buttonApply); - Controls.Add(textBoxFaculty); - Controls.Add(labelFaculty); - Name = "FormFaculty"; - Text = "Факультет"; - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private Label labelFaculty; - private TextBox textBoxFaculty; - private Button buttonApply; - private Button buttonCancel; - } -} \ No newline at end of file diff --git a/StudentProgressRecord/FormFaculty.cs b/StudentProgressRecord/FormFaculty.cs deleted file mode 100644 index b2279bd..0000000 --- a/StudentProgressRecord/FormFaculty.cs +++ /dev/null @@ -1,74 +0,0 @@ -using StudentProgressRecord.Entity; -using StudentProgressRecord.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 StudentProgressRecord -{ - public partial class FormFaculty : Form - { - - private readonly IFacultyRepository _facultyRepository; - private int? _facultyId; - public int Id - { - set - { - try - { - var faculty = - _facultyRepository.ReadFacultyById(value); - if (faculty == null) - { - throw new InvalidDataException(nameof(faculty)); - } - textBoxFaculty.Text = faculty.FacultyName; - _facultyId = value; - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при полученииданных", MessageBoxButtons.OK, MessageBoxIcon.Error); - return; - } - } - } - public FormFaculty(IFacultyRepository facultyRepository) - { - InitializeComponent(); - _facultyRepository = facultyRepository ?? throw new ArgumentNullException(nameof(facultyRepository)); - } - private void ButtonSave_Click(object sender, EventArgs e) - { - try - { - if (string.IsNullOrWhiteSpace(textBoxFaculty.Text)) - { - throw new Exception("Название факультета не может быть пустым"); - } - if (_facultyId.HasValue) - { - _facultyRepository.UpdateFaculty(CreateFaculty(_facultyId.Value)); - } - else - { - _facultyRepository.CreateFaculty(CreateFaculty(0)); - } - Close(); - } - catch (Exception ex) - { - MessageBox.Show(ex.Message, "Ошибка при сохранении", - MessageBoxButtons.OK, MessageBoxIcon.Error); - } - } - private void ButtonCancel_Click(object sender, EventArgs e) => Close(); - private Faculty CreateFaculty(int id) => Faculty.CreateEntity(id, textBoxFaculty.Text); - } -} diff --git a/StudentProgressRecord/FormFaculty.resx b/StudentProgressRecord/FormFaculty.resx deleted file mode 100644 index af32865..0000000 --- a/StudentProgressRecord/FormFaculty.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/StudentProgressRecord/IRepositories/IDepartmentRepository.cs b/StudentProgressRecord/IRepositories/IDepartmentRepository.cs deleted file mode 100644 index 434fb6d..0000000 --- a/StudentProgressRecord/IRepositories/IDepartmentRepository.cs +++ /dev/null @@ -1,20 +0,0 @@ -using StudentProgressRecord.Entity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.Repositories -{ - public interface IDepartmentRepository - { - - IEnumerable ReadDepartments(long? facultyId=null); - Department ReadDepartmentById(long id); - void CreateDepartment(Department department); - void UpdateDepartment(Department department); - void DeleteDepartment(long id); - - } -} diff --git a/StudentProgressRecord/IRepositories/IFacultyRepository.cs b/StudentProgressRecord/IRepositories/IFacultyRepository.cs deleted file mode 100644 index 1b1603e..0000000 --- a/StudentProgressRecord/IRepositories/IFacultyRepository.cs +++ /dev/null @@ -1,19 +0,0 @@ -using StudentProgressRecord.Entity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.Repositories -{ - public interface IFacultyRepository - { - IEnumerable ReadFaculties(); - Faculty ReadFacultyById(long id); - void CreateFaculty(Faculty faculty); - void UpdateFaculty(Faculty faculty); - void DeleteFaculty(long id); - - } -} diff --git a/StudentProgressRecord/IRepositories/IGroupRepository.cs b/StudentProgressRecord/IRepositories/IGroupRepository.cs deleted file mode 100644 index e73f1e3..0000000 --- a/StudentProgressRecord/IRepositories/IGroupRepository.cs +++ /dev/null @@ -1,19 +0,0 @@ -using StudentProgressRecord.Entity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using System.Threading.Tasks; - -namespace StudentProgressRecord.Repositories -{ - public interface IGroupRepository - { - IEnumerable ReadGroups(long? departmentId=null); - Group ReadGroupById(long id); - void CreateGroup(Group group); - void UpdateGroup(Group group); - void DeleteGroup(long id); - } -} diff --git a/StudentProgressRecord/IRepositories/IStatementRepository.cs b/StudentProgressRecord/IRepositories/IStatementRepository.cs index e819ea1..05f2b28 100644 --- a/StudentProgressRecord/IRepositories/IStatementRepository.cs +++ b/StudentProgressRecord/IRepositories/IStatementRepository.cs @@ -4,10 +4,9 @@ namespace StudentProgressRecord.Repositories { public interface IStatementRepository { - IEnumerable ReadStatements(long? subjectId, long? teacherId, long? studentId, DateTime? dateTo=null, int? mark=null); - Statement ReadStatementById(long id); + IEnumerable ReadStatements(long? subjectId = null, long? teacherId = null, DateTime? dateFrom = null, DateTime? dateTo=null); + void CreateStatement(Statement statement); - void UpdateStatement(Statement statement); void DeleteStatement(long id); } } diff --git a/StudentProgressRecord/IRepositories/IStudentRepository.cs b/StudentProgressRecord/IRepositories/IStudentRepository.cs index 9197538..3990746 100644 --- a/StudentProgressRecord/IRepositories/IStudentRepository.cs +++ b/StudentProgressRecord/IRepositories/IStudentRepository.cs @@ -9,7 +9,7 @@ namespace StudentProgressRecord.Repositories { public interface IStudentRepository { - IEnumerable ReadStudents(long? groupId = null, bool? familyPos=null, bool? domitory=null); + IEnumerable ReadStudents(bool? familyPos=null, bool? domitory=null); Student ReadStudentById(long id); void CreateStudent(Student student); void UpdateStudent(Student student); diff --git a/StudentProgressRecord/IRepositories/IStudentTransitionRepository.cs b/StudentProgressRecord/IRepositories/IStudentTransitionRepository.cs new file mode 100644 index 0000000..21a1d6d --- /dev/null +++ b/StudentProgressRecord/IRepositories/IStudentTransitionRepository.cs @@ -0,0 +1,18 @@ +using StudentProgressRecord.Entity; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace StudentProgressRecord.IRepositories +{ + public interface IStudentTransitionRepository + { + + IEnumerable ReadStudentTransitions(long? groupId = null, bool? familyPos = null, bool? domitory = null); + StudentTransition ReadStudentTransitionById(long id); + void CreateStudentTransition(StudentTransition studentTransition); + void DeleteStudentTransition(long id); + } +} diff --git a/StudentProgressRecord/RepositoryImp/DepartmentRepository.cs b/StudentProgressRecord/RepositoryImp/DepartmentRepository.cs deleted file mode 100644 index 3e94cef..0000000 --- a/StudentProgressRecord/RepositoryImp/DepartmentRepository.cs +++ /dev/null @@ -1,38 +0,0 @@ -using StudentProgressRecord.Entity; -using StudentProgressRecord.Repositories; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.RepositoryImp -{ - public class DepartmentRepository : IDepartmentRepository - { - public void CreateDepartment(Department department) - { - - } - - public void DeleteDepartment(long id) - { - - } - - public Department ReadDepartmentById(long id) - { - return Department.CreateDepartment(0, string.Empty, 0); - } - - public IEnumerable ReadDepartments(long? facultyId = null) - { - return []; - } - - public void UpdateDepartment(Department department) - { - - } - } -} diff --git a/StudentProgressRecord/RepositoryImp/FacultyRepository.cs b/StudentProgressRecord/RepositoryImp/FacultyRepository.cs deleted file mode 100644 index dc05a5d..0000000 --- a/StudentProgressRecord/RepositoryImp/FacultyRepository.cs +++ /dev/null @@ -1,38 +0,0 @@ -using StudentProgressRecord.Entity; -using StudentProgressRecord.Repositories; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.RepositoryImp -{ - public class FacultyRepository : IFacultyRepository - { - public void CreateFaculty(Faculty faculty) - { - - } - - public void DeleteFaculty(long id) - { - - } - - public IEnumerable ReadFaculties() - { - return []; - } - - public Faculty ReadFacultyById(long id) - { - return Faculty.CreateFaculty(0, string.Empty); - } - - public void UpdateFaculty(Faculty faculty) - { - - } - } -} diff --git a/StudentProgressRecord/RepositoryImp/GroupRepository.cs b/StudentProgressRecord/RepositoryImp/GroupRepository.cs deleted file mode 100644 index 822ecf5..0000000 --- a/StudentProgressRecord/RepositoryImp/GroupRepository.cs +++ /dev/null @@ -1,37 +0,0 @@ -using StudentProgressRecord.Entity; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace StudentProgressRecord.Repositories -{ - public class GroupRepository : IGroupRepository - { - public void CreateGroup(Group group) - { - - } - - public void DeleteGroup(long id) - { - - } - - public Group ReadGroupById(long id) - { - return Group.CreateGroup(0, string.Empty, 0); - } - - public IEnumerable ReadGroups(long? departmentId = null) - { - return []; - } - - public void UpdateGroup(Group group) - { - - } - } -} diff --git a/StudentProgressRecord/RepositoryImp/StatementRepository.cs b/StudentProgressRecord/RepositoryImp/StatementRepository.cs index ac57fb2..ec4736d 100644 --- a/StudentProgressRecord/RepositoryImp/StatementRepository.cs +++ b/StudentProgressRecord/RepositoryImp/StatementRepository.cs @@ -12,27 +12,18 @@ namespace StudentProgressRecord.RepositoryImp { public void CreateStatement(Statement statement) { - + } public void DeleteStatement(long id) { - + } - public Statement ReadStatementById(long id) - { - return Statement.CreateStatement(0, 0, 0, DateTime.Now, 0); - } - - public IEnumerable ReadStatements(long? subjectId, long? teacherId, long? studentId, DateTime? dateTo = null, int? mark = null) + public IEnumerable ReadStatements(long? subjectId = null, long? teacherId = null, + DateTime? dateFrom = null, DateTime? dateTo = null) { return []; } - - public void UpdateStatement(Statement statement) - { - - } } } diff --git a/StudentProgressRecord/RepositoryImp/StudentRepository.cs b/StudentProgressRecord/RepositoryImp/StudentRepository.cs index 6c08807..a4ce0a1 100644 --- a/StudentProgressRecord/RepositoryImp/StudentRepository.cs +++ b/StudentProgressRecord/RepositoryImp/StudentRepository.cs @@ -12,7 +12,7 @@ namespace StudentProgressRecord.RepositoryImp { public void CreateStudent(Student student) { - + } public void DeleteStudent(long id) @@ -22,17 +22,17 @@ namespace StudentProgressRecord.RepositoryImp public Student ReadStudentById(long id) { - return Student.CreateStudent(0, string.Empty, false, false, 0); + return Student.CreateEntity(0, string.Empty, false , false); } - public IEnumerable ReadStudents(long? groupId = null, bool? familyPos = null, bool? domitory = null) + public IEnumerable ReadStudents(bool? familyPos = null, bool? domitory = null) { return []; } public void UpdateStudent(Student student) { - + } } } diff --git a/StudentProgressRecord/RepositoryImp/StudentTransitionRepository.cs b/StudentProgressRecord/RepositoryImp/StudentTransitionRepository.cs new file mode 100644 index 0000000..d646aca --- /dev/null +++ b/StudentProgressRecord/RepositoryImp/StudentTransitionRepository.cs @@ -0,0 +1,28 @@ +using StudentProgressRecord.Entity; +using StudentProgressRecord.IRepositories; +using StudentProgressRecord.Entity.Enums; +namespace StudentProgressRecord.RepositoryImp +{ + public class StudentTransitionRepository : IStudentTransitionRepository + { + public void CreateStudentTransition(StudentTransition studentTransition) + { + throw new NotImplementedException(); + } + + public void DeleteStudentTransition(long id) + { + throw new NotImplementedException(); + } + + public StudentTransition ReadStudentTransitionById(long id) + { + return StudentTransition.CreateOperation(0, 0, Operations.None, DateTime.Now); + } + + public IEnumerable ReadStudentTransitions(long? groupId = null, bool? familyPos = null, bool? domitory = null) + { + throw new NotImplementedException(); + } + } +} diff --git a/StudentProgressRecord/RepositoryImp/SubjectRepository.cs b/StudentProgressRecord/RepositoryImp/SubjectRepository.cs index b86d4e9..6ecf5f8 100644 --- a/StudentProgressRecord/RepositoryImp/SubjectRepository.cs +++ b/StudentProgressRecord/RepositoryImp/SubjectRepository.cs @@ -22,7 +22,7 @@ namespace StudentProgressRecord.RepositoryImp public Subject ReadSubjectById(long id) { - return Subject.CreateSubject(0, string.Empty); + return Subject.CreateEntity(0, string.Empty); } public IEnumerable ReadSubjects() diff --git a/StudentProgressRecord/RepositoryImp/TeacherRepository.cs b/StudentProgressRecord/RepositoryImp/TeacherRepository.cs index b335348..b815111 100644 --- a/StudentProgressRecord/RepositoryImp/TeacherRepository.cs +++ b/StudentProgressRecord/RepositoryImp/TeacherRepository.cs @@ -22,7 +22,7 @@ namespace StudentProgressRecord.RepositoryImp public Teacher ReadTeacherById(long id) { - return Teacher.CreateTeacher(0, string.Empty, 0); + return Teacher.CreateEntity(0, string.Empty, 0); } public IEnumerable ReadTeachers(long? departmentID = null)