diff --git a/ElectronicDiary/ElectronicDiary.sln b/ElectronicDiary/ElectronicDiary.sln index 1353129..9c039cf 100644 --- a/ElectronicDiary/ElectronicDiary.sln +++ b/ElectronicDiary/ElectronicDiary.sln @@ -5,6 +5,10 @@ VisualStudioVersion = 17.9.34728.123 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicDiaryView", "ElectronicDiaryView\ElectronicDiaryView.csproj", "{10EDFF55-E102-493B-9725-D8DC5498A286}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicDiaryAbstractions", "ElectronicDiaryAbstractions\ElectronicDiaryAbstractions.csproj", "{5E4A8B65-0CCB-448F-A39A-A987B6904E08}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElectronicDiaryPostgresImplementation", "ElectronicDiaryPostgresImplementation\ElectronicDiaryPostgresImplementation.csproj", "{2ED128E3-A299-4AA8-9607-6B528CDD66A6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -15,6 +19,14 @@ Global {10EDFF55-E102-493B-9725-D8DC5498A286}.Debug|Any CPU.Build.0 = Debug|Any CPU {10EDFF55-E102-493B-9725-D8DC5498A286}.Release|Any CPU.ActiveCfg = Release|Any CPU {10EDFF55-E102-493B-9725-D8DC5498A286}.Release|Any CPU.Build.0 = Release|Any CPU + {5E4A8B65-0CCB-448F-A39A-A987B6904E08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E4A8B65-0CCB-448F-A39A-A987B6904E08}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E4A8B65-0CCB-448F-A39A-A987B6904E08}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E4A8B65-0CCB-448F-A39A-A987B6904E08}.Release|Any CPU.Build.0 = Release|Any CPU + {2ED128E3-A299-4AA8-9607-6B528CDD66A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2ED128E3-A299-4AA8-9607-6B528CDD66A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2ED128E3-A299-4AA8-9607-6B528CDD66A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2ED128E3-A299-4AA8-9607-6B528CDD66A6}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/ElectronicDiaryAbstractions.csproj b/ElectronicDiary/ElectronicDiaryAbstractions/ElectronicDiaryAbstractions.csproj new file mode 100644 index 0000000..132c02c --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/ElectronicDiaryAbstractions.csproj @@ -0,0 +1,9 @@ + + + + net6.0 + enable + enable + + + diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/Grade.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Grade.cs new file mode 100644 index 0000000..892ca20 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Grade.cs @@ -0,0 +1,11 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class Grade + { + public int Id { get; set; } + + public string Name { get; set; } = string.Empty; + + public int TeacherId { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/Homework.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Homework.cs new file mode 100644 index 0000000..fbff8a4 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Homework.cs @@ -0,0 +1,15 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class Homework + { + public int Id { get; set; } + + public string Description { get; set; } = string.Empty; + + public DateTime Deadline { get; set; } + + public bool IsAccepted { get; set; } + + public int MarkId { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/Lesson.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Lesson.cs new file mode 100644 index 0000000..bb50bb1 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Lesson.cs @@ -0,0 +1,25 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class Lesson + { + public int Id { get; set; } + + public DateTime LessonDate { get; set; } + + public bool IsMissed { get; set; } + + public string TeacherComment { get; set; } = string.Empty; + + public int MarkId { get; set; } + + public int HomeworkId { get; set; } + + public int StudentId { get; set; } + + public int SubjectId { get; set; } + + public int TeacherId { get; set; } + + public int StudyAreaId { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/Mark.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Mark.cs new file mode 100644 index 0000000..16a5800 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Mark.cs @@ -0,0 +1,9 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class Mark + { + public int Id { get; set; } + + public int Value { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/Student.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Student.cs new file mode 100644 index 0000000..dcb36ce --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Student.cs @@ -0,0 +1,17 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class Student + { + public int Id { get; set; } + + public string LastName { get; set; } = string.Empty; + + public string FirstName { get; set; } = string.Empty; + + public string Patronymic { get; set; } = string.Empty; + + public int GradeId { get; set; } + + public int UserId { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/StudyArea.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/StudyArea.cs new file mode 100644 index 0000000..143178a --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/StudyArea.cs @@ -0,0 +1,11 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class StudyArea + { + public int Id { get; set; } + + public string Name { get; set; } = string.Empty; + + public string Type { get; set; } = string.Empty; + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/Subject.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Subject.cs new file mode 100644 index 0000000..5e3221d --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Subject.cs @@ -0,0 +1,9 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class Subject + { + public int Id { get; set; } + + public string Name { get; set; } = string.Empty; + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/SubjectStudent.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/SubjectStudent.cs new file mode 100644 index 0000000..8b3ccf2 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/SubjectStudent.cs @@ -0,0 +1,9 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class SubjectStudent + { + public int SubjectId { get; set; } + + public int StudentId { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/SubjectTeacher.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/SubjectTeacher.cs new file mode 100644 index 0000000..a5a1fec --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/SubjectTeacher.cs @@ -0,0 +1,9 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class SubjectTeacher + { + public int SubjectId { get; set; } + + public int TeacherId { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/Teacher.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Teacher.cs new file mode 100644 index 0000000..bacc390 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/Teacher.cs @@ -0,0 +1,15 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class Teacher + { + public int Id { get; set; } + + public string LastName { get; set; } = string.Empty; + + public string FirstName { get; set; } = string.Empty; + + public string Patronymic { get; set; } = string.Empty; + + public int UserId { get; set; } + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/Models/User.cs b/ElectronicDiary/ElectronicDiaryAbstractions/Models/User.cs new file mode 100644 index 0000000..7056cac --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/Models/User.cs @@ -0,0 +1,17 @@ +namespace ElectronicDiaryAbstractions.Models +{ + public class User + { + public int Id { get; set; } + + public string Login { get; set; } = string.Empty; + + public string Email { get; set; } = string.Empty; + + public string Password { get; set; } = string.Empty; + + public string PhoneNumber { get; set; } = string.Empty; + + public string AccessLevel { get; set; } = string.Empty; + } +} diff --git a/ElectronicDiary/ElectronicDiaryAbstractions/WorkAbstractions/ISubjectWork.cs b/ElectronicDiary/ElectronicDiaryAbstractions/WorkAbstractions/ISubjectWork.cs new file mode 100644 index 0000000..3616648 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryAbstractions/WorkAbstractions/ISubjectWork.cs @@ -0,0 +1,17 @@ +using ElectronicDiaryAbstractions.Models; + +namespace ElectronicDiaryAbstractions.WorkAbstractions +{ + public interface ISubjectWork + { + List GetAll(); + + Subject Get(int id); + + Subject Create(Subject subject); + + Subject Update(Subject subject); + + Subject Delete(int id); + } +} diff --git a/ElectronicDiary/ElectronicDiaryPostgresImplementation/ElectronicDiaryPostgresImplementation.csproj b/ElectronicDiary/ElectronicDiaryPostgresImplementation/ElectronicDiaryPostgresImplementation.csproj new file mode 100644 index 0000000..66fdedc --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryPostgresImplementation/ElectronicDiaryPostgresImplementation.csproj @@ -0,0 +1,17 @@ + + + + net6.0 + enable + enable + + + + + + + + + + + diff --git a/ElectronicDiary/ElectronicDiaryPostgresImplementation/SqlConnection.cs b/ElectronicDiary/ElectronicDiaryPostgresImplementation/SqlConnection.cs new file mode 100644 index 0000000..dc64d10 --- /dev/null +++ b/ElectronicDiary/ElectronicDiaryPostgresImplementation/SqlConnection.cs @@ -0,0 +1,12 @@ +using Npgsql; + +namespace ElectronicDiaryPostgresImplementation +{ + public class SqlConnection + { + public static NpgsqlConnection GetConnection() + { + return new NpgsqlConnection("Host=localhost;Port=5432;Username=postgres;Database=diary_bd;Password=bythop423956"); + } + } +}