From d1fcf069b32bea0fa575dca625c1edb0ca401926 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Sun, 27 Mar 2022 14:51:27 +0400 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B0=D0=B7=D0=BE=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=84=D0=B5=D0=B4=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0327102136_AddBasicDepartments.Designer.cs | 1581 +++++++++++++++++ .../20220327102136_AddBasicDepartments.cs | 108 ++ .../DatabaseContextModelSnapshot.cs | 73 + .../Models/Department/BasicDepartment.cs | 42 + .../Models/Department/Discipline.cs | 5 + .../Models/Department/Lecturer.cs | 3 + .../CoreDatabase/Models/Department/Student.cs | 5 + .../ModelsDepartment/IBasicDepartmentModel.cs | 19 + .../ModelsDepartment/IDisciplineModel.cs | 3 + .../ModelsDepartment/IStudentModel.cs | 3 + .../ManagmentSecurity/AccessOperation.cs | 2 + .../BasicDepartmentBusinessLogic.cs | 17 + .../DepartmentLogicDependencyRegistration.cs | 2 + .../BasicDepartmentBindingModels.cs | 31 + .../BindingModels/DisciplineBindingModels.cs | 7 + .../BindingModels/StudentBindingModels.cs | 4 + .../IBasicDepartmentLogic.cs | 11 + .../IBasicDepartmentService.cs | 10 + .../ViewModels/BasicDepartmentViewModels.cs | 42 + .../ViewModels/DisciplineViewModels.cs | 8 +- .../ViewModels/StudentViewModels.cs | 6 + ...entImplementationDependencyRegistration.cs | 2 + .../BasicDepartmentService.cs | 57 + .../DisciplineService.cs | 4 + .../StudentService.cs | 4 + .../DepartmentWindowDesktopExtension.cs | 3 +- .../ControlBasicDepartmentElement.Designer.cs | 33 + .../ControlBasicDepartmentElement.cs | 30 + .../ControlBasicDepartmentElement.resx | 120 ++ .../ControlBasicDepartmentList.Designer.cs | 33 + .../ControlBasicDepartmentList.cs | 42 + .../ControlBasicDepartmentList.resx | 120 ++ .../ControlEnrollmentYearList.cs | 2 +- 33 files changed, 2429 insertions(+), 3 deletions(-) create mode 100644 DepartmentPortal/Common/CoreDatabase/Migrations/20220327102136_AddBasicDepartments.Designer.cs create mode 100644 DepartmentPortal/Common/CoreDatabase/Migrations/20220327102136_AddBasicDepartments.cs create mode 100644 DepartmentPortal/Common/CoreDatabase/Models/Department/BasicDepartment.cs create mode 100644 DepartmentPortal/Common/CoreModels/ModelsDepartment/IBasicDepartmentModel.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/BasicDepartmentBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentContract/BindingModels/BasicDepartmentBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IBasicDepartmentLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentContract/Services/IGenericEntityService/IBasicDepartmentService.cs create mode 100644 DepartmentPortal/Department/DepartmentContract/ViewModels/BasicDepartmentViewModels.cs create mode 100644 DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/BasicDepartmentService.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.resx create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.resx diff --git a/DepartmentPortal/Common/CoreDatabase/Migrations/20220327102136_AddBasicDepartments.Designer.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/20220327102136_AddBasicDepartments.Designer.cs new file mode 100644 index 0000000..c685f8f --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/20220327102136_AddBasicDepartments.Designer.cs @@ -0,0 +1,1581 @@ +// +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("20220327102136_AddBasicDepartments")] + partial class AddBasicDepartments + { + 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("CreateDate") + .HasColumnType("datetime2"); + + 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.HasKey("Id"); + + b.HasIndex("EducationDirectionId", "CreateDate") + .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.EnrollmentYear", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("AcademicPlanId") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("YearEntrance") + .HasColumnType("int"); + + b.Property("YearFinish") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AcademicPlanId", "YearEntrance") + .IsUnique(); + + b.ToTable("EnrollmentYears"); + }); + + 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") + .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("EnrollmentYearId") + .HasColumnType("uniqueidentifier"); + + 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("EnrollmentYearId"); + + 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("AcademicCourse") + .HasColumnType("int"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EducationDirectionId") + .HasColumnType("uniqueidentifier"); + + b.Property("GroupNumber") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("LecturerId"); + + b.HasIndex("EducationDirectionId", "AcademicCourse", "GroupNumber") + .IsUnique(); + + b.ToTable("StudentGroups"); + }); + + 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.EnrollmentYear", b => + { + b.HasOne("CoreDatabase.Models.Department.AcademicPlan", "AcademicPlan") + .WithMany() + .HasForeignKey("AcademicPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AcademicPlan"); + }); + + 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.EnrollmentYear", "EnrollmentYear") + .WithMany("Students") + .HasForeignKey("EnrollmentYearId"); + + 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("EnrollmentYear"); + + b.Navigation("StudentGroup"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.StudentGroup", b => + { + b.HasOne("CoreDatabase.Models.Department.EducationDirection", "EducationDirection") + .WithMany("StudentGroups") + .HasForeignKey("EducationDirectionId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CoreDatabase.Models.Department.Lecturer", "Lecturer") + .WithMany("StudentGroups") + .HasForeignKey("LecturerId"); + + b.Navigation("EducationDirection"); + + b.Navigation("Lecturer"); + }); + + 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"); + }); + + 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"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.DisciplineBlock", b => + { + b.Navigation("Disciplines"); + + b.Navigation("TimeNorms"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.EducationDirection", b => + { + b.Navigation("AcademicPlans"); + + b.Navigation("StudentGroups"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.Employee", b => + { + b.Navigation("Classrooms"); + + b.Navigation("EmployeePosts"); + }); + + modelBuilder.Entity("CoreDatabase.Models.Department.EnrollmentYear", b => + { + b.Navigation("Students"); + }); + + 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"); + }); + + 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/20220327102136_AddBasicDepartments.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/20220327102136_AddBasicDepartments.cs new file mode 100644 index 0000000..54f133f --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/20220327102136_AddBasicDepartments.cs @@ -0,0 +1,108 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace CoreDatabase.Migrations +{ + public partial class AddBasicDepartments : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "BasicDepartmentId", + table: "Students", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.AddColumn( + name: "BasicDepartmentId", + table: "Disciplines", + type: "uniqueidentifier", + nullable: true); + + migrationBuilder.CreateTable( + name: "BasicDepartment", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + LecturerId = table.Column(type: "uniqueidentifier", nullable: true), + BasicDepartmentName = table.Column(type: "nvarchar(max)", nullable: true), + BasicDepartmentDescription = table.Column(type: "nvarchar(max)", nullable: true), + EnterprisesName = table.Column(type: "nvarchar(max)", nullable: true), + 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_BasicDepartment", x => x.Id); + table.ForeignKey( + name: "FK_BasicDepartment_Lecturers_LecturerId", + column: x => x.LecturerId, + principalTable: "Lecturers", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_Students_BasicDepartmentId", + table: "Students", + column: "BasicDepartmentId"); + + migrationBuilder.CreateIndex( + name: "IX_Disciplines_BasicDepartmentId", + table: "Disciplines", + column: "BasicDepartmentId"); + + migrationBuilder.CreateIndex( + name: "IX_BasicDepartment_LecturerId", + table: "BasicDepartment", + column: "LecturerId"); + + migrationBuilder.AddForeignKey( + name: "FK_Disciplines_BasicDepartment_BasicDepartmentId", + table: "Disciplines", + column: "BasicDepartmentId", + principalTable: "BasicDepartment", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Students_BasicDepartment_BasicDepartmentId", + table: "Students", + column: "BasicDepartmentId", + principalTable: "BasicDepartment", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Disciplines_BasicDepartment_BasicDepartmentId", + table: "Disciplines"); + + migrationBuilder.DropForeignKey( + name: "FK_Students_BasicDepartment_BasicDepartmentId", + table: "Students"); + + migrationBuilder.DropTable( + name: "BasicDepartment"); + + migrationBuilder.DropIndex( + name: "IX_Students_BasicDepartmentId", + table: "Students"); + + migrationBuilder.DropIndex( + name: "IX_Disciplines_BasicDepartmentId", + table: "Disciplines"); + + migrationBuilder.DropColumn( + name: "BasicDepartmentId", + table: "Students"); + + migrationBuilder.DropColumn( + name: "BasicDepartmentId", + table: "Disciplines"); + } + } +} diff --git a/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs b/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs index 7e2e951..2c0feab 100644 --- a/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs +++ b/DepartmentPortal/Common/CoreDatabase/Migrations/DatabaseContextModelSnapshot.cs @@ -132,6 +132,39 @@ namespace CoreDatabase.Migrations 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") @@ -192,6 +225,9 @@ namespace CoreDatabase.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("BasicDepartmentId") + .HasColumnType("uniqueidentifier"); + b.Property("DateCreate") .HasColumnType("datetime2"); @@ -219,6 +255,8 @@ namespace CoreDatabase.Migrations b.HasKey("Id"); + b.HasIndex("BasicDepartmentId"); + b.HasIndex("DisciplineBlockId"); b.HasIndex("DisciplineName") @@ -769,6 +807,9 @@ namespace CoreDatabase.Migrations b.Property("Id") .HasColumnType("uniqueidentifier"); + b.Property("BasicDepartmentId") + .HasColumnType("uniqueidentifier"); + b.Property("DateCreate") .HasColumnType("datetime2"); @@ -823,6 +864,8 @@ namespace CoreDatabase.Migrations b.HasKey("Id"); + b.HasIndex("BasicDepartmentId"); + b.HasIndex("EnrollmentYearId"); b.HasIndex("NumberOfBook") @@ -1146,6 +1189,15 @@ namespace CoreDatabase.Migrations 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") @@ -1159,12 +1211,18 @@ namespace CoreDatabase.Migrations 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"); }); @@ -1308,6 +1366,10 @@ namespace CoreDatabase.Migrations modelBuilder.Entity("CoreDatabase.Models.Department.Student", b => { + b.HasOne("CoreDatabase.Models.Department.BasicDepartment", "BasicDepartment") + .WithMany("Students") + .HasForeignKey("BasicDepartmentId"); + b.HasOne("CoreDatabase.Models.Department.EnrollmentYear", "EnrollmentYear") .WithMany("Students") .HasForeignKey("EnrollmentYearId"); @@ -1322,6 +1384,8 @@ namespace CoreDatabase.Migrations .OnDelete(DeleteBehavior.Cascade) .IsRequired(); + b.Navigation("BasicDepartment"); + b.Navigation("EnrollmentYear"); b.Navigation("StudentGroup"); @@ -1397,6 +1461,13 @@ namespace CoreDatabase.Migrations 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"); @@ -1430,6 +1501,8 @@ namespace CoreDatabase.Migrations modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b => { + b.Navigation("BasicDepartments"); + b.Navigation("EducationDirections"); b.Navigation("LecturerPosts"); diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/BasicDepartment.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/BasicDepartment.cs new file mode 100644 index 0000000..deda25d --- /dev/null +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/BasicDepartment.cs @@ -0,0 +1,42 @@ +using CoreModels.ModelsDepartment; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; +using ToolsModule.ManagmentSecurity; + +namespace CoreDatabase.Models.Department +{ + /// + /// Класс, описывающий базовую кафедру + /// + [DataContract] + public class BasicDepartment : BaseEntity, IEntitySecurityExtenstion, IBasicDepartmentModel + { + public Guid? LecturerId { get; set; } + + public string BasicDepartmentName { get; set; } + + public string BasicDepartmentDescription { get; set; } + + public string EnterprisesName { get; set; } + + //------------------------------------------------------------------------- + + public virtual Lecturer Lecturer { get; set; } + + //------------------------------------------------------------------------- + + [ForeignKey("BasicDepartmentId")] + public virtual List Disciplines { get; set; } + + [ForeignKey("BasicDepartmentId")] + public virtual List Students { get; set; } + + //------------------------------------------------------------------------- + + public BasicDepartment SecurityCheck(BasicDepartment entity, bool allowFullData) => entity; + + public override string ToString() => BasicDepartmentName; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs index 59e0a4a..b2512f9 100644 --- a/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/Discipline.cs @@ -18,6 +18,9 @@ namespace CoreDatabase.Models.Department [Required(ErrorMessage = "required")] public Guid DisciplineBlockId { get; set; } + [DataMember] + public Guid? BasicDepartmentId { get; set; } + [DataMember] [Required(ErrorMessage = "required")] public string DisciplineName { get; set; } @@ -34,6 +37,8 @@ namespace CoreDatabase.Models.Department public virtual DisciplineBlock DisciplineBlock { get; set; } + public virtual BasicDepartment BasicDepartment { get; set; } + //------------------------------------------------------------------------- [ForeignKey("DisciplineId")] diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs index d4ee942..f0fcfb9 100644 --- a/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/Lecturer.cs @@ -87,6 +87,9 @@ namespace CoreDatabase.Models.Department [ForeignKey("LecturerId")] public virtual List StudentGroups { get; set; } + [ForeignKey("LecturerId")] + public virtual List BasicDepartments { get; set; } + //------------------------------------------------------------------------- public Lecturer SecurityCheck(Lecturer entity, bool allowFullData) diff --git a/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs b/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs index 943b333..095012e 100644 --- a/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs +++ b/DepartmentPortal/Common/CoreDatabase/Models/Department/Student.cs @@ -24,6 +24,9 @@ namespace CoreDatabase.Models.Department [DataMember] public Guid? EnrollmentYearId { get; set; } + [DataMember] + public Guid? BasicDepartmentId { get; set; } + [DataMember] [Required] public string Iduniv { get; set; } @@ -66,6 +69,8 @@ namespace CoreDatabase.Models.Department public virtual EnrollmentYear EnrollmentYear { get; set; } + public virtual BasicDepartment BasicDepartment { get; set; } + //------------------------------------------------------------------------- [ForeignKey("StudentId")] diff --git a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IBasicDepartmentModel.cs b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IBasicDepartmentModel.cs new file mode 100644 index 0000000..8ea3b0a --- /dev/null +++ b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IBasicDepartmentModel.cs @@ -0,0 +1,19 @@ +using CoreModels.Tools; +using System; +using ToolsModule.ManagmentEntity; + +namespace CoreModels.ModelsDepartment +{ + [EntityDescription("BasicDepartment", "Базовая кафедра")] + [EntityDependency("Lecturer", "LecturerId", "Преподаватель, отвечающий за взаимодействие с предприятием")] + public interface IBasicDepartmentModel : IId + { + Guid? LecturerId { get; } + + string BasicDepartmentName { get; } + + string BasicDepartmentDescription { get; } + + string EnterprisesName { get; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IDisciplineModel.cs b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IDisciplineModel.cs index af00218..5790e71 100644 --- a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IDisciplineModel.cs +++ b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IDisciplineModel.cs @@ -6,10 +6,13 @@ namespace CoreModels.ModelsDepartment { [EntityDescription("Discipline", "Дисципилна кафедры")] [EntityDependency("DisciplineBlock", "DisciplineBlockId", "Блок дисцпилн, к которому относится дисциплина")] + [EntityDependency("BasicDepartment", "BasicDepartmentId", "Базовая кафедра, к которой относится дисциплина")] public interface IDisciplineModel : IId { Guid DisciplineBlockId { get; } + Guid? BasicDepartmentId { get; } + string DisciplineName { get; } string DisciplineShortName { get; } diff --git a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs index 2d65e74..159b177 100644 --- a/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs +++ b/DepartmentPortal/Common/CoreModels/ModelsDepartment/IStudentModel.cs @@ -9,6 +9,7 @@ namespace CoreModels.ModelsDepartment [EntityDependency("User", "UserId", "К какому пользователю относится студент")] [EntityDependency("StudentGroup", "StudentGroupId", "К какой группе относится студент")] [EntityDependency("EnrollmentYear", "EnrollmentYearId", "К какому году поступления/выпуска относится")] + [EntityDependency("BasicDepartment", "BasicDepartmentId", "Базовая кафедра, к которой относится студент")] public interface IStudentModel : IId { Guid UserId { get; } @@ -17,6 +18,8 @@ namespace CoreModels.ModelsDepartment Guid? EnrollmentYearId { get; } + Guid? BasicDepartmentId { get; } + string Iduniv { get; } string NumberOfBook { get; } diff --git a/DepartmentPortal/Common/ToolsModule/ManagmentSecurity/AccessOperation.cs b/DepartmentPortal/Common/ToolsModule/ManagmentSecurity/AccessOperation.cs index d8dda2f..d44ca5d 100644 --- a/DepartmentPortal/Common/ToolsModule/ManagmentSecurity/AccessOperation.cs +++ b/DepartmentPortal/Common/ToolsModule/ManagmentSecurity/AccessOperation.cs @@ -48,6 +48,8 @@ Приказы = 111, + БазовыеКафедры = 112, + СинхронизацияПриказов = 150, #endregion diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/BasicDepartmentBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/BasicDepartmentBusinessLogic.cs new file mode 100644 index 0000000..31a8273 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/GenericBusinessLogic/BasicDepartmentBusinessLogic.cs @@ -0,0 +1,17 @@ +using DepartmentContract.BindingModels; +using DepartmentContract.Logics.IGenericEntityLogic; +using DepartmentContract.Services.IGenericEntityService; +using DepartmentContract.ViewModels; +using ToolsModule.ManagmentEntity; +using ToolsModule.ManagmentSecurity; + +namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic +{ + /// + /// Логика работы с базовыми кафедрами + /// + public class BasicDepartmentBusinessLogic : GenericBusinessLogic, IBasicDepartmentLogic + { + public BasicDepartmentBusinessLogic(IBasicDepartmentService service) : base(service, "Базовые кафедры", AccessOperation.БазовыеКафедры) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs index 82b0c8a..5eb843b 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentLogicDependencyRegistration.cs @@ -41,6 +41,8 @@ namespace DepartmentBusinessLogic DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/BindingModels/BasicDepartmentBindingModels.cs b/DepartmentPortal/Department/DepartmentContract/BindingModels/BasicDepartmentBindingModels.cs new file mode 100644 index 0000000..26ad0bc --- /dev/null +++ b/DepartmentPortal/Department/DepartmentContract/BindingModels/BasicDepartmentBindingModels.cs @@ -0,0 +1,31 @@ +using CoreModels.ModelsDepartment; +using System; +using System.ComponentModel.DataAnnotations; +using ToolsModule.ManagmentEntity; + +namespace DepartmentContract.BindingModels +{ + /// + /// Получение базовой кафедры + /// + public class BasicDepartmentGetBindingModel : GetBindingModel + { + public Guid? LecturerId { get; set; } + } + + /// + /// Сохранение базовой кафедры + /// + public class BasicDepartmentSetBindingModel : SetBindingModel, IBasicDepartmentModel + { + public Guid? LecturerId { get; set; } + + [Required(ErrorMessage = "required")] + public string BasicDepartmentName { get; set; } + + public string BasicDepartmentDescription { get; set; } + + [Required(ErrorMessage = "required")] + public string EnterprisesName { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/BindingModels/DisciplineBindingModels.cs b/DepartmentPortal/Department/DepartmentContract/BindingModels/DisciplineBindingModels.cs index 96213b2..55c23a4 100644 --- a/DepartmentPortal/Department/DepartmentContract/BindingModels/DisciplineBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/BindingModels/DisciplineBindingModels.cs @@ -15,6 +15,11 @@ namespace DepartmentContract.BindingModels /// public Guid? DisciplineBlockId { get; set; } + /// + /// Выбрка по базовым кафедрам + /// + public Guid? BasicDepartmentId { get; set; } + /// /// Поиск по названию /// @@ -29,6 +34,8 @@ namespace DepartmentContract.BindingModels [Required(ErrorMessage = "required")] public Guid DisciplineBlockId { get; set; } + public Guid? BasicDepartmentId { get; set; } + [Required(ErrorMessage = "required")] public string DisciplineName { get; set; } diff --git a/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentBindingModels.cs b/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentBindingModels.cs index 8b089b5..0309f03 100644 --- a/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/BindingModels/StudentBindingModels.cs @@ -17,6 +17,8 @@ namespace DepartmentContract.BindingModels public Guid? EnrollmentYearId { get; set; } + public Guid? BasicDepartmentId { get; set; } + public StudentState? StudentState { get; set; } public string NumberOfBook { get; set; } @@ -34,6 +36,8 @@ namespace DepartmentContract.BindingModels public Guid? EnrollmentYearId { get; set; } + public Guid? BasicDepartmentId { get; set; } + [Required(ErrorMessage = "required")] public string Iduniv { get; set; } diff --git a/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IBasicDepartmentLogic.cs b/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IBasicDepartmentLogic.cs new file mode 100644 index 0000000..9e0caf6 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentContract/Logics/IGenericEntityLogic/IBasicDepartmentLogic.cs @@ -0,0 +1,11 @@ +using DepartmentContract.BindingModels; +using DepartmentContract.ViewModels; +using ToolsModule.ManagmentEntity; + +namespace DepartmentContract.Logics.IGenericEntityLogic +{ + /// + /// Логика работы с базовыми кафедрами + /// + public interface IBasicDepartmentLogic : IGenericEntityLogic { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/Services/IGenericEntityService/IBasicDepartmentService.cs b/DepartmentPortal/Department/DepartmentContract/Services/IGenericEntityService/IBasicDepartmentService.cs new file mode 100644 index 0000000..d7029b4 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentContract/Services/IGenericEntityService/IBasicDepartmentService.cs @@ -0,0 +1,10 @@ +using DepartmentContract.BindingModels; +using ToolsModule.ManagmentEntity; + +namespace DepartmentContract.Services.IGenericEntityService +{ + /// + /// Хранение базовых кафедр + /// + public interface IBasicDepartmentService : IGenericEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/ViewModels/BasicDepartmentViewModels.cs b/DepartmentPortal/Department/DepartmentContract/ViewModels/BasicDepartmentViewModels.cs new file mode 100644 index 0000000..9f1126d --- /dev/null +++ b/DepartmentPortal/Department/DepartmentContract/ViewModels/BasicDepartmentViewModels.cs @@ -0,0 +1,42 @@ +using CoreModels.ModelsDepartment; +using System; +using ToolsModule.ManagmentEntity; +using ToolsModule.ManagmentMapping; + +namespace DepartmentContract.ViewModels +{ + /// + /// Список аудиторий + /// + public class BasicDepartmentListViewModel : ListViewModel { } + + /// + /// Элемент аудитории + /// + [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 700)] + [ViewModelControlElementDependenceEntity(Title = "Дисциплины", Order = 1, ParentPropertyName = "BasicDepartmentId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlDisciplineList, DepartmentWindowsDesktop")] + [ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 2, ParentPropertyName = "BasicDepartmentId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")] + public class BasicDepartmentViewModel : ElementViewModel, IBasicDepartmentModel + { + [ViewModelControlElementProperty("Ответственный", ControlType.ControlGuid, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")] + public Guid? LecturerId { get; set; } + + [ViewModelControlListProperty("Ответственный")] + [MapConfiguration("Lecturer.LastName")] + public string LecturerName { get; set; } + + [ViewModelControlListProperty("Название", ColumnWidth = 100)] + [ViewModelControlElementProperty("Название", ControlType.ControlString, MustHaveValue = true)] + public string BasicDepartmentName { get; set; } + + [ViewModelControlListProperty("Описание", ColumnWidth = 100)] + [ViewModelControlElementProperty("Описание", ControlType.ControlString)] + public string BasicDepartmentDescription { get; set; } + + [ViewModelControlListProperty("Предприятие", ColumnWidth = 100)] + [ViewModelControlElementProperty("Предприятие", ControlType.ControlString, MustHaveValue = true)] + public string EnterprisesName { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/ViewModels/DisciplineViewModels.cs b/DepartmentPortal/Department/DepartmentContract/ViewModels/DisciplineViewModels.cs index b11782b..891e188 100644 --- a/DepartmentPortal/Department/DepartmentContract/ViewModels/DisciplineViewModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/ViewModels/DisciplineViewModels.cs @@ -20,6 +20,12 @@ namespace DepartmentContract.ViewModels [ViewModelControlElementProperty("Блок дисциплин", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlDisciplineBlockList, DepartmentWindowsDesktop")] public Guid DisciplineBlockId { get; set; } + [ViewModelControlElementProperty("Базовая кафедра", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlBasicDepartmentList, DepartmentWindowsDesktop")] + public Guid? BasicDepartmentId { get; set; } + + [ViewModelControlListProperty("Базовая кафедра")] + public bool IsBasicDepartmentId => BasicDepartmentId.HasValue ? true : false; + [ViewModelControlListProperty("Название дисциплины")] [ViewModelControlElementProperty("Название дисциплины", ControlType.ControlString, MustHaveValue = true)] public string DisciplineName { get; set; } @@ -34,5 +40,5 @@ namespace DepartmentContract.ViewModels [ViewModelControlElementProperty("Название в планах", ControlType.ControlString)] public string DisciplineBlueAsteriskName { get; set; } - } + } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs b/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs index df25260..ed8cf8e 100644 --- a/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs +++ b/DepartmentPortal/Department/DepartmentContract/ViewModels/StudentViewModels.cs @@ -31,6 +31,9 @@ namespace DepartmentContract.ViewModels [ViewModelControlElementProperty("Год выпуска", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEnrollmentYearList, DepartmentWindowsDesktop")] public Guid? EnrollmentYearId { get; set; } + [ViewModelControlElementProperty("Базовая кафедра", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlBasicDepartmentList, DepartmentWindowsDesktop")] + public Guid? BasicDepartmentId { get; set; } + [ViewModelControlElementProperty("Идентификатор универа", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)] public string Iduniv { get; set; } @@ -54,6 +57,9 @@ namespace DepartmentContract.ViewModels [ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)] public string Email { get; set; } + [ViewModelControlListProperty("Базовая кафедра")] + public bool IsBasicDepartmentId => BasicDepartmentId.HasValue ? true : false; + [ViewModelControlElementProperty("Описание", ControlType.ControlText)] public string Description { get; set; } diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationDependencyRegistration.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationDependencyRegistration.cs index 5042da7..3411d6f 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationDependencyRegistration.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationDependencyRegistration.cs @@ -42,6 +42,8 @@ namespace DepartmentDatabaseImplementation DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/BasicDepartmentService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/BasicDepartmentService.cs new file mode 100644 index 0000000..4e9508a --- /dev/null +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/BasicDepartmentService.cs @@ -0,0 +1,57 @@ +using CoreDatabase; +using CoreDatabase.Models.Department; +using DepartmentContract.BindingModels; +using DepartmentContract.Services.IGenericEntityService; +using DepartmentContract.ViewModels; +using Microsoft.EntityFrameworkCore; +using System.Linq; +using ToolsModule.ManagmentEntity; + +namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntityService +{ + /// + /// Реализация интерфейса IBasicDepartmentService + /// + public class BasicDepartmentService : + AbstractGenerticEntityService, + IBasicDepartmentService + { + protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, BasicDepartmentSetBindingModel model) => OperationResultModel.Success(null); + + protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, BasicDepartment entity, BasicDepartmentGetBindingModel model) => OperationResultModel.Success(null); + + protected override IQueryable AdditionalCheckingWhenReadingList(IQueryable query, BasicDepartmentGetBindingModel model) + { + if (model.LecturerId.HasValue) + { + query = query.Where(x => x.LecturerId == model.LecturerId.Value); + } + return query; + } + + protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, BasicDepartmentSetBindingModel model) => OperationResultModel.Success(null); + + protected override void AdditionalDeleting(DbContext context, BasicDepartment entity, BasicDepartmentGetBindingModel model) + { + var studentrecords = context.Set().Where(x => x.BasicDepartmentId == model.Id); + foreach (var record in studentrecords) + { + record.BasicDepartmentId = null; + } + context.SaveChanges(); + + var disciplinerecords = context.Set().Where(x => x.BasicDepartmentId == model.Id); + foreach (var record in disciplinerecords) + { + record.BasicDepartmentId = null; + } + context.SaveChanges(); + } + + protected override BasicDepartment GetUniqueEntity(BasicDepartmentSetBindingModel model, DbContext context) => context.Set().FirstOrDefault(x => x.BasicDepartmentName == model.BasicDepartmentName && x.Id != model.Id); + + protected override IQueryable IncludingWhenReading(IQueryable query) => query.Include(x => x.Lecturer); + + protected override IQueryable OrderingWhenReading(IQueryable query) => query.OrderBy(x => x.BasicDepartmentName); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/DisciplineService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/DisciplineService.cs index dcc68a0..71587e0 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/DisciplineService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/DisciplineService.cs @@ -38,6 +38,10 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit { query = query.Where(x => x.DisciplineBlockId == model.DisciplineBlockId.Value); } + if (model.BasicDepartmentId.HasValue) + { + query = query.Where(x => x.BasicDepartmentId == model.BasicDepartmentId.Value); + } return query; } diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentService.cs index ca37a28..9644bc7 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/AbstractGenerticEntityService/StudentService.cs @@ -40,6 +40,10 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit { query = query.Where(x => x.StudentState == model.StudentState.Value); } + if (model.BasicDepartmentId.HasValue) + { + query = query.Where(x => x.BasicDepartmentId == model.BasicDepartmentId.Value); + } return query; } diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs index 526a63f..e410aa0 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs @@ -43,7 +43,8 @@ namespace DepartmentWindowsDesktop new ControlStudentGroupList(), new ControlStudentList(), new ControlOrderList(), - new ControlOrderSyncHistoryList() + new ControlOrderSyncHistoryList(), + new ControlBasicDepartmentList() }; foreach (var cntrl in _controls) diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.Designer.cs new file mode 100644 index 0000000..19ad38e --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlBasicDepartmentElement + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.cs new file mode 100644 index 0000000..1944e21 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.cs @@ -0,0 +1,30 @@ +using DepartmentContract.BindingModels; +using DepartmentContract.Logics.IGenericEntityLogic; +using DepartmentContract.ViewModels; +using System; +using ToolsDesktop.Controls; +using ToolsDesktop.Interfaces; +using ToolsDesktop.Models; + +namespace DepartmentWindowsDesktop.EntityControls +{ + /// + /// Реализация контрола для базовой кафедры + /// + public partial class ControlBasicDepartmentElement : + GenericControlEntityElement, + IGenericControlEntityElement + { + public ControlBasicDepartmentElement() + { + InitializeComponent(); + Title = "Базовая кафедра"; + ControlId = new Guid("bce7c7f4-2b7f-4b0c-aa4b-0c7a026967c6"); + _genericControlViewEntityElement = this; + } + + public IControl GetInstanceGenericControl() => new ControlBasicDepartmentElement() { ControlId = Guid.NewGuid() }; + + public ControlViewEntityElementConfiguration GetConfigControl() => new(); + } +} diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentElement.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.Designer.cs new file mode 100644 index 0000000..cc15d2e --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlBasicDepartmentList + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Код, автоматически созданный конструктором компонентов + + /// + /// Требуемый метод для поддержки конструктора — не изменяйте + /// содержимое этого метода с помощью редактора кода. + /// + private void InitializeComponent() + { + components = new System.ComponentModel.Container(); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + } + + #endregion + } +} diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.cs new file mode 100644 index 0000000..55b6a8c --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.cs @@ -0,0 +1,42 @@ +using DepartmentContract.BindingModels; +using DepartmentContract.Logics.IGenericEntityLogic; +using DepartmentContract.ViewModels; +using System; +using System.Collections.Generic; +using ToolsDesktop.Controls; +using ToolsDesktop.Enums; +using ToolsDesktop.Interfaces; +using ToolsDesktop.Models; +using ToolsModule.ManagmentSecurity; + +namespace DepartmentWindowsDesktop.EntityControls +{ + /// + /// Реализация контрола для списка базовых кафедр + /// + public partial class ControlBasicDepartmentList : + GenericControlEntityList, + IGenericControlEntityList + { + public ControlBasicDepartmentList() + { + InitializeComponent(); + Title = "Базовые кафедры"; + ControlId = new Guid("3f6d5487-f10d-43d9-8f5a-2059403b8946"); + AccessOperation = AccessOperation.БазовыеКафедры; + ControlViewEntityElement = new ControlBasicDepartmentElement(); + _genericControlViewEntityList = this; + } + + public IControl GetInstanceGenericControl() => new ControlBasicDepartmentList() { ControlId = Guid.NewGuid() }; + + public ControlViewEntityListConfiguration GetConfigControl() => new() + { + PaginationOn = false, + HideToolStripButton = new List + { + ToolStripButtonListNames.toolStripButtonSearch + } + }; + } +} diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/BasicDepartment/ControlBasicDepartmentList.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/EnrollmentYear/ControlEnrollmentYearList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/EnrollmentYear/ControlEnrollmentYearList.cs index 3777ef4..fff4650 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/EnrollmentYear/ControlEnrollmentYearList.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/EnrollmentYear/ControlEnrollmentYearList.cs @@ -24,7 +24,7 @@ namespace DepartmentWindowsDesktop.EntityControls Title = "Года поступления"; ControlId = new Guid("c0b26e65-78fa-40b6-b6ab-2f9c5a0b19dc"); AccessOperation = AccessOperation.Должности; - ControlViewEntityElement = new ControlEmployeePostElement(); + ControlViewEntityElement = new ControlEnrollmentYearElement(); _genericControlViewEntityList = this; }