diff --git a/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs b/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs index 15463a0..8a8c53e 100644 --- a/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs +++ b/DepartmentPortal/Common/CoreDatabase/DatabaseContext.cs @@ -90,7 +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(); + modelBuilder.Entity().HasIndex(d => new { d.StudentId, d.DisciplineId, d.Semester, d.DisciplineReportingType, d.Mark }).IsUnique(); } #region Security diff --git a/DepartmentPortal/Common/CoreDatabase/Migrations/20221222084603_UpdateStudentMarkPassedDisciplineModel.Designer.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/20221222084603_UpdateStudentMarkPassedDisciplineModel.Designer.cs new file mode 100644 index 0000000..63c993d --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/20221222084603_UpdateStudentMarkPassedDisciplineModel.Designer.cs @@ -0,0 +1,1661 @@ +// +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("20221222084603_UpdateStudentMarkPassedDisciplineModel")] + partial class UpdateStudentMarkPassedDisciplineModel + { + 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("AddiionalInfo") + .HasColumnType("nvarchar(max)"); + + b.Property("DateAffixing") + .HasColumnType("datetime2"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("DisciplineId") + .HasColumnType("uniqueidentifier"); + + b.Property("DisciplineReportingType") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsDirection") + .HasColumnType("bit"); + + b.Property("IsIncreaseMark") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Mark") + .HasColumnType("int"); + + b.Property("Semester") + .HasColumnType("int"); + + b.Property("StudentId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("DisciplineId"); + + b.HasIndex("LecturerId"); + + b.HasIndex("StudentId", "DisciplineId", "Semester", "DisciplineReportingType", "Mark") + .IsUnique(); + + b.ToTable("StudentMarkPassedDisciplines"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentMarkSyncHistory", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("SyncDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.ToTable("StudentMarkSyncHistories"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentMarkSyncHistoryRecord", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Information") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("StudentMarkSyncHistoryId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("StudentMarkSyncHistoryId"); + + b.ToTable("StudentMarkSyncHistoryRecords"); + }); + + 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.Lecturer", "Lecturer") + .WithMany("StudentMarkPassedDisciplines") + .HasForeignKey("LecturerId"); + + b.HasOne("CoreDatabase.Models.Department.Student", "Student") + .WithMany("StudentMarkPassedDisciplines") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Discipline"); + + b.Navigation("Lecturer"); + + b.Navigation("Student"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentMarkSyncHistoryRecord", b => + { + b.HasOne("CoreDatabase.Models.Department.StudentMarkSyncHistory", "StudentMarkSyncHistory") + .WithMany("StudentMarkSyncHistoryRecords") + .HasForeignKey("StudentMarkSyncHistoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("StudentMarkSyncHistory"); + }); + + 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"); + + b.Navigation("StudentMarkPassedDisciplines"); + }); + + 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.StudentMarkSyncHistory", b => + { + b.Navigation("StudentMarkSyncHistoryRecords"); + }); + + 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/20221222084603_UpdateStudentMarkPassedDisciplineModel.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/20221222084603_UpdateStudentMarkPassedDisciplineModel.cs new file mode 100644 index 0000000..465dc3d --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/20221222084603_UpdateStudentMarkPassedDisciplineModel.cs @@ -0,0 +1,86 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CoreDatabase.Migrations +{ + public partial class UpdateStudentMarkPassedDisciplineModel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_StudentMarkPassedDisciplines_StudentId_DisciplineId_Semester_Mark", + table: "StudentMarkPassedDisciplines"); + + migrationBuilder.AddColumn( + name: "AddiionalInfo", + table: "StudentMarkPassedDisciplines", + type: "nvarchar(max)", + nullable: true); + + migrationBuilder.AddColumn( + name: "DisciplineReportingType", + table: "StudentMarkPassedDisciplines", + type: "int", + nullable: false, + defaultValue: 0); + + migrationBuilder.AddColumn( + name: "LecturerId", + table: "StudentMarkPassedDisciplines", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.CreateIndex( + name: "IX_StudentMarkPassedDisciplines_LecturerId", + table: "StudentMarkPassedDisciplines", + column: "LecturerId"); + + migrationBuilder.CreateIndex( + name: "IX_StudentMarkPassedDisciplines_StudentId_DisciplineId_Semester_DisciplineReportingType_Mark", + table: "StudentMarkPassedDisciplines", + columns: new[] { "StudentId", "DisciplineId", "Semester", "DisciplineReportingType", "Mark" }, + unique: true); + + migrationBuilder.AddForeignKey( + name: "FK_StudentMarkPassedDisciplines_Lecturers_LecturerId", + table: "StudentMarkPassedDisciplines", + column: "LecturerId", + principalTable: "Lecturers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_StudentMarkPassedDisciplines_Lecturers_LecturerId", + table: "StudentMarkPassedDisciplines"); + + migrationBuilder.DropIndex( + name: "IX_StudentMarkPassedDisciplines_LecturerId", + table: "StudentMarkPassedDisciplines"); + + migrationBuilder.DropIndex( + name: "IX_StudentMarkPassedDisciplines_StudentId_DisciplineId_Semester_DisciplineReportingType_Mark", + table: "StudentMarkPassedDisciplines"); + + migrationBuilder.DropColumn( + name: "AddiionalInfo", + table: "StudentMarkPassedDisciplines"); + + migrationBuilder.DropColumn( + name: "DisciplineReportingType", + table: "StudentMarkPassedDisciplines"); + + migrationBuilder.DropColumn( + name: "LecturerId", + table: "StudentMarkPassedDisciplines"); + + migrationBuilder.CreateIndex( + name: "IX_StudentMarkPassedDisciplines_StudentId_DisciplineId_Semester_Mark", + table: "StudentMarkPassedDisciplines", + columns: new[] { "StudentId", "DisciplineId", "Semester", "Mark" }, + unique: true); + } + } +} diff --git a/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs index e82976f..c8e6944 100644 --- a/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs @@ -886,6 +886,9 @@ namespace CoreDatabase.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("AddiionalInfo") + .HasColumnType("nvarchar(max)"); + b.Property("DateAffixing") .HasColumnType("datetime2"); @@ -898,6 +901,9 @@ namespace CoreDatabase.Migrations b.Property("DisciplineId") .HasColumnType("uniqueidentifier"); + b.Property("DisciplineReportingType") + .HasColumnType("int"); + b.Property("IsDeleted") .HasColumnType("bit"); @@ -907,6 +913,9 @@ namespace CoreDatabase.Migrations b.Property("IsIncreaseMark") .HasColumnType("bit"); + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + b.Property("Mark") .HasColumnType("int"); @@ -920,7 +929,9 @@ namespace CoreDatabase.Migrations b.HasIndex("DisciplineId"); - b.HasIndex("StudentId", "DisciplineId", "Semester", "Mark") + b.HasIndex("LecturerId"); + + b.HasIndex("StudentId", "DisciplineId", "Semester", "DisciplineReportingType", "Mark") .IsUnique(); b.ToTable("StudentMarkPassedDisciplines"); @@ -1445,6 +1456,10 @@ namespace CoreDatabase.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.HasOne("CoreDatabase.Models.Department.Lecturer", "Lecturer") + .WithMany("StudentMarkPassedDisciplines") + .HasForeignKey("LecturerId"); + b.HasOne("CoreDatabase.Models.Department.Student", "Student") .WithMany("StudentMarkPassedDisciplines") .HasForeignKey("StudentId") @@ -1453,6 +1468,8 @@ namespace CoreDatabase.Migrations b.Navigation("Discipline"); + b.Navigation("Lecturer"); + b.Navigation("Student"); }); @@ -1562,6 +1579,8 @@ namespace CoreDatabase.Migrations b.Navigation("LecturerPosts"); b.Navigation("StudentGroups"); + + b.Navigation("StudentMarkPassedDisciplines"); }); modelBuilder.Entity("CoreDatabase.Models.Department.LecturerAcademicDegree", b => diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs index f0fcfb9..753dc37 100644 --- a/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs @@ -90,6 +90,9 @@ namespace CoreDatabase.Models.Department [ForeignKey("LecturerId")] public virtual List BasicDepartments { get; set; } + [ForeignKey("LecturerId")] + public virtual List StudentMarkPassedDisciplines { get; set; } + //------------------------------------------------------------------------- public Lecturer SecurityCheck(Lecturer entity, bool allowFullData) diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs index 5fe26ed..906453d 100644 --- a/DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/StudentMarkPassedDiscipline.cs @@ -18,10 +18,17 @@ namespace CoreDatabase.Models.Department [Required(ErrorMessage = "required")] public Guid DisciplineId { get; set; } + [DataMember] + public Guid? LecturerId { get; set; } + [DataMember] [Required(ErrorMessage = "required")] public Semester Semester { get; set; } + [DataMember] + [Required(ErrorMessage = "required")] + public DisciplineReportingType DisciplineReportingType { get; set; } + [DataMember] [Required(ErrorMessage = "required")] public MarkDisciplinePassedType Mark { get; set; } @@ -38,12 +45,17 @@ namespace CoreDatabase.Models.Department [Required(ErrorMessage = "required")] public bool IsDirection { get; set; } + [DataMember] + public string AddiionalInfo { get; set; } + //------------------------------------------------------------------------- public virtual Discipline Discipline { get; set; } public virtual Student Student { get; set; } + public virtual Lecturer Lecturer { get; set; } + //------------------------------------------------------------------------- //------------------------------------------------------------------------- @@ -60,6 +72,6 @@ namespace CoreDatabase.Models.Department return entity; } - public override string ToString() => $"{Student} {Discipline} {Semester + 1} семестр {Mark}"; + public override string ToString() => $"{Student} {Discipline} {Semester} семестр {Mark}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/CoreModels/Enums/Department/DisciplineReportingType.cs b/DepartmentPortal/Common/CoreModels/Enums/Department/DisciplineReportingType.cs new file mode 100644 index 0000000..2bb246a --- /dev/null +++ b/DepartmentPortal/Common/CoreModels/Enums/Department/DisciplineReportingType.cs @@ -0,0 +1,20 @@ +namespace CoreModels.Enums.Department +{ + /// + /// Тип отчетности по дисциплине + /// + public enum DisciplineReportingType + { + Неопределено = -1, + + Зачет = 1, + + ЗачетСОценкой = 2, + + КурсоваяРабота = 3, + + КурсовойПроект = 4, + + Экзамен + } +} \ 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 219717e..d40799a 100644 --- a/DepartmentPortal/Common/CoreModels/Enums/Department/Semester.cs +++ b/DepartmentPortal/Common/CoreModels/Enums/Department/Semester.cs @@ -21,6 +21,10 @@ Седьмой = 7, - Восьмой = 8 + Восьмой = 8, + + Девятый = 9, + + Десятый = 10 } } diff --git a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs index 0378d95..a45ec96 100644 --- a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs +++ b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentMarkPassedDisciplineModel.cs @@ -8,17 +8,25 @@ namespace CoreModels.ModelsDepartment [EntityDescription("StudentMarkPassedDiscipline", "Оценка студента по сданной дисципилне")] [EntityDependency("Discipline", "DisciplineId", "Дисциплина, по которой выставлена оценка")] [EntityDependency("Student", "StudentId", "Студент, сдающий дисциплину")] + [EntityDependency("Lecturer", "LecturerId", "Преподаватель, принимавший дисциплину")] public interface IStudentMarkPassedDisciplineModel : IId { Guid StudentId { get; } Guid DisciplineId { get; } + Guid? LecturerId { get; } + /// /// Семестр, в котором сдавался экзамен/зачет по дисциплине /// Semester Semester { get; } + /// + /// Тип отчетности по дисциплине + /// + DisciplineReportingType DisciplineReportingType { get; } + /// /// Результат сдачи /// @@ -38,5 +46,10 @@ namespace CoreModels.ModelsDepartment /// Является сдачей по направлению /// bool IsDirection { get; } + + /// + /// Дополнительная информация, которую не удалось распознать из данных с 1С + /// + string AddiionalInfo { get; } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentMarkSyncHistoryBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentMarkSyncHistoryBusinessLogic.cs index fad8d33..8ad3c49 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentMarkSyncHistoryBusinessLogic.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/StudentMarkSyncHistoryBusinessLogic.cs @@ -1,13 +1,24 @@ -using DepartmentContract.BindingModels; +using CoreModels.Enums.Department; +using DepartmentBusinessLogic.HelperModels; +using DepartmentContract.BindingModels; using DepartmentContract.Logics.IGenericEntityLogic; using DepartmentContract.Services.IGenericEntityService; using DepartmentContract.ViewModels; +using SecurityContract.BindingModels; +using SecurityContract.Logics.IGenericEntityLogic; +using SecurityContract.ViewModels; using System; using System.Collections.Generic; using System.Linq; +using System.Net.Http; +using System.Net.Http.Headers; using System.Text; +using System.Text.Json; using System.Threading.Tasks; +using ToolsModule.ManagmentDependency; using ToolsModule.ManagmentEntity; +using ToolsModule.ManagmentExtension; +using ToolsModule.ManagmentMapping; using ToolsModule.ManagmentSecurity; namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic @@ -17,16 +28,353 @@ namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic /// public class StudentMarkSyncHistoryBusinessLogic : GenericBusinessLogic, IStudentMarkSyncHistoryLogic { + private IStudentMarkSyncHistoryRecordLogic _recordLogic; + + private IEnviromentSettingLogic _enviromentSettingLogic; + + private IStudentLogic _studentLogic; + + private IDisciplineLogic _disciplineLogic; + + private ILecturerLogic _lecturerLogic; + + private IStudentMarkPassedDisciplineLogic _studentMarkPassedDisciplineLogic; + + private StudentMarkSyncHistoryViewModel _history; + public StudentMarkSyncHistoryBusinessLogic(IStudentMarkSyncHistoryService service) : base(service, "Синхронизация Оценок", AccessOperation.ОценкиСтудентов) { } - public Task SyncMarks() + public async Task SyncMarks() { - throw new NotImplementedException(); + InitLogics(); + + // создание логов по операции синхронизации приказов + if (!CreateHistory()) + { + return false; + } + + // получение адреса сервера с приказами + var address = GetAddress(); + if (address == null) + { + return false; + } + + // подключение клиента для отправки запросов к серверу + var client = GetClinet(address); + if (client == null) + { + return false; + } + + // получение списка оценок + var response = await client.GetAsync($"{address.Value}/univer/hs/Ulstu_StudentsInfo/v1/GetCurrentStudentsOfDepartmentGrades"); + if (!response.IsSuccessStatusCode) + { + SaveLog("Не удалось получить список оценок студента с сервера"); + return false; + } + var studentFromServer = JsonSerializer.Deserialize(await response.Content.ReadAsStringAsync()); + if (studentFromServer == null || studentFromServer.arrayOfStudentsGrades == null) + { + SaveLog("Не удалось распознать список приказов по студенту"); + return false; + } + if (studentFromServer.arrayOfStudentsGrades.Length == 0) + { + SaveLog("Полученный список студентов пустой"); + return false; + } + + var students = _studentLogic.GetList(new StudentGetBindingModel()); + if (students == null || students.List == null) + { + SaveErrors(_studentLogic.Errors, "Ошибка получения данных", "Не удалось получить список студентов с базы"); + return false; + } + foreach (var student in students.List) + { + var marks = studentFromServer.arrayOfStudentsGrades.FirstOrDefault(x => x.recordBook == student.NumberOfBook); + if (marks == null || marks.bills == null || marks.bills.Length == 0) + { + SaveLog($"По студенту {student} ({student.NumberOfBook}) не найдено оценок"); + continue; + } + SyncMarks(student, marks.bills); + } + return true; } - public Task SyncStudentMarks(Guid studentId) + /// + /// Инициализаия всех логик для получения от них данных и сохранения новых + /// + private void InitLogics() { - throw new NotImplementedException(); + _recordLogic = DependencyManager.Instance.Resolve(); + _enviromentSettingLogic = DependencyManager.Instance.Resolve(); + _studentLogic = DependencyManager.Instance.Resolve(); + _disciplineLogic = DependencyManager.Instance.Resolve(); + _lecturerLogic = DependencyManager.Instance.Resolve(); + _studentMarkPassedDisciplineLogic = DependencyManager.Instance.Resolve(); + } + + /// + /// Создаение логера действий при синхронизации приказов + /// + /// + private bool CreateHistory() + { + _history = Create(new StudentMarkSyncHistorySetBindingModel { SyncDate = DateTime.Now }); + if (_history == null) + { + Errors.Add(("Ошибка создание истории", "Не удалось создать историю")); + return false; + } + return true; + } + + /// + /// Получение адреса сервера + /// + /// + private EnviromentSettingViewModel GetAddress() + { + var address = _enviromentSettingLogic.GetList(new EnviromentSettingGetBindingModel { Key = "SyncStudentOrderIpAddress" })?.List?.FirstOrDefault(); + if (address == null || address.Value.IsEmpty()) + { + SaveErrors(_enviromentSettingLogic.Errors, "Ошибка получения данных", "Не удалось получить адрес сервера для получения приказов по студентам"); + return null; + } + return address; + } + + /// + /// Получение клиента для работы с сервисом приказов + /// + /// + /// + private HttpClient GetClinet(EnviromentSettingViewModel address) + { + var username = _enviromentSettingLogic.GetList(new EnviromentSettingGetBindingModel { Key = "SyncStudentOrderUserName" })?.List?.FirstOrDefault(); + if (username == null || username.Value.IsEmpty()) + { + SaveErrors(_enviromentSettingLogic.Errors, "Ошибка получения данных", "Не удалось получить имя пользователя для получения приказов по студентам"); + return null; + } + + var password = _enviromentSettingLogic.GetList(new EnviromentSettingGetBindingModel { Key = "SyncStudentOrderPassword" })?.List?.FirstOrDefault(); + if (password == null || password.Value.IsEmpty()) + { + SaveErrors(_enviromentSettingLogic.Errors, "Ошибка получения данных", "Не удалось получить пароль для получения приказов по студентам"); + return null; + } + + var client = new HttpClient + { + BaseAddress = new Uri(address.Value), + Timeout = TimeSpan.FromMinutes(10) + }; + client.DefaultRequestHeaders.Accept.Clear(); + client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); + client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username.Value}:{password.Value}"))); + + return client; + } + + private void SyncMarks(StudentViewModel student, StudentMarkSyncModel[] bills) + { + var marks = _studentMarkPassedDisciplineLogic.GetList(new StudentMarkPassedDisciplineGetBindingModel { StudentId = student.Id }); + if (marks == null || marks.List == null) + { + SaveErrors(_studentLogic.Errors, "Ошибка получения данных", $"Не удалось получить список оценок студента {student} с базы"); + return; + } + var studentBills = bills.ToList(); + foreach (var bill in bills) + { + var disciplines = _disciplineLogic.GetList(new DisciplineGetBindingModel { DisciplineName = bill.disciplineName }); + if (disciplines == null || disciplines.List == null || disciplines.List.Count == 0) + { + SaveLog($"Не найдена дисциплина {bill.disciplineName}"); + continue; + } + var discipline = disciplines.List.First(); + var sb = new StringBuilder(); + LecturerViewModel lecturer = null; + + var teachers = bill.teacher.Split(",", StringSplitOptions.RemoveEmptyEntries); + foreach (var retacher in teachers) + { + var lecturers = _lecturerLogic.GetList(new LecturerGetBindingModel { FIO = bill.teacher }); + if (lecturers != null && lecturers.List != null && lecturers.List.Count > 0) + { + lecturer = lecturers.List.First(); + break; + } + } + if (lecturer == null) + { + sb.Append($"Преподаватель: {bill.teacher} "); + } + var semester = GetSemester(bill); + if (semester == Semester.Нулевой) + { + sb.Append($"Семестр: {bill.semester} "); + } + var type = GetDisicplineReportingType(bill); + if (type == DisciplineReportingType.Неопределено) + { + sb.Append($"Тип: {bill.controlType} "); + } + var mark = GetMark(bill); + if (mark == MarkDisciplinePassedType.НеСдано) + { + sb.Append($"Оценка: {bill.grade} "); + } + var date = Convert.ToDateTime(bill.controlTypeDate); + var isDirection = bill.documentType != "Аттестационная ведомость"; + var markFound = marks.List.FirstOrDefault(x => x.DisciplineId == discipline.Id && x.StudentId == student.Id && + x.Semester == semester && x.DisciplineReportingType == type && x.DateAffixing.Date == date.Date); + if (markFound != null) + { + if (markFound.Mark != mark || markFound.IsDirection != isDirection || markFound.LecturerId != lecturer?.Id) + { + markFound.Mark = mark; + markFound.IsDirection = isDirection; + markFound.LecturerId = lecturer?.Id; + markFound = _studentMarkPassedDisciplineLogic.Update(Mapper.MapToClass(markFound, true)); + if (markFound == null) + { + SaveErrors(_studentMarkPassedDisciplineLogic.Errors, "Ошибка изменения данных", $"Не удалось обновить оценку студента {student}"); + } + else + { + SaveLog($"Оценка обновлена: {student}, {bill.disciplineName}, {semester}, {type}, {mark}, {lecturer?.ToString()}"); + } + } + if (markFound != null) + { + marks.List.RemoveAll(x => x.Id == markFound.Id); + } + } + else + { + var newMark = _studentMarkPassedDisciplineLogic.Create(new StudentMarkPassedDisciplineSetBindingModel + { + DisciplineId = discipline.Id, + StudentId = student.Id, + Semester = semester, + DisciplineReportingType = type, + Mark = mark, + DateAffixing = date, + IsDirection = isDirection, + LecturerId = lecturer?.Id, + AddiionalInfo = sb.ToString() + }); + if (newMark == null) + { + SaveErrors(_studentMarkPassedDisciplineLogic.Errors, "Ошибка добавления данных", $"Не удалось добавить оценку студента {student}"); + } + else + { + SaveLog($"Оценка добавлена: {student}, {bill.disciplineName}, {semester}, {type}, {mark}, {lecturer?.ToString()}"); + } + } + } + if (marks.List.Count > 0) + { + foreach (var mark in marks.List) + { + SaveLog($"Попытка удаления оценки: {student}, {mark}"); + if (!_studentMarkPassedDisciplineLogic.Delete(new StudentMarkPassedDisciplineGetBindingModel { Id = mark.Id })) + { + SaveErrors(_studentMarkPassedDisciplineLogic.Errors, "Ошибка удаления данных", $"Не удалось удалить оценку студента {student}"); + } + } + } + } + + /// + /// Получение семестра + /// + /// + /// + private static Semester GetSemester(StudentMarkSyncModel bill) => Convert.ToInt32(bill.semester) switch + { + 1 => Semester.Первый, + 2 => Semester.Второй, + 3 => Semester.Третий, + 4 => Semester.Четвертый, + 5 => Semester.Пятый, + 6 => Semester.Шестой, + 7 => Semester.Седьмой, + 8 => Semester.Восьмой, + 9 => Semester.Девятый, + 10 => Semester.Десятый, + _ => Semester.Нулевой, + }; + + /// + /// Получение типа отчетности: зачет, экзамен.. + /// + /// + /// + private static DisciplineReportingType GetDisicplineReportingType(StudentMarkSyncModel bill) => bill.controlType switch + { + "Зачет" => DisciplineReportingType.Зачет, + "Дифференцированный зачет" => DisciplineReportingType.ЗачетСОценкой, + "Курсовая работа" => DisciplineReportingType.КурсоваяРабота, + "Курсовой проект" => DisciplineReportingType.КурсовойПроект, + "Экзамен" => DisciplineReportingType.Экзамен, + _ => DisciplineReportingType.Неопределено, + }; + + /// + /// Определение результата сдачи зачета/экзамена + /// + /// + /// + private static MarkDisciplinePassedType GetMark(StudentMarkSyncModel bill) => bill.grade switch + { + "Неявка" => MarkDisciplinePassedType.НеЯвился, + "Зачтено" => MarkDisciplinePassedType.Зачет, + "Неудовлетворительно" => MarkDisciplinePassedType.НеУдовлетворительно, + "Удовлетворительно" => MarkDisciplinePassedType.Удовлетворительно, + "Хорошо" => MarkDisciplinePassedType.Хорошо, + "Отлично" => MarkDisciplinePassedType.Отлично, + _ => MarkDisciplinePassedType.НеСдано, + }; + + /// + /// Сохранение лога с ошибками + /// + /// + /// + /// + private void SaveErrors(List<(string Title, string Message)> errors, string title, string message) + { + if (_history == null) + { + return; + } + + Errors = errors ?? new List<(string Title, string Message)>(); + Errors.Add((title, message)); + SaveLog(string.Join(Environment.NewLine, Errors.Select(x => x.Message))); + } + + /// + /// Сохранение лога + /// + /// + private void SaveLog(string info) + { + _recordLogic.Create(new StudentMarkSyncHistoryRecordSetBindingModel + { + StudentMarkSyncHistoryId = _history.Id, + Information = info + }); } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentInfoForMarkSyncModel.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentInfoForMarkSyncModel.cs new file mode 100644 index 0000000..c0671c0 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentInfoForMarkSyncModel.cs @@ -0,0 +1,32 @@ +namespace DepartmentBusinessLogic.HelperModels +{ + /// + /// Класс-модель для оценок студента из 1С + /// + public class StudentInfoForMarkSyncModel + { + public string login { get; set; } + + public string iduniv { get; set; } + + public string fullName { get; set; } + + public string recordBook { get; set; } + + public string studyPlan { get; set; } + + public string studyPlanFaculty { get; set; } + + public string studyPlanUnit { get; set; } + + public string studyPlanSpecialtyCode { get; set; } + + public string studyPlanSpecialtyName { get; set; } + + public string studyPlanSpecialtyProfile { get; set; } + + public string studyPlanEducationForm { get; set; } + + public StudentMarkSyncModel[] bills { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentInfoListForMarkSyncModel.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentInfoListForMarkSyncModel.cs new file mode 100644 index 0000000..8309b79 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentInfoListForMarkSyncModel.cs @@ -0,0 +1,10 @@ +namespace DepartmentBusinessLogic.HelperModels +{ + /// + /// Класс-модель для синхронизации оценок студента из 1С + /// + public class StudentInfoListForMarkSyncModel + { + public StudentInfoForMarkSyncModel[] arrayOfStudentsGrades { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentMarkSyncModel.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentMarkSyncModel.cs new file mode 100644 index 0000000..1197807 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/HelperModels/StudentMarkSyncModel.cs @@ -0,0 +1,26 @@ +namespace DepartmentBusinessLogic.HelperModels +{ + /// + /// Класс-модель для оценки студента из 1С + /// + public class StudentMarkSyncModel + { + public string semester { get; set; } + + public string disciplineName { get; set; } + + public string grade { get; set; } + + public string controlType { get; set; } + + public string controlTypeDate { get; set; } + + public string documentType { get; set; } + + public string gradeType { get; set; } + + public string billStudyPlan { get; set; } + + public string teacher { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/BindingModels/LecturerBindingModels.cs b/DepartmentPortal/Department/DepartmentContract/BindingModels/LecturerBindingModels.cs index 183aeb5..42e948f 100644 --- a/DepartmentPortal/Department/DepartmentContract/BindingModels/LecturerBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/BindingModels/LecturerBindingModels.cs @@ -15,6 +15,8 @@ namespace DepartmentContract.BindingModels public Guid? LecturerAcademicRankId { get; set; } public Guid? LecturerAcademicDegreeId { get; set; } + + public string FIO { get; set; } } /// diff --git a/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentMarkPassedDisciplineBindingModels.cs b/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentMarkPassedDisciplineBindingModels.cs index e9524e8..b16d261 100644 --- a/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentMarkPassedDisciplineBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentMarkPassedDisciplineBindingModels.cs @@ -17,7 +17,9 @@ namespace DepartmentContract.BindingModels public Guid? DisciplineId { get; set; } - public DateTime? DateStart { get; set; } + public Guid? LecturerId { get; set; } + + public DateTime? DateStart { get; set; } public DateTime? DateFinish { get; set; } } @@ -33,9 +35,14 @@ namespace DepartmentContract.BindingModels [Required(ErrorMessage = "required")] public Guid DisciplineId { get; set; } + public Guid? LecturerId { get; set; } + [Required(ErrorMessage = "required")] public Semester Semester { get; set; } + [Required(ErrorMessage = "required")] + public DisciplineReportingType DisciplineReportingType { get; set; } + [Required(ErrorMessage = "required")] public MarkDisciplinePassedType Mark { get; set; } @@ -47,5 +54,7 @@ namespace DepartmentContract.BindingModels [Required(ErrorMessage = "required")] public bool IsDirection { get; set; } + + public string AddiionalInfo { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentMarkSyncHistoryLogic.cs b/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentMarkSyncHistoryLogic.cs index cf4ba1a..7c170f0 100644 --- a/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentMarkSyncHistoryLogic.cs +++ b/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IStudentMarkSyncHistoryLogic.cs @@ -1,6 +1,5 @@ using DepartmentContract.BindingModels; using DepartmentContract.ViewModels; -using System; using System.Threading.Tasks; using ToolsModule.ManagmentEntity; @@ -12,7 +11,5 @@ namespace DepartmentContract.Logics.IGenericEntityLogic public interface IStudentMarkSyncHistoryLogic : IGenericEntityLogic { Task SyncMarks(); - - Task SyncStudentMarks(Guid studentId); } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentMarkPassedDisciplineViewModels.cs b/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentMarkPassedDisciplineViewModels.cs index aedb29d..b029b47 100644 --- a/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentMarkPassedDisciplineViewModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentMarkPassedDisciplineViewModels.cs @@ -20,9 +20,12 @@ namespace DepartmentContract.ViewModels [ViewModelControlElementProperty("Студент", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, SecurityWindowsDesktop")] public Guid StudentId { get; set; } - [ViewModelControlElementProperty("Дисциплина", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")] + [ViewModelControlElementProperty("Дисциплина", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")] public Guid DisciplineId { get; set; } + [ViewModelControlElementProperty("Преподаватель", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")] + public Guid? LecturerId { get; set; } + [ViewModelControlListProperty("Студент", ColumnWidth = 120)] [MapConfiguration("Student.ToString")] public string Student { get; set; } @@ -37,6 +40,12 @@ namespace DepartmentContract.ViewModels [ViewModelControlListProperty("Семестр", ColumnWidth = 120)] public string SemesterTitle => Semester.ToString("G"); + [ViewModelControlElementProperty("Тип отчетности", ControlType.ControlEnum, MustHaveValue = true)] + public DisciplineReportingType DisciplineReportingType { get; set; } + + [ViewModelControlListProperty("Тип отчетности", ColumnWidth = 120)] + public string DisciplineReportingTypeTitle => DisciplineReportingType.ToString("G"); + [ViewModelControlElementProperty("Оценка", ControlType.ControlEnum, MustHaveValue = true)] public MarkDisciplinePassedType Mark { get; set; } @@ -58,5 +67,9 @@ namespace DepartmentContract.ViewModels [ViewModelControlListProperty("По направлению", ColumnWidth = 100)] public string IsDirectionValue => IsDirection ? "Да" : "Нет"; + + [ViewModelControlListProperty("Доп. информация", ColumnWidth = 120)] + [ViewModelControlElementProperty("Доп. информация", ControlType.ControlText, MustHaveValue = false)] + public string AddiionalInfo { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/LecturerService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/LecturerService.cs index c34f369..8cdb9ca 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/LecturerService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/LecturerService.cs @@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore; using System; using System.Linq; using ToolsModule.ManagmentEntity; +using ToolsModule.ManagmentExtension; namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntityService { @@ -51,6 +52,22 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit { query = query.Where(x => x.LecturerAcademicRankId == model.LecturerAcademicRankId); } + if (model.FIO.IsNotEmpty()) + { + var fio = model.FIO.Split(' '); + if (fio.Length > 1) + { + query = query.Where(x => x.LastName == fio[0]); + } + if (fio.Length > 1) + { + query = query.Where(x => x.FirstName == fio[1]); + } + if (fio.Length > 2) + { + query = query.Where(x => x.Patronymic == fio[2]); + } + } return query; } diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentMarkPassedDisciplineService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentMarkPassedDisciplineService.cs index ab0c11c..1df32f2 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentMarkPassedDisciplineService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentMarkPassedDisciplineService.cs @@ -35,6 +35,10 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit { query = query.Where(x => x.Student.StudentGroupId == model.StudentGroupId); } + if (model.LecturerId.HasValue) + { + query = query.Where(x => x.LecturerId == model.LecturerId); + } if (model.DateStart.HasValue && model.DateFinish.HasValue) { query = query.Where(x => x.DateAffixing >= model.DateStart.Value && x.DateAffixing <= model.DateFinish.Value); @@ -50,11 +54,12 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit } protected override StudentMarkPassedDiscipline GetUniqueEntity(StudentMarkPassedDisciplineSetBindingModel model, IQueryable query) => query.FirstOrDefault(x => x.StudentId == model.StudentId && x.DisciplineId == model.DisciplineId && - x.Semester == model.Semester && x.Mark == model.Mark && x.Id != model.Id); + x.Semester == model.Semester && x.DisciplineReportingType == model.DisciplineReportingType && x.Mark == model.Mark && x.Id != model.Id); protected override IQueryable IncludingWhenReading(IQueryable query) => query .Include(x => x.Student) - .Include(x => x.Discipline); + .Include(x => x.Discipline) + .Include(x => x.Lecturer); protected override IQueryable OrderingWhenReading(IQueryable query) => query .OrderByDescending(x => x.Student)