From be261d84d42bb6194e2bcca822495f80bc32b054 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Tue, 20 Dec 2022 22:28:40 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D0=B4=D0=B5=D0=BB=D0=B8=20?= =?UTF-8?q?=D0=B8=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B=20=D0=91?= =?UTF-8?q?=D0=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/CoreDatabase/DatabaseContext.cs | 2 + ...AddStudentMarkPassedDiscipline.Designer.cs | 1594 +++++++++++++++++ ...20182036_AddStudentMarkPassedDiscipline.cs | 61 + .../DatabaseContextModelSnapshot.cs | 68 + .../Models/Department/Discipline.cs | 3 + .../CoreDatabase/Models/Department/Student.cs | 3 + .../Department/StudentMarkPassedDiscipline.cs | 65 + .../Department/MarkDisciplinePassedType.cs | 22 + .../CoreModels/Enums/Department/Semester.cs | 2 + .../IStudentMarkPassedDisciplineModel.cs | 42 + 10 files changed, 1862 insertions(+) create mode 100644 DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.Designer.cs create mode 100644 DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.cs create mode 100644 DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs create mode 100644 DepartmentPortal/Common/CoreModels/Enums/Department/MarkDisciplinePassedType.cs create mode 100644 DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs diff --git a/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs b/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs index b336b27..ac84019 100644 --- a/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs +++ b/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs @@ -90,6 +90,7 @@ namespace CoreDatabase .WithMany(x => x.OrderStudentRecords) .OnDelete(DeleteBehavior.NoAction); + modelBuilder.Entity().HasIndex(d => new { d.StudentId, d.DisciplineId, d.Semester, d.Mark }).IsUnique(); } #region Security @@ -122,6 +123,7 @@ namespace CoreDatabase public virtual DbSet OrderStudentRecords { set; get; } public virtual DbSet OrderSyncHistories { set; get; } public virtual DbSet OrderSyncHistoryRecords { set; get; } + public virtual DbSet StudentMarkPassedDisciplines { set; get; } #endregion } } \ No newline at end of file diff --git a/DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.Designer.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.Designer.cs new file mode 100644 index 0000000..3cd008a --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.Designer.cs @@ -0,0 +1,1594 @@ +// +using System; +using CoreDatabase; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace CoreDatabase.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20221220182036_AddStudentMarkPassedDiscipline")] + partial class AddStudentMarkPassedDiscipline + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.15") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlan", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EducationDirectionId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastUpdateDate") + .HasColumnType("datetime2"); + + b.Property("YearStart") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EducationDirectionId", "YearStart") + .IsUnique() + .HasFilter("[EducationDirectionId] IS NOT NULL"); + + b.ToTable("AcademicPlans"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlanRecord", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AcademicPlanId") + .HasColumnType("uniqueidentifier"); + + b.Property("AcademicPlanRecordParentId") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("DisciplineId") + .HasColumnType("uniqueidentifier"); + + b.Property("InDepartment") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsFacultative") + .HasColumnType("bit"); + + b.Property("IsParent") + .HasColumnType("bit"); + + b.Property("Semester") + .HasColumnType("int"); + + b.Property("Zet") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineId"); + + b.HasIndex("AcademicPlanId", "DisciplineId", "Semester") + .IsUnique(); + + b.ToTable("AcademicPlanRecords"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlanRecordTimeNormHour", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AcademicPlanRecordId") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("PlanHours") + .HasColumnType("decimal(18,2)"); + + b.Property("TimeNormId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TimeNormId"); + + b.HasIndex("AcademicPlanRecordId", "TimeNormId") + .IsUnique(); + + b.ToTable("AcademicPlanRecordTimeNormHours"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.BasicDepartment", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BasicDepartmentDescription") + .HasColumnType("nvarchar(max)"); + + b.Property("BasicDepartmentName") + .HasColumnType("nvarchar(max)"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EnterprisesName") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("LecturerId"); + + b.ToTable("BasicDepartment"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Classroom", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Capacity") + .HasColumnType("int"); + + b.Property("ClassroomType") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("HaveProjector") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Number") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Photo") + .HasColumnType("varbinary(max)"); + + b.Property("SecurityCode") + .HasColumnType("nvarchar(max)"); + + b.Property("Square") + .HasColumnType("decimal(18,2)"); + + b.Property("Title") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("Number") + .IsUnique(); + + b.ToTable("Classrooms"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Discipline", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BasicDepartmentId") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("DisciplineBlockId") + .HasColumnType("uniqueidentifier"); + + b.Property("DisciplineBlueAsteriskName") + .HasColumnType("nvarchar(max)"); + + b.Property("DisciplineName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("DisciplineShortName") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("BasicDepartmentId"); + + b.HasIndex("DisciplineBlockId"); + + b.HasIndex("DisciplineName") + .IsUnique(); + + b.ToTable("Disciplines"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.DisciplineBlock", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("DisciplineBlockBlueAsteriskName") + .HasColumnType("nvarchar(max)"); + + b.Property("DisciplineBlockOrder") + .HasColumnType("int"); + + b.Property("DisciplineBlockUseForGrouping") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("Title") + .IsUnique(); + + b.ToTable("DisciplineBlocks"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.EducationDirection", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Cipher") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Profile") + .HasColumnType("nvarchar(450)"); + + b.Property("Qualification") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("LecturerId"); + + b.HasIndex("Title", "Profile") + .IsUnique() + .HasFilter("[Profile] IS NOT NULL"); + + b.ToTable("EducationDirections"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Employee", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Address") + .HasColumnType("nvarchar(max)"); + + b.Property("DateBirth") + .HasColumnType("datetime2"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .HasColumnType("nvarchar(450)"); + + b.Property("GroupElectricalSafety") + .HasColumnType("nvarchar(max)"); + + b.Property("HomeNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastName") + .HasColumnType("nvarchar(450)"); + + b.Property("MobileNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("Patronymic") + .HasColumnType("nvarchar(450)"); + + b.Property("Photo") + .HasColumnType("varbinary(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.HasIndex("FirstName", "LastName", "Patronymic") + .IsUnique() + .HasFilter("[FirstName] IS NOT NULL AND [LastName] IS NOT NULL AND [Patronymic] IS NOT NULL"); + + b.ToTable("Employees"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.EmployeePost", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsExternalCombination") + .HasColumnType("bit"); + + b.Property("IsInternalCombination") + .HasColumnType("bit"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.Property("Rate") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("PostId"); + + b.ToTable("EmployeePosts"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Abbreviation") + .HasColumnType("nvarchar(max)"); + + b.Property("Address") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateBirth") + .HasColumnType("datetime2"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("GroupElectricalSafety") + .HasColumnType("nvarchar(max)"); + + b.Property("HomeNumber") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("LecturerAcademicDegreeId") + .HasColumnType("uniqueidentifier"); + + b.Property("LecturerAcademicRankId") + .HasColumnType("uniqueidentifier"); + + b.Property("MobileNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OnlyForPrivate") + .HasColumnType("bit"); + + b.Property("Patronymic") + .HasColumnType("nvarchar(450)"); + + b.Property("Photo") + .HasColumnType("varbinary(max)"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("LecturerAcademicDegreeId"); + + b.HasIndex("LecturerAcademicRankId"); + + b.HasIndex("UserId"); + + b.HasIndex("FirstName", "LastName", "Patronymic") + .IsUnique() + .HasFilter("[Patronymic] IS NOT NULL"); + + b.ToTable("Lecturers"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.LecturerAcademicDegree", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LecturerAcademicDegreeName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Order") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LecturerAcademicDegreeName") + .IsUnique(); + + b.ToTable("LecturerAcademicDegrees"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.LecturerAcademicRank", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LecturerAcademicRankName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Order") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LecturerAcademicRankName") + .IsUnique(); + + b.ToTable("LecturerAcademicRanks"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.LecturerPost", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsExternalCombination") + .HasColumnType("bit"); + + b.Property("IsInternalCombination") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.Property("PostId") + .HasColumnType("uniqueidentifier"); + + b.Property("Rate") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("LecturerId"); + + b.HasIndex("PostId"); + + b.ToTable("LecturerPosts"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Order", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("OrderDate") + .HasColumnType("datetime2"); + + b.Property("OrderNumber") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("OrderType") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("OrderNumber", "OrderDate", "OrderType") + .IsUnique(); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.OrderStudentRecord", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Info") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("OrderId") + .HasColumnType("uniqueidentifier"); + + b.Property("OrderStudentMoveType") + .HasColumnType("int"); + + b.Property("StudentGroupFromId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudentGroupToId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudentId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("StudentGroupFromId"); + + b.HasIndex("StudentGroupToId"); + + b.HasIndex("StudentId", "OrderId") + .IsUnique(); + + b.ToTable("OrderStudentRecords"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.OrderSyncHistory", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SyncDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("OrderSyncHistories"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.OrderSyncHistoryRecord", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Information") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OrderSyncHistoryId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("OrderSyncHistoryId"); + + b.ToTable("OrderSyncHistoryRecords"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Post", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Hours") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Order") + .HasColumnType("int"); + + b.Property("PostName") + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("PostName") + .IsUnique() + .HasFilter("[PostName] IS NOT NULL"); + + b.ToTable("Posts"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Student", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("BasicDepartmentId") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Iduniv") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsSteward") + .HasColumnType("bit"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberOfBook") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Patronymic") + .HasColumnType("nvarchar(max)"); + + b.Property("Photo") + .HasColumnType("varbinary(max)"); + + b.Property("StudentGroupId") + .HasColumnType("uniqueidentifier"); + + b.Property("StudentState") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("BasicDepartmentId"); + + b.HasIndex("NumberOfBook") + .IsUnique(); + + b.HasIndex("StudentGroupId"); + + b.HasIndex("UserId"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentGroup", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AcademicPlanId") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("GroupNumber") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.Property("YearEntrance") + .HasColumnType("int"); + + b.Property("YearFinish") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LecturerId"); + + b.HasIndex("AcademicPlanId", "YearEntrance", "GroupNumber") + .IsUnique(); + + b.ToTable("StudentGroups"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentMarkPassedDiscipline", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateAffixing") + .HasColumnType("datetime2"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("DisciplineId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDirection") + .HasColumnType("bit"); + + b.Property("IsIncreaseMark") + .HasColumnType("bit"); + + b.Property("Mark") + .HasColumnType("int"); + + b.Property("Semester") + .HasColumnType("int"); + + b.Property("StudentId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineId"); + + b.HasIndex("StudentId", "DisciplineId", "Semester", "Mark") + .IsUnique(); + + b.ToTable("StudentMarkPassedDisciplines"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.TimeNorm", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("DisciplineBlockId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("KindOfLoadAttributeName") + .HasColumnType("nvarchar(max)"); + + b.Property("KindOfLoadBlueAsteriskAttributeName") + .HasColumnType("nvarchar(max)"); + + b.Property("KindOfLoadBlueAsteriskName") + .HasColumnType("nvarchar(max)"); + + b.Property("KindOfLoadBlueAsteriskPracticName") + .HasColumnType("nvarchar(max)"); + + b.Property("KindOfLoadName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("TimeNormEducationDirectionQualification") + .HasColumnType("int"); + + b.Property("TimeNormName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("TimeNormOrder") + .HasColumnType("int"); + + b.Property("TimeNormShortName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("UseInLearningProgress") + .HasColumnType("bit"); + + b.Property("UseInSite") + .HasColumnType("bit"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineBlockId"); + + b.HasIndex("TimeNormName", "TimeNormShortName") + .IsUnique(); + + b.ToTable("TimeNorms"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.Access", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AccessOperation") + .HasColumnType("int"); + + b.Property("AccessType") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("Accesses"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.EnviromentSetting", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Key") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Value") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("Key") + .IsUnique(); + + b.ToTable("EnviromentSettings"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.Role", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("RolePriority") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleName") + .IsUnique(); + + b.ToTable("Roles"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.User", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Avatar") + .HasColumnType("varbinary(max)"); + + b.Property("CountAttempt") + .HasColumnType("int"); + + b.Property("DateBanned") + .HasColumnType("datetime2"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("DateLastVisit") + .HasColumnType("datetime2"); + + b.Property("IsBanned") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("PasswordHash") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.HasKey("Id"); + + b.HasIndex("UserName"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.UserRole", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("uniqueidentifier"); + + b.Property("UserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId"); + + b.ToTable("UserRoles"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlan", b => + { + b.HasOne("CoreDatabase.Models.Department.EducationDirection", "EducationDirection") + .WithMany("AcademicPlans") + .HasForeignKey("EducationDirectionId"); + + b.Navigation("EducationDirection"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlanRecord", b => + { + b.HasOne("CoreDatabase.Models.Department.AcademicPlan", "AcademicPlan") + .WithMany("AcademicPlanRecords") + .HasForeignKey("AcademicPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.Discipline", "Discipline") + .WithMany("AcademicPlanRecords") + .HasForeignKey("DisciplineId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AcademicPlan"); + + b.Navigation("Discipline"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlanRecordTimeNormHour", b => + { + b.HasOne("CoreDatabase.Models.Department.AcademicPlanRecord", "AcademicPlanRecord") + .WithMany("AcademicPlanRecordTimeNormHours") + .HasForeignKey("AcademicPlanRecordId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.TimeNorm", "TimeNorm") + .WithMany("AcademicPlanRecordTimeNormHours") + .HasForeignKey("TimeNormId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("AcademicPlanRecord"); + + b.Navigation("TimeNorm"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.BasicDepartment", b => + { + b.HasOne("CoreDatabase.Models.Department.Lecturer", "Lecturer") + .WithMany("BasicDepartments") + .HasForeignKey("LecturerId"); + + b.Navigation("Lecturer"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Classroom", b => + { + b.HasOne("CoreDatabase.Models.Department.Employee", "Employee") + .WithMany("Classrooms") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Discipline", b => + { + b.HasOne("CoreDatabase.Models.Department.BasicDepartment", "BasicDepartment") + .WithMany("Disciplines") + .HasForeignKey("BasicDepartmentId"); + + b.HasOne("CoreDatabase.Models.Department.DisciplineBlock", "DisciplineBlock") + .WithMany("Disciplines") + .HasForeignKey("DisciplineBlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BasicDepartment"); + + b.Navigation("DisciplineBlock"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.EducationDirection", b => + { + b.HasOne("CoreDatabase.Models.Department.Lecturer", "Lecturer") + .WithMany("EducationDirections") + .HasForeignKey("LecturerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lecturer"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Employee", b => + { + b.HasOne("CoreDatabase.Models.Security.User", "User") + .WithMany("Employees") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.EmployeePost", b => + { + b.HasOne("CoreDatabase.Models.Department.Employee", "Employee") + .WithMany("EmployeePosts") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.Post", "Post") + .WithMany("EmployeePosts") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b => + { + b.HasOne("CoreDatabase.Models.Department.LecturerAcademicDegree", "LecturerAcademicDegree") + .WithMany("Lecturers") + .HasForeignKey("LecturerAcademicDegreeId"); + + b.HasOne("CoreDatabase.Models.Department.LecturerAcademicRank", "LecturerAcademicRank") + .WithMany("Lecturers") + .HasForeignKey("LecturerAcademicRankId"); + + b.HasOne("CoreDatabase.Models.Security.User", "User") + .WithMany("Lecturers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LecturerAcademicDegree"); + + b.Navigation("LecturerAcademicRank"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.LecturerPost", b => + { + b.HasOne("CoreDatabase.Models.Department.Lecturer", "Lecturer") + .WithMany("LecturerPosts") + .HasForeignKey("LecturerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.Post", "Post") + .WithMany("LecturerPosts") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lecturer"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.OrderStudentRecord", b => + { + b.HasOne("CoreDatabase.Models.Department.Order", "Order") + .WithMany("OrderStudentRecords") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.StudentGroup", "StudentGroupFrom") + .WithMany("OrderStudentRecordFroms") + .HasForeignKey("StudentGroupFromId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("CoreDatabase.Models.Department.StudentGroup", "StudentGroupTo") + .WithMany("OrderStudentRecordTos") + .HasForeignKey("StudentGroupToId") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("CoreDatabase.Models.Department.Student", "Student") + .WithMany("OrderStudentRecords") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Order"); + + b.Navigation("Student"); + + b.Navigation("StudentGroupFrom"); + + b.Navigation("StudentGroupTo"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.OrderSyncHistoryRecord", b => + { + b.HasOne("CoreDatabase.Models.Department.OrderSyncHistory", "OrderSyncHistory") + .WithMany("OrderSyncHistoryRecords") + .HasForeignKey("OrderSyncHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("OrderSyncHistory"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Student", b => + { + b.HasOne("CoreDatabase.Models.Department.BasicDepartment", "BasicDepartment") + .WithMany("Students") + .HasForeignKey("BasicDepartmentId"); + + b.HasOne("CoreDatabase.Models.Department.StudentGroup", "StudentGroup") + .WithMany("Students") + .HasForeignKey("StudentGroupId"); + + b.HasOne("CoreDatabase.Models.Security.User", "User") + .WithMany("Students") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("BasicDepartment"); + + b.Navigation("StudentGroup"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentGroup", b => + { + b.HasOne("CoreDatabase.Models.Department.AcademicPlan", "AcademicPlan") + .WithMany("StudentGroups") + .HasForeignKey("AcademicPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.Lecturer", "Lecturer") + .WithMany("StudentGroups") + .HasForeignKey("LecturerId"); + + b.Navigation("AcademicPlan"); + + b.Navigation("Lecturer"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentMarkPassedDiscipline", b => + { + b.HasOne("CoreDatabase.Models.Department.Discipline", "Discipline") + .WithMany("StudentMarkPassedDisciplines") + .HasForeignKey("DisciplineId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.Student", "Student") + .WithMany("StudentMarkPassedDisciplines") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Discipline"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.TimeNorm", b => + { + b.HasOne("CoreDatabase.Models.Department.DisciplineBlock", "DisciplineBlock") + .WithMany("TimeNorms") + .HasForeignKey("DisciplineBlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineBlock"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.Access", b => + { + b.HasOne("CoreDatabase.Models.Security.Role", "Role") + .WithMany("Access") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.UserRole", b => + { + b.HasOne("CoreDatabase.Models.Security.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Security.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlan", b => + { + b.Navigation("AcademicPlanRecords"); + + b.Navigation("StudentGroups"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlanRecord", b => + { + b.Navigation("AcademicPlanRecordTimeNormHours"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.BasicDepartment", b => + { + b.Navigation("Disciplines"); + + b.Navigation("Students"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Discipline", b => + { + b.Navigation("AcademicPlanRecords"); + + b.Navigation("StudentMarkPassedDisciplines"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.DisciplineBlock", b => + { + b.Navigation("Disciplines"); + + b.Navigation("TimeNorms"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.EducationDirection", b => + { + b.Navigation("AcademicPlans"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Employee", b => + { + b.Navigation("Classrooms"); + + b.Navigation("EmployeePosts"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b => + { + b.Navigation("BasicDepartments"); + + b.Navigation("EducationDirections"); + + b.Navigation("LecturerPosts"); + + b.Navigation("StudentGroups"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.LecturerAcademicDegree", b => + { + b.Navigation("Lecturers"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.LecturerAcademicRank", b => + { + b.Navigation("Lecturers"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Order", b => + { + b.Navigation("OrderStudentRecords"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.OrderSyncHistory", b => + { + b.Navigation("OrderSyncHistoryRecords"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Post", b => + { + b.Navigation("EmployeePosts"); + + b.Navigation("LecturerPosts"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Student", b => + { + b.Navigation("OrderStudentRecords"); + + b.Navigation("StudentMarkPassedDisciplines"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentGroup", b => + { + b.Navigation("OrderStudentRecordFroms"); + + b.Navigation("OrderStudentRecordTos"); + + b.Navigation("Students"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.TimeNorm", b => + { + b.Navigation("AcademicPlanRecordTimeNormHours"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.Role", b => + { + b.Navigation("Access"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Security.User", b => + { + b.Navigation("Employees"); + + b.Navigation("Lecturers"); + + b.Navigation("Students"); + + b.Navigation("UserRoles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.cs new file mode 100644 index 0000000..420cce1 --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/20221220182036_AddStudentMarkPassedDiscipline.cs @@ -0,0 +1,61 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CoreDatabase.Migrations +{ + public partial class AddStudentMarkPassedDiscipline : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "StudentMarkPassedDisciplines", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + StudentId = table.Column(type: "uniqueidentifier", nullable: false), + DisciplineId = table.Column(type: "uniqueidentifier", nullable: false), + Semester = table.Column(type: "int", nullable: false), + Mark = table.Column(type: "int", nullable: false), + DateAffixing = table.Column(type: "datetime2", nullable: false), + IsIncreaseMark = table.Column(type: "bit", nullable: false), + IsDirection = table.Column(type: "bit", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateDelete = table.Column(type: "datetime2", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StudentMarkPassedDisciplines", x => x.Id); + table.ForeignKey( + name: "FK_StudentMarkPassedDisciplines_Disciplines_DisciplineId", + column: x => x.DisciplineId, + principalTable: "Disciplines", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StudentMarkPassedDisciplines_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_StudentMarkPassedDisciplines_DisciplineId", + table: "StudentMarkPassedDisciplines", + column: "DisciplineId"); + + migrationBuilder.CreateIndex( + name: "IX_StudentMarkPassedDisciplines_StudentId_DisciplineId_Semester_Mark", + table: "StudentMarkPassedDisciplines", + columns: new[] { "StudentId", "DisciplineId", "Semester", "Mark" }, + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "StudentMarkPassedDisciplines"); + } + } +} diff --git a/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs index a02fea7..3fb2d33 100644 --- a/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs @@ -881,6 +881,51 @@ namespace CoreDatabase.Migrations b.ToTable("StudentGroups"); }); + modelBuilder.Entity("CoreDatabase.Models.Department.StudentMarkPassedDiscipline", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateAffixing") + .HasColumnType("datetime2"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("DisciplineId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDirection") + .HasColumnType("bit"); + + b.Property("IsIncreaseMark") + .HasColumnType("bit"); + + b.Property("Mark") + .HasColumnType("int"); + + b.Property("Semester") + .HasColumnType("int"); + + b.Property("StudentId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineId"); + + b.HasIndex("StudentId", "DisciplineId", "Semester", "Mark") + .IsUnique(); + + b.ToTable("StudentMarkPassedDisciplines"); + }); + modelBuilder.Entity("CoreDatabase.Models.Department.TimeNorm", b => { b.Property("Id") @@ -1360,6 +1405,25 @@ namespace CoreDatabase.Migrations b.Navigation("Lecturer"); }); + modelBuilder.Entity("CoreDatabase.Models.Department.StudentMarkPassedDiscipline", b => + { + b.HasOne("CoreDatabase.Models.Department.Discipline", "Discipline") + .WithMany("StudentMarkPassedDisciplines") + .HasForeignKey("DisciplineId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.Student", "Student") + .WithMany("StudentMarkPassedDisciplines") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Discipline"); + + b.Navigation("Student"); + }); + modelBuilder.Entity("CoreDatabase.Models.Department.TimeNorm", b => { b.HasOne("CoreDatabase.Models.Department.DisciplineBlock", "DisciplineBlock") @@ -1423,6 +1487,8 @@ namespace CoreDatabase.Migrations modelBuilder.Entity("CoreDatabase.Models.Department.Discipline", b => { b.Navigation("AcademicPlanRecords"); + + b.Navigation("StudentMarkPassedDisciplines"); }); modelBuilder.Entity("CoreDatabase.Models.Department.DisciplineBlock", b => @@ -1485,6 +1551,8 @@ namespace CoreDatabase.Migrations modelBuilder.Entity("CoreDatabase.Models.Department.Student", b => { b.Navigation("OrderStudentRecords"); + + b.Navigation("StudentMarkPassedDisciplines"); }); modelBuilder.Entity("CoreDatabase.Models.Department.StudentGroup", b => diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs index b2512f9..15df159 100644 --- a/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs @@ -44,6 +44,9 @@ namespace CoreDatabase.Models.Department [ForeignKey("DisciplineId")] public virtual List AcademicPlanRecords { get; set; } + [ForeignKey("DisciplineId")] + public virtual List StudentMarkPassedDisciplines { get; set; } + //------------------------------------------------------------------------- public Discipline SecurityCheck(Discipline entity, bool allowFullData) => entity; diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs index e7b76e4..a34395c 100644 --- a/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs @@ -71,6 +71,9 @@ namespace CoreDatabase.Models.Department [ForeignKey("StudentId")] public virtual List OrderStudentRecords { get; set; } + [ForeignKey("StudentId")] + public virtual List StudentMarkPassedDisciplines { get; set; } + //------------------------------------------------------------------------- public Student SecurityCheck(Student entity, bool allowFullData) diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs new file mode 100644 index 0000000..5fe26ed --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs @@ -0,0 +1,65 @@ +using CoreModels.Enums.Department; +using CoreModels.ModelsDepartment; +using System; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using ToolsModule.ManagmentSecurity; + +namespace CoreDatabase.Models.Department +{ + [DataContract] + public class StudentMarkPassedDiscipline : BaseEntity, IEntitySecurityExtenstion, IStudentMarkPassedDisciplineModel + { + [DataMember] + [Required(ErrorMessage = "required")] + public Guid StudentId { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + public Guid DisciplineId { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + public Semester Semester { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + public MarkDisciplinePassedType Mark { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + public DateTime DateAffixing { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + public bool IsIncreaseMark { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + public bool IsDirection { get; set; } + + //------------------------------------------------------------------------- + + public virtual Discipline Discipline { get; set; } + + public virtual Student Student { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + public StudentMarkPassedDiscipline SecurityCheck(StudentMarkPassedDiscipline entity, bool allowFullData) + { + if (!allowFullData) + { + entity.Mark = MarkDisciplinePassedType.НеСдано; + entity.DateAffixing = DateTime.Now; + entity.Semester = Semester.Нулевой; + } + + return entity; + } + + public override string ToString() => $"{Student} {Discipline} {Semester + 1} семестр {Mark}"; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/CoreModels/Enums/Department/MarkDisciplinePassedType.cs b/DepartmentPortal/Common/CoreModels/Enums/Department/MarkDisciplinePassedType.cs new file mode 100644 index 0000000..1c23965 --- /dev/null +++ b/DepartmentPortal/Common/CoreModels/Enums/Department/MarkDisciplinePassedType.cs @@ -0,0 +1,22 @@ +namespace CoreModels.Enums.Department +{ + /// + /// Результат сдачи предмета в сессию + /// + public enum MarkDisciplinePassedType + { + НеСдано = -1, + + НеЯвился = 0, + + НеУдовлетворительно = 1, + + Удовлетворительно = 2, + + Хорошо = 3, + + Отлично = 4, + + Зачет = 10, + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/CoreModels/Enums/Department/Semester.cs b/DepartmentPortal/Common/CoreModels/Enums/Department/Semester.cs index ee0f0a8..219717e 100644 --- a/DepartmentPortal/Common/CoreModels/Enums/Department/Semester.cs +++ b/DepartmentPortal/Common/CoreModels/Enums/Department/Semester.cs @@ -5,6 +5,8 @@ /// public enum Semester { + Нулевой = -1, + Первый = 1, Второй = 2, diff --git a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs new file mode 100644 index 0000000..0378d95 --- /dev/null +++ b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs @@ -0,0 +1,42 @@ +using CoreModels.Enums.Department; +using CoreModels.Tools; +using System; +using ToolsModule.ManagmentEntity; + +namespace CoreModels.ModelsDepartment +{ + [EntityDescription("StudentMarkPassedDiscipline", "Оценка студента по сданной дисципилне")] + [EntityDependency("Discipline", "DisciplineId", "Дисциплина, по которой выставлена оценка")] + [EntityDependency("Student", "StudentId", "Студент, сдающий дисциплину")] + public interface IStudentMarkPassedDisciplineModel : IId + { + Guid StudentId { get; } + + Guid DisciplineId { get; } + + /// + /// Семестр, в котором сдавался экзамен/зачет по дисциплине + /// + Semester Semester { get; } + + /// + /// Результат сдачи + /// + MarkDisciplinePassedType Mark { get; } + + /// + /// Дата сдачи + /// + DateTime DateAffixing { get; } + + /// + /// Является повышением оценки + /// + bool IsIncreaseMark { get; } + + /// + /// Является сдачей по направлению + /// + bool IsDirection { get; } + } +} \ No newline at end of file