From d93117f01a4b5e259bd9937bf31f7747131f1795 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Tue, 13 Apr 2021 12:52:45 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B8=D0=BA=D0=B0=D0=B7=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DatabaseCore/DatabaseContext.cs | 31 + .../20210413070716_AddOrders.Designer.cs | 1401 +++++++++++++++++ .../Migrations/20210413070716_AddOrders.cs | 108 ++ .../DatabaseContextModelSnapshot.cs | 125 ++ .../Models/Department/AcademicPlan.cs | 4 +- .../Models/Department/AcademicPlanRecord.cs | 2 + .../AcademicPlanRecordTimeNormHour.cs | 2 + .../Models/Department/Classroom.cs | 2 + .../Models/Department/Discipline.cs | 4 +- .../Models/Department/DisciplineBlock.cs | 4 +- .../Models/Department/EducationDirection.cs | 4 +- .../Models/Department/Employee.cs | 4 + .../Models/Department/EmployeePost.cs | 2 + .../Models/Department/Lecturer.cs | 4 + .../Department/LecturerAcademicDegree.cs | 2 + .../Models/Department/LecturerAcademicRank.cs | 2 + .../Models/Department/LecturerPost.cs | 2 + .../DatabaseCore/Models/Department/Order.cs | 46 + .../Models/Department/OrderStudentRecord.cs | 74 + .../DatabaseCore/Models/Department/Post.cs | 2 + .../DatabaseCore/Models/Department/Student.cs | 9 + .../Models/Department/StudentGroup.cs | 8 + .../Models/Department/TimeNorm.cs | 2 + .../DatabaseCore/Models/Security/Access.cs | 6 +- .../Models/Security/EnviromentSetting.cs | 2 + .../DatabaseCore/Models/Security/Role.cs | 2 + .../DatabaseCore/Models/Security/User.cs | 4 +- .../DatabaseCore/Models/Security/UserRole.cs | 4 +- .../ModuleTools/BusinessLogics/Mapper.cs | 9 + .../ModuleTools/Enums/AccessOperation.cs | 2 +- .../ViewModels/ElementViewModel.cs | 5 + .../BindingModels/OrderBindingModels.cs | 33 + .../OrderStudentRecordBindingModel.cs | 47 + .../BusinessLogics/OrderBusinessLogic.cs | 16 + .../OrderStudentRecordBusinessLogic.cs | 16 + .../Enums/OrderStudentMoveType.cs | 38 + .../Enums/OrderType.cs | 14 + .../Interfaces/IOrderService.cs | 10 + .../Interfaces/IOrderStudentRecordService.cs | 10 + ...cademicPlanRecordTimeNormHourViewModels.cs | 4 +- .../AcademicPlanRecordViewModels.cs | 2 +- .../ViewModels/AcademicPlanViewModels.cs | 2 - .../ViewModels/ClassroomViewModels.cs | 2 - .../ViewModels/DisciplineBlockViewModels.cs | 2 - .../ViewModels/DisciplineViewModels.cs | 2 - .../EducationDirectionViewModels.cs | 2 - .../ViewModels/EmployeePostViewModels.cs | 6 +- .../ViewModels/EmployeeViewModels.cs | 4 - .../LecturerAcademicDegreeViewModels.cs | 2 - .../LecturerAcademicRankViewModels.cs | 2 - .../ViewModels/LecturerPostViewModels.cs | 6 +- .../ViewModels/LecturerViewModels.cs | 4 - .../ViewModels/OrderStudentRecordViewModel.cs | 45 + .../ViewModels/OrderViewModels.cs | 39 + .../ViewModels/PostViewModels.cs | 2 - .../ViewModels/StudentGroupViewModels.cs | 17 +- .../ViewModels/StudentViewModels.cs | 8 +- .../ViewModels/TimeNormViewModels.cs | 2 - .../DepartmentImplementationExtensions.cs | 3 + .../Implementations/OrderService.cs | 44 + .../OrderStudentRecordService.cs | 50 + .../Implementations/StudentGroupService.cs | 12 +- .../Implementations/StudentService.cs | 12 +- .../DepartmentWindowDesktopExtension.cs | 3 +- .../Discipline/ControlDisciplineList.cs | 3 + .../Order/ControlOrderElement.Designer.cs | 33 + .../Order/ControlOrderElement.cs | 30 + .../Order/ControlOrderElement.resx | 120 ++ .../Order/ControlOrderList.Designer.cs | 33 + .../EntityControls/Order/ControlOrderList.cs | 36 + .../Order/ControlOrderList.resx | 120 ++ ...ntrolOrderStudentRecordElement.Designer.cs | 33 + .../ControlOrderStudentRecordElement.cs | 30 + .../ControlOrderStudentRecordElement.resx | 120 ++ .../ControlOrderStudentRecordList.Designer.cs | 38 + .../ControlOrderStudentRecordList.cs | 36 + .../ControlOrderStudentRecordList.resx | 120 ++ .../ViewModels/AccessViewModels.cs | 4 +- .../ViewModels/EnviromentSettingViewModels.cs | 2 - .../ViewModels/RoleViewModels.cs | 2 - .../ViewModels/UserRoleViewModels.cs | 6 +- .../ViewModels/UserViewModels.cs | 3 - 82 files changed, 3026 insertions(+), 82 deletions(-) create mode 100644 DepartmentPortal/Common/DatabaseCore/Migrations/20210413070716_AddOrders.Designer.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Migrations/20210413070716_AddOrders.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/Order.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/OrderStudentRecord.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderStudentRecordBindingModel.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderStudentMoveType.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderType.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderStudentRecordService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderStudentRecordViewModel.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderViewModels.cs create mode 100644 DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderService.cs create mode 100644 DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderStudentRecordService.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.resx create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.resx create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.resx create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.resx diff --git a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs index a6bb483..32ea06e 100644 --- a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs +++ b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs @@ -58,9 +58,38 @@ namespace DatabaseCore modelBuilder.Entity().HasIndex(d => new { d.AcademicPlanRecordId, d.TimeNormId }).IsUnique(); + // ругается на циклическое каскадное удаление, так что по нормам времени убираем ее + modelBuilder.Entity() + .HasOne(x => x.TimeNorm) + .WithMany(x => x.AcademicPlanRecordTimeNormHours) + .OnDelete(DeleteBehavior.NoAction); + modelBuilder.Entity().HasIndex(d => new { d.AcademicPlanId, d.EnrollmentYear, d.GroupNumber }).IsUnique(); modelBuilder.Entity().HasIndex(d => new { d.NumberOfBook }).IsUnique(); + + modelBuilder.Entity().HasIndex(d => new { d.OrderNumber }).IsUnique(); + + modelBuilder.Entity().HasIndex(d => new { d.StudentId, d.OrderId }).IsUnique(); + + modelBuilder.Entity() + .HasOne(x => x.StudentGroupFrom) + .WithMany(p => p.OrderStudentRecordFroms) + .HasForeignKey(pt => pt.StudentGroupFromId) + .OnDelete(DeleteBehavior.SetNull); + + modelBuilder.Entity() + .HasOne(x => x.StudentGroupTo) + .WithMany(p => p.OrderStudentRecordTos) + .HasForeignKey(pt => pt.StudentGroupToId) + .OnDelete(DeleteBehavior.NoAction); + + // ругается на циклическое каскадное удаление, так что по нормам времени убираем ее + modelBuilder.Entity() + .HasOne(x => x.Student) + .WithMany(x => x.OrderStudentRecords) + .OnDelete(DeleteBehavior.NoAction); + } #region Security @@ -89,6 +118,8 @@ namespace DatabaseCore public virtual DbSet AcademicPlanRecordTimeNormHours { set; get; } public virtual DbSet StudentGroups { set; get; } public virtual DbSet Students { set; get; } + public virtual DbSet Orders { set; get; } + public virtual DbSet OrderStudentRecords { set; get; } #endregion } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210413070716_AddOrders.Designer.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210413070716_AddOrders.Designer.cs new file mode 100644 index 0000000..0336db2 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210413070716_AddOrders.Designer.cs @@ -0,0 +1,1401 @@ +// +using System; +using DatabaseCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +namespace DatabaseCore.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20210413070716_AddOrders")] + partial class AddOrders + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("ProductVersion", "5.0.4") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("DatabaseCore.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("YearEntrance") + .HasColumnType("int"); + + b.Property("YearFinish") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EducationDirectionId", "YearEntrance") + .IsUnique() + .HasFilter("[EducationDirectionId] IS NOT NULL"); + + b.ToTable("AcademicPlans"); + }); + + modelBuilder.Entity("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.Models.Department.Discipline", b => + { + b.Property("Id") + .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("DisciplineBlockId"); + + b.HasIndex("DisciplineName") + .IsUnique(); + + b.ToTable("Disciplines"); + }); + + modelBuilder.Entity("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.Models.Department.Student", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + 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(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("NumberOfBook") + .IsUnique(); + + b.HasIndex("StudentGroupId"); + + b.HasIndex("UserId"); + + b.ToTable("Students"); + }); + + modelBuilder.Entity("DatabaseCore.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("EnrollmentYear") + .HasColumnType("int"); + + b.Property("GroupNumber") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("LecturerId"); + + b.HasIndex("AcademicPlanId", "EnrollmentYear", "GroupNumber") + .IsUnique(); + + b.ToTable("StudentGroups"); + }); + + modelBuilder.Entity("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.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("DatabaseCore.Models.Department.AcademicPlan", b => + { + b.HasOne("DatabaseCore.Models.Department.EducationDirection", "EducationDirection") + .WithMany("AcademicPlans") + .HasForeignKey("EducationDirectionId"); + + b.Navigation("EducationDirection"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.AcademicPlanRecord", b => + { + b.HasOne("DatabaseCore.Models.Department.AcademicPlan", "AcademicPlan") + .WithMany("AcademicPlanRecords") + .HasForeignKey("AcademicPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.Discipline", "Discipline") + .WithMany("AcademicPlanRecords") + .HasForeignKey("DisciplineId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AcademicPlan"); + + b.Navigation("Discipline"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.AcademicPlanRecordTimeNormHour", b => + { + b.HasOne("DatabaseCore.Models.Department.AcademicPlanRecord", "AcademicPlanRecord") + .WithMany("AcademicPlanRecordTimeNormHours") + .HasForeignKey("AcademicPlanRecordId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.TimeNorm", "TimeNorm") + .WithMany("AcademicPlanRecordTimeNormHours") + .HasForeignKey("TimeNormId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("AcademicPlanRecord"); + + b.Navigation("TimeNorm"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Classroom", b => + { + b.HasOne("DatabaseCore.Models.Department.Employee", "Employee") + .WithMany("Classrooms") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Discipline", b => + { + b.HasOne("DatabaseCore.Models.Department.DisciplineBlock", "DisciplineBlock") + .WithMany("Disciplines") + .HasForeignKey("DisciplineBlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineBlock"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.EducationDirection", b => + { + b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer") + .WithMany("EducationDirections") + .HasForeignKey("LecturerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lecturer"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b => + { + b.HasOne("DatabaseCore.Models.Security.User", "User") + .WithMany("Employees") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b => + { + b.HasOne("DatabaseCore.Models.Department.Employee", "Employee") + .WithMany("EmployeePosts") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.Post", "Post") + .WithMany("EmployeePosts") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b => + { + b.HasOne("DatabaseCore.Models.Department.LecturerAcademicDegree", "LecturerAcademicDegree") + .WithMany("Lecturers") + .HasForeignKey("LecturerAcademicDegreeId"); + + b.HasOne("DatabaseCore.Models.Department.LecturerAcademicRank", "LecturerAcademicRank") + .WithMany("Lecturers") + .HasForeignKey("LecturerAcademicRankId"); + + b.HasOne("DatabaseCore.Models.Security.User", "User") + .WithMany("Lecturers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LecturerAcademicDegree"); + + b.Navigation("LecturerAcademicRank"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", b => + { + b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer") + .WithMany("LecturerPosts") + .HasForeignKey("LecturerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.Post", "Post") + .WithMany("LecturerPosts") + .HasForeignKey("PostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Lecturer"); + + b.Navigation("Post"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.OrderStudentRecord", b => + { + b.HasOne("DatabaseCore.Models.Department.Order", "Order") + .WithMany("OrderStudentRecords") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupFrom") + .WithMany("OrderStudentRecordFroms") + .HasForeignKey("StudentGroupFromId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupTo") + .WithMany("OrderStudentRecordTos") + .HasForeignKey("StudentGroupToId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("DatabaseCore.Models.Department.Student", "Student") + .WithMany("OrderStudentRecords") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Order"); + + b.Navigation("Student"); + + b.Navigation("StudentGroupFrom"); + + b.Navigation("StudentGroupTo"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Student", b => + { + b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroup") + .WithMany("Students") + .HasForeignKey("StudentGroupId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Security.User", "User") + .WithMany("Students") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("StudentGroup"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.StudentGroup", b => + { + b.HasOne("DatabaseCore.Models.Department.AcademicPlan", "AcademicPlan") + .WithMany("StudentGroups") + .HasForeignKey("AcademicPlanId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer") + .WithMany("StudentGroups") + .HasForeignKey("LecturerId"); + + b.Navigation("AcademicPlan"); + + b.Navigation("Lecturer"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.TimeNorm", b => + { + b.HasOne("DatabaseCore.Models.Department.DisciplineBlock", "DisciplineBlock") + .WithMany("TimeNorms") + .HasForeignKey("DisciplineBlockId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DisciplineBlock"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Security.Access", b => + { + b.HasOne("DatabaseCore.Models.Security.Role", "Role") + .WithMany("Access") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b => + { + b.HasOne("DatabaseCore.Models.Security.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Security.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.AcademicPlan", b => + { + b.Navigation("AcademicPlanRecords"); + + b.Navigation("StudentGroups"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.AcademicPlanRecord", b => + { + b.Navigation("AcademicPlanRecordTimeNormHours"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Discipline", b => + { + b.Navigation("AcademicPlanRecords"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.DisciplineBlock", b => + { + b.Navigation("Disciplines"); + + b.Navigation("TimeNorms"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.EducationDirection", b => + { + b.Navigation("AcademicPlans"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b => + { + b.Navigation("Classrooms"); + + b.Navigation("EmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b => + { + b.Navigation("EducationDirections"); + + b.Navigation("LecturerPosts"); + + b.Navigation("StudentGroups"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicDegree", b => + { + b.Navigation("Lecturers"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicRank", b => + { + b.Navigation("Lecturers"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Order", b => + { + b.Navigation("OrderStudentRecords"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Post", b => + { + b.Navigation("EmployeePosts"); + + b.Navigation("LecturerPosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Student", b => + { + b.Navigation("OrderStudentRecords"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.StudentGroup", b => + { + b.Navigation("OrderStudentRecordFroms"); + + b.Navigation("OrderStudentRecordTos"); + + b.Navigation("Students"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.TimeNorm", b => + { + b.Navigation("AcademicPlanRecordTimeNormHours"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Security.Role", b => + { + b.Navigation("Access"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("DatabaseCore.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/DatabaseCore/Migrations/20210413070716_AddOrders.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210413070716_AddOrders.cs new file mode 100644 index 0000000..6b21740 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210413070716_AddOrders.cs @@ -0,0 +1,108 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DatabaseCore.Migrations +{ + public partial class AddOrders : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Orders", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + OrderNumber = table.Column(type: "nvarchar(450)", nullable: false), + OrderDate = table.Column(type: "datetime2", nullable: false), + OrderType = table.Column(type: "int", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateDelete = table.Column(type: "datetime2", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Orders", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "OrderStudentRecords", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + OrderId = table.Column(type: "uniqueidentifier", nullable: false), + StudentId = table.Column(type: "uniqueidentifier", nullable: false), + StudentGroupFromId = table.Column(type: "uniqueidentifier", nullable: true), + StudentGroupToId = table.Column(type: "uniqueidentifier", nullable: true), + OrderStudentMoveType = table.Column(type: "int", nullable: false), + Info = 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_OrderStudentRecords", x => x.Id); + table.ForeignKey( + name: "FK_OrderStudentRecords_Orders_OrderId", + column: x => x.OrderId, + principalTable: "Orders", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_OrderStudentRecords_StudentGroups_StudentGroupFromId", + column: x => x.StudentGroupFromId, + principalTable: "StudentGroups", + principalColumn: "Id", + onDelete: ReferentialAction.SetNull); + table.ForeignKey( + name: "FK_OrderStudentRecords_StudentGroups_StudentGroupToId", + column: x => x.StudentGroupToId, + principalTable: "StudentGroups", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + table.ForeignKey( + name: "FK_OrderStudentRecords_Students_StudentId", + column: x => x.StudentId, + principalTable: "Students", + principalColumn: "Id", + onDelete: ReferentialAction.NoAction); + }); + + migrationBuilder.CreateIndex( + name: "IX_Orders_OrderNumber", + table: "Orders", + column: "OrderNumber", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_OrderStudentRecords_OrderId", + table: "OrderStudentRecords", + column: "OrderId"); + + migrationBuilder.CreateIndex( + name: "IX_OrderStudentRecords_StudentGroupFromId", + table: "OrderStudentRecords", + column: "StudentGroupFromId"); + + migrationBuilder.CreateIndex( + name: "IX_OrderStudentRecords_StudentGroupToId", + table: "OrderStudentRecords", + column: "StudentGroupToId"); + + migrationBuilder.CreateIndex( + name: "IX_OrderStudentRecords_StudentId_OrderId", + table: "OrderStudentRecords", + columns: new[] { "StudentId", "OrderId" }, + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "OrderStudentRecords"); + + migrationBuilder.DropTable( + name: "Orders"); + } + } +} diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs index 1d3e264..ff1aeb0 100644 --- a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs @@ -591,6 +591,84 @@ namespace DatabaseCore.Migrations b.ToTable("LecturerPosts"); }); + modelBuilder.Entity("DatabaseCore.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("DatabaseCore.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("DatabaseCore.Models.Department.Post", b => { b.Property("Id") @@ -1102,6 +1180,39 @@ namespace DatabaseCore.Migrations b.Navigation("Post"); }); + modelBuilder.Entity("DatabaseCore.Models.Department.OrderStudentRecord", b => + { + b.HasOne("DatabaseCore.Models.Department.Order", "Order") + .WithMany("OrderStudentRecords") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupFrom") + .WithMany("OrderStudentRecordFroms") + .HasForeignKey("StudentGroupFromId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupTo") + .WithMany("OrderStudentRecordTos") + .HasForeignKey("StudentGroupToId") + .OnDelete(DeleteBehavior.SetNull); + + b.HasOne("DatabaseCore.Models.Department.Student", "Student") + .WithMany("OrderStudentRecords") + .HasForeignKey("StudentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Order"); + + b.Navigation("Student"); + + b.Navigation("StudentGroupFrom"); + + b.Navigation("StudentGroupTo"); + }); + modelBuilder.Entity("DatabaseCore.Models.Department.Student", b => { b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroup") @@ -1234,6 +1345,11 @@ namespace DatabaseCore.Migrations b.Navigation("Lecturers"); }); + modelBuilder.Entity("DatabaseCore.Models.Department.Order", b => + { + b.Navigation("OrderStudentRecords"); + }); + modelBuilder.Entity("DatabaseCore.Models.Department.Post", b => { b.Navigation("EmployeePosts"); @@ -1241,8 +1357,17 @@ namespace DatabaseCore.Migrations b.Navigation("LecturerPosts"); }); + modelBuilder.Entity("DatabaseCore.Models.Department.Student", b => + { + b.Navigation("OrderStudentRecords"); + }); + modelBuilder.Entity("DatabaseCore.Models.Department.StudentGroup", b => { + b.Navigation("OrderStudentRecordFroms"); + + b.Navigation("OrderStudentRecordTos"); + b.Navigation("Students"); }); diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlan.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlan.cs index c497798..321f57d 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlan.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlan.cs @@ -45,5 +45,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public AcademicPlan SecurityCheck(AcademicPlan entity, bool allowFullData) => entity; - } + + public override string ToString() => $"{EducationDirection?.ShortName}({EducationDirection?.Profile}): {YearEntrance}-{YearFinish}"; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecord.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecord.cs index 50086fd..38c167d 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecord.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecord.cs @@ -68,5 +68,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public AcademicPlanRecord SecurityCheck(AcademicPlanRecord entity, bool allowFullData) => entity; + + public override string ToString() => $"{Discipline} - {Semester + 1} семестр"; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecordTimeNormHour.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecordTimeNormHour.cs index c885edc..12c7473 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecordTimeNormHour.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/AcademicPlanRecordTimeNormHour.cs @@ -41,5 +41,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public AcademicPlanRecordTimeNormHour SecurityCheck(AcademicPlanRecordTimeNormHour entity, bool allowFullData) => entity; + + public override string ToString() => $"{AcademicPlanRecord.Discipline}({(AcademicPlanRecord.Semester + 1)}) - {TimeNorm}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs index eb8c2b2..115cdc6 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs @@ -76,5 +76,7 @@ namespace DatabaseCore.Models.Department return entity; } + + public override string ToString() => Number; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Discipline.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Discipline.cs index 7a9b046..caa0e62 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Discipline.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Discipline.cs @@ -49,5 +49,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public Discipline SecurityCheck(Discipline entity, bool allowFullData) => entity; - } + + public override string ToString() => DisciplineName; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/DisciplineBlock.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/DisciplineBlock.cs index 448ff1b..8dd154d 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/DisciplineBlock.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/DisciplineBlock.cs @@ -44,5 +44,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public DisciplineBlock SecurityCheck(DisciplineBlock entity, bool allowFullData) => entity; - } + + public override string ToString() => Title; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/EducationDirection.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/EducationDirection.cs index 9cc1aae..8cdf230 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/EducationDirection.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/EducationDirection.cs @@ -59,5 +59,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public EducationDirection SecurityCheck(EducationDirection entity, bool allowFullData) => entity; - } + + public override string ToString() => $"{Cipher} {ShortName}({Profile})"; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs index 78e45ce..2c5ae2f 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs @@ -1,5 +1,6 @@ using DatabaseCore.Models.Security; using ModuleTools.Attributes; +using ModuleTools.Extensions; using ModuleTools.Interfaces; using System; using System.Collections.Generic; @@ -92,5 +93,8 @@ namespace DatabaseCore.Models.Department return entity; } + + public override string ToString() => + $"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}"; } } diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/EmployeePost.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/EmployeePost.cs index dc3d065..216961d 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/EmployeePost.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/EmployeePost.cs @@ -45,5 +45,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public EmployeePost SecurityCheck(EmployeePost entity, bool allowFullData) => entity; + + public override string ToString() => $"{Post}-{Employee}"; } } diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs index ce3298e..ddbb54b 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs @@ -1,5 +1,6 @@ using DatabaseCore.Models.Security; using ModuleTools.Attributes; +using ModuleTools.Extensions; using ModuleTools.Interfaces; using System; using System.Collections.Generic; @@ -125,5 +126,8 @@ namespace DatabaseCore.Models.Department return entity; } + + public override string ToString() => + $"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs index 726fdf4..e6d98da 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs @@ -37,5 +37,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public LecturerAcademicDegree SecurityCheck(LecturerAcademicDegree entity, bool allowFullData) => entity; + + public override string ToString() => LecturerAcademicDegreeName; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs index beb232a..ac86b3b 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs @@ -33,5 +33,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public LecturerAcademicRank SecurityCheck(LecturerAcademicRank entity, bool allowFullData) => entity; + + public override string ToString() => LecturerAcademicRankName; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs index a41b919..493eb5a 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs @@ -49,5 +49,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public LecturerPost SecurityCheck(LecturerPost entity, bool allowFullData) => entity; + + public override string ToString() => $"{Lecturer}-{Post}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Order.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Order.cs new file mode 100644 index 0000000..a778f43 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Order.cs @@ -0,0 +1,46 @@ +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий приказ + /// + [DataContract] + [EntityDescription("Order", "Приказ")] + public class Order : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderNumber")] + public string OrderNumber { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderDate")] + public DateTime OrderDate { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderType")] + public int OrderType { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + [ForeignKey("OrderId")] + public virtual List OrderStudentRecords { get; set; } + + //------------------------------------------------------------------------- + + public Order SecurityCheck(Order entity, bool allowFullData) => entity; + + public override string ToString() => $"№{OrderNumber} от {OrderDate.ToShortDateString()}"; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/OrderStudentRecord.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/OrderStudentRecord.cs new file mode 100644 index 0000000..47def89 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/OrderStudentRecord.cs @@ -0,0 +1,74 @@ +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий запись приказа по студенту + /// + [DataContract] + [EntityDescription("OrderStudentRecord", "Запись приказа по студенту")] + [EntityDependency("Order", "OrderId", "Приказ, к которому относится запись")] + [EntityDependency("Student", "StudentId", "Студент, указанный в приказе")] + [EntityDependency("StudentGroup", "StudentGroupFromId", "Из какой группы уходит студент")] + [EntityDependency("StudentGroup", "StudentGroupToId", "В какую группу приходит студент")] + public class OrderStudentRecord : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderId")] + public Guid OrderId { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + [MapConfiguration("StudentId")] + public Guid StudentId { get; set; } + + [DataMember] + [MapConfiguration("StudentGroupFromId")] + public Guid? StudentGroupFromId { get; set; } + + [DataMember] + [MapConfiguration("StudentGroupToId")] + public Guid? StudentGroupToId { get; set; } + + [DataMember] + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderStudentMoveType")] + public int OrderStudentMoveType { get; set; } + + [DataMember] + [MapConfiguration("Info")] + public string Info { get; set; } + + //------------------------------------------------------------------------- + + public virtual Order Order { get; set; } + + public virtual Student Student { get; set; } + + public virtual StudentGroup StudentGroupFrom { get; set; } + + public virtual StudentGroup StudentGroupTo { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + public OrderStudentRecord SecurityCheck(OrderStudentRecord entity, bool allowFullData) + { + if (!allowFullData) + { + entity.Info = string.Empty; + entity.OrderStudentMoveType = 0; + } + + return entity; + } + + public override string ToString() => $"{Student} {OrderStudentMoveType}"; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Post.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Post.cs index 5379300..2ea3b32 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Post.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Post.cs @@ -38,5 +38,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public Post SecurityCheck(Post entity, bool allowFullData) => entity; + + public override string ToString() => PostName; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs index 9292dc9..0d9c669 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Student.cs @@ -1,8 +1,11 @@ using DatabaseCore.Models.Security; using ModuleTools.Attributes; +using ModuleTools.Extensions; using ModuleTools.Interfaces; using System; +using System.Collections.Generic; using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Runtime.Serialization; namespace DatabaseCore.Models.Department @@ -74,6 +77,9 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- + [ForeignKey("StudentId")] + public virtual List OrderStudentRecords { get; set; } + //------------------------------------------------------------------------- public Student SecurityCheck(Student entity, bool allowFullData) @@ -87,5 +93,8 @@ namespace DatabaseCore.Models.Department return entity; } + + public override string ToString() => + $"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs index a07e718..6ae6c57 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/StudentGroup.cs @@ -47,8 +47,16 @@ namespace DatabaseCore.Models.Department [ForeignKey("StudentGroupId")] public virtual List Students { get; set; } + [ForeignKey("StudentGroupFromId")] + public virtual List OrderStudentRecordFroms { get; set; } + + [ForeignKey("StudentGroupToId")] + public virtual List OrderStudentRecordTos { get; set; } + //------------------------------------------------------------------------- public StudentGroup SecurityCheck(StudentGroup entity, bool allowFullData) => entity; + + public override string ToString() => $"{AcademicPlan.EducationDirection.ShortName}({EnrollmentYear})-{GroupNumber}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/TimeNorm.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/TimeNorm.cs index 978a1e0..10a36aa 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/TimeNorm.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/TimeNorm.cs @@ -81,5 +81,7 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- public TimeNorm SecurityCheck(TimeNorm entity, bool allowFullData) => entity; + + public override string ToString() => TimeNormName; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs index a767817..58c1ba2 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Access.cs @@ -45,6 +45,8 @@ namespace DatabaseCore.Models.Security entity.AccessType = AccessType.View; } return entity; - } - } + } + + public override string ToString() => $"{Role.RoleName}-{AccessOperation.ToString("G")}({AccessType.ToString("G")})"; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs index de9a9e6..9bc83a9 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/EnviromentSetting.cs @@ -40,5 +40,7 @@ namespace DatabaseCore.Models.Security } return entity; } + + public override string ToString() => Key; } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs index 46b54db..91080e2 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/Role.cs @@ -37,5 +37,7 @@ namespace DatabaseCore.Models.Security public Role SecurityCheck(Role entity, bool allowFullData) => entity; + public override string ToString() => RoleName; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs index e0e6bf3..b201fa5 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs @@ -78,5 +78,7 @@ namespace DatabaseCore.Models.Security return entity; } - } + + public override string ToString() => UserName; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs b/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs index 167b8e3..8b6af97 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/UserRole.cs @@ -33,5 +33,7 @@ namespace DatabaseCore.Models.Security //------------------------------------------------------------------------- public UserRole SecurityCheck(UserRole entity, bool allowFullData) => entity; - } + + public override string ToString() => $"{Role.RoleName}-{User.UserName}"; + } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs b/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs index 6ad3dd2..f1e50f1 100644 --- a/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs +++ b/DepartmentPortal/Common/ModuleTools/BusinessLogics/Mapper.cs @@ -64,6 +64,11 @@ namespace ModuleTools.BusinessLogics var props = customAttribute.PropertyNameFromModel.Split('.'); foreach (var prop in props) { + if(prop == "ToString") + { + value = value.ToString(); + break; + } var bindingProperty = value.GetType().GetProperty(prop); if (bindingProperty != null) { @@ -82,6 +87,10 @@ namespace ModuleTools.BusinessLogics } else { + if (customAttribute.PropertyNameFromModel == "ToString") + { + value = value.ToString(); + } var bindingProperty = typeFrom.GetProperty(customAttribute.PropertyNameFromModel); if (bindingProperty != null) { diff --git a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs index 8d05f1a..e680168 100644 --- a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs +++ b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs @@ -46,7 +46,7 @@ Студенты = 110, - Приказы_студентов = 107, + Приказы = 111, #endregion // Меню Учебный процесс diff --git a/DepartmentPortal/Common/ModuleTools/ViewModels/ElementViewModel.cs b/DepartmentPortal/Common/ModuleTools/ViewModels/ElementViewModel.cs index 76ca9b1..620f6cf 100644 --- a/DepartmentPortal/Common/ModuleTools/ViewModels/ElementViewModel.cs +++ b/DepartmentPortal/Common/ModuleTools/ViewModels/ElementViewModel.cs @@ -11,5 +11,10 @@ namespace ModuleTools.ViewModels [ViewModelControlListProperty("Идентификатор", IsHide = true)] [MapConfiguration("Id")] public Guid Id { get; set; } + + [MapConfiguration("ToString")] + public string ElementViewString { get; set; } + + public override string ToString() => ElementViewString; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderBindingModels.cs new file mode 100644 index 0000000..a0b0515 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderBindingModels.cs @@ -0,0 +1,33 @@ +using DepartmentBusinessLogic.Enums; +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение приказа + /// + public class OrderGetBindingModel : GetBindingModel + { + } + + /// + /// Сохранение приказа + /// + public class OrderSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderNumber")] + public string OrderNumber { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderDate")] + public DateTime OrderDate { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderType")] + public OrderType OrderType { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderStudentRecordBindingModel.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderStudentRecordBindingModel.cs new file mode 100644 index 0000000..c346e69 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/OrderStudentRecordBindingModel.cs @@ -0,0 +1,47 @@ +using DepartmentBusinessLogic.Enums; +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение записи приказа по студенту + /// + public class OrderStudentRecordGetBindingModel : GetBindingModel + { + public Guid? OrderId { get; set; } + + public Guid? StudentId { get; set; } + + public Guid? StudentGroupId { get; set; } + } + + /// + /// Сохранение записи приказа по студенту + /// + public class OrderStudentRecordSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderId")] + public Guid OrderId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("StudentId")] + public Guid StudentId { get; set; } + + [MapConfiguration("StudentGroupFromId")] + public Guid? StudentGroupFromId { get; set; } + + [MapConfiguration("StudentGroupToId")] + public Guid? StudentGroupToId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("OrderStudentMoveType")] + public OrderStudentMoveType OrderStudentMoveType { get; set; } + + [MapConfiguration("Info")] + public string Info { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderBusinessLogic.cs new file mode 100644 index 0000000..33d0d49 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderBusinessLogic.cs @@ -0,0 +1,16 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.Interfaces; +using DepartmentBusinessLogic.ViewModels; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; + +namespace DepartmentBusinessLogic.BusinessLogics +{ + /// + /// Логика работы с приказами + /// + public class OrderBusinessLogic : GenericBusinessLogic + { + public OrderBusinessLogic(IOrderService service) : base(service, "Приказы", AccessOperation.Приказы) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs new file mode 100644 index 0000000..9626151 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/OrderStudentRecordBusinessLogic.cs @@ -0,0 +1,16 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.Interfaces; +using DepartmentBusinessLogic.ViewModels; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; + +namespace DepartmentBusinessLogic.BusinessLogics +{ + /// + /// Логика работы с записями приказов + /// + public class OrderStudentRecordBusinessLogic : GenericBusinessLogic + { + public OrderStudentRecordBusinessLogic(IOrderStudentRecordService service) : base(service, "Приказы", AccessOperation.Приказы) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderStudentMoveType.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderStudentMoveType.cs new file mode 100644 index 0000000..678b3b2 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderStudentMoveType.cs @@ -0,0 +1,38 @@ +namespace DepartmentBusinessLogic.Enums +{ + /// + /// Типы приказов по студентам + /// + public enum OrderStudentMoveType + { + Зачисление = 0, + + Распределение = 1, + + ПереводНаКурс = 3, + + ПереводВГруппу = 4, + + Движение = 2, + + ИзАкадема = 5, + + ВАкадем = 6, + + ПродлАкадем = 13, + + ОтчислитьЗаНеуспевамость = 7, + + ОтчислитьВСвязиСПереводом = 8, + + ОтчислитьПоСобственному = 9, + + ЗачислитьПоПереводу = 10, + + Восстановить = 11, + + ОтчислитьПоЗавершению = 12, + + ОтчислитьЗаНевыходСАкадема = 14 + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderType.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderType.cs new file mode 100644 index 0000000..01d2fe6 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/OrderType.cs @@ -0,0 +1,14 @@ +namespace DepartmentBusinessLogic.Enums +{ + /// + /// Тип приказа + /// + public enum OrderType + { + ЗачислениеСтудентов = 0, + + РаспределениеСтудентов = 1, + + ДвижениеСтудентов = 2, + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderService.cs new file mode 100644 index 0000000..4cffbdd --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение приказов + /// + public interface IOrderService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderStudentRecordService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderStudentRecordService.cs new file mode 100644 index 0000000..6cccad1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IOrderStudentRecordService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение записей приказов по студентам + /// + public interface IOrderStudentRecordService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordTimeNormHourViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordTimeNormHourViewModels.cs index 8a11ebd..94f6fe0 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordTimeNormHourViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordTimeNormHourViewModels.cs @@ -22,7 +22,7 @@ namespace DepartmentBusinessLogic.ViewModels public Guid AcademicPlanRecordId { get; set; } [ViewModelControlListProperty("Дисциплина")] - [MapConfiguration("AcademicPlanRecord.Discipline.DisciplineName", IsDifficle = true)] + [MapConfiguration("AcademicPlanRecord.Discipline.ToString", IsDifficle = true)] public string DisciplineName { get; set; } [MapConfiguration("AcademicPlanRecord.Semester", IsDifficle = true)] @@ -36,7 +36,7 @@ namespace DepartmentBusinessLogic.ViewModels public Guid TimeNormId { get; set; } [ViewModelControlListProperty("Норма времени")] - [MapConfiguration("TimeNorm.TimeNormName", IsDifficle = true)] + [MapConfiguration("TimeNorm.ToString", IsDifficle = true)] public string TimeNormName { get; set; } [ViewModelControlListProperty("Часы", ColumnWidth = 80)] diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordViewModels.cs index 877820b..f0e2ea4 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanRecordViewModels.cs @@ -28,7 +28,7 @@ namespace DepartmentBusinessLogic.ViewModels public Guid DisciplineId { get; set; } [ViewModelControlListProperty("Дисциплина")] - [MapConfiguration("Discipline.DisciplineName", IsDifficle = true)] + [MapConfiguration("Discipline.ToString", IsDifficle = true)] public string DisciplineName { get; set; } [ViewModelControlElementProperty("Преподается на кафедре", ControlType.ControlBool, MustHaveValue = true)] diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanViewModels.cs index b1a7b39..e9464c5 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/AcademicPlanViewModels.cs @@ -41,7 +41,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Дата окончания", ControlType.ControlInt, MustHaveValue = true)] [MapConfiguration("YearFinish")] public int YearFinish { get; set; } - - public override string ToString() =>$"{EducationDirectionCipher}: {YearEntrance}-{YearFinish}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs index b07038f..7def279 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs @@ -71,7 +71,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] [MapConfiguration("Photo")] public byte[] Photo { get; set; } - - public override string ToString() => Number; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineBlockViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineBlockViewModels.cs index 7df2f70..ccfaf69 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineBlockViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineBlockViewModels.cs @@ -36,7 +36,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Назв. в планах", ControlType.ControlString)] [MapConfiguration("DisciplineBlockBlueAsteriskName")] public string DisciplineBlockBlueAsteriskName { get; set; } - - public override string ToString() => Title; } } diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineViewModels.cs index 502e72c..3e769ad 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/DisciplineViewModels.cs @@ -40,7 +40,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Название в планах", ControlType.ControlString)] [MapConfiguration("DisciplineBlueAsteriskName")] public string DisciplineBlueAsteriskName { get; set; } - - public override string ToString() => DisciplineName; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EducationDirectionViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EducationDirectionViewModels.cs index dc0ca17..34002b3 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EducationDirectionViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EducationDirectionViewModels.cs @@ -58,7 +58,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Описание", ControlType.ControlText, Height = 80)] [MapConfiguration("Description")] public string Description { get; set; } - - public override string ToString() => $"{Cipher} {ShortName}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs index a028770..e0cafd9 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs @@ -21,7 +21,7 @@ namespace DepartmentBusinessLogic.ViewModels public Guid EmployeeId { get; set; } [ViewModelControlListProperty("Сотрудник")] - [MapConfiguration("Employee.LastName", IsDifficle = true)] + [MapConfiguration("Employee.ToString", IsDifficle = true)] public string EmployeeName { get; set; } [ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlPostList, DepartmentWindowsDesktop")] @@ -29,7 +29,7 @@ namespace DepartmentBusinessLogic.ViewModels public Guid PostId { get; set; } [ViewModelControlListProperty("Должность")] - [MapConfiguration("Post.PostName", IsDifficle = true)] + [MapConfiguration("Post.ToString", IsDifficle = true)] public string PostName { get; set; } [ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")] @@ -50,7 +50,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlListProperty("Внеш. совм.", ColumnWidth = 80)] public string ExternalCombination => IsExternalCombination ? "Да" : "Нет"; - - public override string ToString() => $"{EmployeeName}-{PostName}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs index d69b1b7..ea98cb8 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs @@ -1,6 +1,5 @@ using ModuleTools.Attributes; using ModuleTools.Enums; -using ModuleTools.Extensions; using ModuleTools.ViewModels; using System; @@ -77,8 +76,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Группа эл.безоп", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("GroupElectricalSafety")] public string GroupElectricalSafety { get; set; } - - public override string ToString() => - $"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs index 327d126..4609e1f 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs @@ -31,7 +31,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)] [MapConfiguration("Order")] public int Order { get; set; } - - public override string ToString() => LecturerAcademicDegreeName; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicRankViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicRankViewModels.cs index aa8f46c..37d90ff 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicRankViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicRankViewModels.cs @@ -26,7 +26,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)] [MapConfiguration("Order")] public int Order { get; set; } - - public override string ToString() => LecturerAcademicRankName; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs index c9d3eb6..e88e963 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs @@ -21,7 +21,7 @@ namespace DepartmentBusinessLogic.ViewModels public Guid LecturerId { get; set; } [ViewModelControlListProperty("Преподаватель")] - [MapConfiguration("Lecturer.LastName", IsDifficle = true)] + [MapConfiguration("Lecturer.ToString", IsDifficle = true)] public string LecturerName { get; set; } [ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlPostList, DepartmentWindowsDesktop")] @@ -29,7 +29,7 @@ namespace DepartmentBusinessLogic.ViewModels public Guid PostId { get; set; } [ViewModelControlListProperty("Должность")] - [MapConfiguration("Post.PostName", IsDifficle = true)] + [MapConfiguration("Post.ToString", IsDifficle = true)] public string PostName { get; set; } [ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")] @@ -50,7 +50,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlListProperty("Внеш. совм.", ColumnWidth = 80)] public string ExternalCombination => IsExternalCombination ? "Да" : "Нет"; - - public override string ToString() => $"{LecturerName}-{PostName}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs index 42053cc..3e76831 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs @@ -1,6 +1,5 @@ using ModuleTools.Attributes; using ModuleTools.Enums; -using ModuleTools.Extensions; using ModuleTools.ViewModels; using System; @@ -103,8 +102,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Группа эл.безоп", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("GroupElectricalSafety")] public string GroupElectricalSafety { get; set; } - - public override string ToString() => - $"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderStudentRecordViewModel.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderStudentRecordViewModel.cs new file mode 100644 index 0000000..f58f2da --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderStudentRecordViewModel.cs @@ -0,0 +1,45 @@ +using DepartmentBusinessLogic.Enums; +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; +using System; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список приказов + /// + public class OrderStudentRecordListViewModel : ListViewModel { } + + /// + /// Элемент приказа + /// + [ViewModelControlElementClass(HaveDependenceEntities = false)] + public class OrderStudentRecordViewModel : ElementViewModel + { + [ViewModelControlElementProperty("Приказ", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderList, DepartmentWindowsDesktop")] + [MapConfiguration("OrderId")] + public Guid OrderId { get; set; } + + [ViewModelControlElementProperty("Студент", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")] + [MapConfiguration("StudentId")] + public Guid StudentId { get; set; } + + [ViewModelControlElementProperty("Из группы", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")] + [MapConfiguration("StudentGroupFromId")] + public Guid StudentGroupFromId { get; set; } + + [ViewModelControlElementProperty("В группу", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")] + [MapConfiguration("StudentGroupToId")] + public Guid StudentGroupToId { get; set; } + + [ViewModelControlElementProperty("Тип приказа", ControlType.ControlEnum, MustHaveValue = true)] + [MapConfiguration("OrderStudentMoveType")] + public OrderStudentMoveType OrderStudentMoveType { get; set; } + + [ViewModelControlListProperty("Тип приказа")] + public string OrderStudentMoveTypeTitle => OrderStudentMoveType.ToString("G"); + + public override string ToString() => $""; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderViewModels.cs new file mode 100644 index 0000000..a5ad50a --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/OrderViewModels.cs @@ -0,0 +1,39 @@ +using DepartmentBusinessLogic.Enums; +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; +using System; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список приказов + /// + public class OrderListViewModel : ListViewModel { } + + /// + /// Элемент приказа + /// + [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] + [ViewModelControlElementDependenceEntity(Title = "Записи по студентам", Order = 1, ParentPropertyName = "AcademicPlanId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")] + public class OrderViewModel : ElementViewModel + { + [ViewModelControlListProperty("Номер приказа", ColumnWidth = 120)] + [ViewModelControlElementProperty("Номер приказа", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("OrderNumber")] + public string OrderNumber { get; set; } + + [ViewModelControlListProperty("Дата приказа", ColumnWidth = 120, DefaultCellStyleFormat = "dd.MM.yyyy")] + [ViewModelControlElementProperty("Дата приказа", ControlType.ControlInt, MustHaveValue = true)] + [MapConfiguration("OrderDate")] + public DateTime OrderDate { get; set; } + + [ViewModelControlElementProperty("Тип приказа", ControlType.ControlEnum, MustHaveValue = true)] + [MapConfiguration("OrderType")] + public OrderType OrderType { get; set; } + + [ViewModelControlListProperty("Тип приказа")] + public string OrderTypeTitle => OrderType.ToString("G"); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/PostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/PostViewModels.cs index acf908a..b55d6e3 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/PostViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/PostViewModels.cs @@ -35,7 +35,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)] [MapConfiguration("Order")] public int Order { get; set; } - - public override string ToString() => PostName; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs index e4ef440..e0efc90 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentGroupViewModels.cs @@ -1,6 +1,5 @@ using ModuleTools.Attributes; using ModuleTools.Enums; -using ModuleTools.Extensions; using ModuleTools.ViewModels; using System; @@ -17,6 +16,8 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] [ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 1, ParentPropertyName = "StudentGroupId", ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")] + [ViewModelControlElementDependenceEntity(Title = "Приказы", Order = 1, ParentPropertyName = "StudentGroupId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")] public class StudentGroupViewModel : ElementViewModel { [ViewModelControlElementProperty("Учебный план", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanList, DepartmentWindowsDesktop")] @@ -51,18 +52,8 @@ namespace DepartmentBusinessLogic.ViewModels [MapConfiguration("LecturerId")] public Guid? CuratorId { get; set; } - [MapConfiguration("Lecturer.LastName", IsDifficle = true)] - public string LecturerLastName { get; set; } - - [MapConfiguration("Lecturer.FirstName", IsDifficle = true)] - public string LecturerFirstName { get; set; } - - [MapConfiguration("Lecturer.Patronymic", IsDifficle = true)] - public string LecturerPatronymic { get; set; } - [ViewModelControlListProperty("Куратор")] - public string Lecturer => $"{LecturerLastName}{(LecturerFirstName.IsNotEmpty() ? $" {LecturerFirstName[0]}." : string.Empty)}{(LecturerPatronymic.IsNotEmpty() ? $"{LecturerPatronymic[0]}." : string.Empty)}"; - - public override string ToString() => GroupName; + [MapConfiguration("Lecturer.ToString", IsDifficle = true)] + public string Lecturer { get; set; } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs index fe1e43d..39d9807 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/StudentViewModels.cs @@ -1,7 +1,6 @@ using DepartmentBusinessLogic.Enums; using ModuleTools.Attributes; using ModuleTools.Enums; -using ModuleTools.Extensions; using ModuleTools.ViewModels; using System; @@ -16,8 +15,8 @@ namespace DepartmentBusinessLogic.ViewModels /// Элемент студент /// [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] - //[ViewModelControlElementDependenceEntity(Title = "Записи учебного плана", Order = 1, ParentPropertyName = "DisciplineId", - // ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanRecordList, DepartmentWindowsDesktop")] + [ViewModelControlElementDependenceEntity(Title = "Приказы по студенту", Order = 1, ParentPropertyName = "StudentId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")] public class StudentViewModel : ElementViewModel { [ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")] @@ -71,8 +70,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Староста", ControlType.ControlBool, MustHaveValue = true)] [MapConfiguration("IsSteward")] public bool IsSteward { get; set; } - - public override string ToString() => - $"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/TimeNormViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/TimeNormViewModels.cs index d88ea00..46ba693 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/TimeNormViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/TimeNormViewModels.cs @@ -73,7 +73,5 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementProperty("Выводить для сайта", ControlType.ControlBool, MustHaveValue = true)] [MapConfiguration("UseInSite")] public bool UseInSite { get; set; } - - public override string ToString() => TimeNormName; } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs index 9c6daf5..4dd2558 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs @@ -35,6 +35,9 @@ namespace DepartmentDatabaseImplementation DependencyManager.Instance.RegisterType(); DependencyManager.Instance.RegisterType(); + + DependencyManager.Instance.RegisterType(); + DependencyManager.Instance.RegisterType(); } } } \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderService.cs new file mode 100644 index 0000000..65424e5 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderService.cs @@ -0,0 +1,44 @@ +using DatabaseCore; +using DatabaseCore.Models.Department; +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.Interfaces; +using DepartmentBusinessLogic.ViewModels; +using Microsoft.EntityFrameworkCore; +using ModuleTools.Enums; +using ModuleTools.Models; +using System.Linq; + +namespace DepartmentDatabaseImplementation.Implementations +{ + /// + /// Реализация IOrderService + /// + public class OrderService : + AbstractGenerticEntityService, + IOrderService + { + protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, OrderSetBindingModel model) => OperationResultModel.Success(null); + + protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, Order entity, OrderGetBindingModel model) + { + if (context.Set().Any(x => x.OrderId == model.Id && !x.IsDeleted)) + { + return OperationResultModel.Error("Error:", "Есть записи приказа по студентам, относящиеся к этому приказу", ResultServiceStatusCode.ExsistItem); + } + return OperationResultModel.Success(null); + } + + protected override IQueryable AdditionalCheckingWhenReadingList(IQueryable query, OrderGetBindingModel model) => query; + + protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, OrderSetBindingModel model) => OperationResultModel.Success(null); + + protected override void AdditionalDeleting(DbContext context, Order entity, OrderGetBindingModel model) { } + + protected override Order GetUniqueEntity(OrderSetBindingModel model, DbContext context) => context.Set().FirstOrDefault(x => x.OrderNumber == model.OrderNumber && x.Id != model.Id); + + protected override IQueryable IncludingWhenReading(IQueryable query) => query; + + protected override IQueryable OrderingWhenReading(IQueryable query) => query.OrderBy(x => x.OrderDate).ThenBy(x => x.OrderNumber); + + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderStudentRecordService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderStudentRecordService.cs new file mode 100644 index 0000000..06e5697 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/OrderStudentRecordService.cs @@ -0,0 +1,50 @@ +using DatabaseCore; +using DatabaseCore.Models.Department; +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.Interfaces; +using DepartmentBusinessLogic.ViewModels; +using Microsoft.EntityFrameworkCore; +using ModuleTools.Models; +using System.Linq; + +namespace DepartmentDatabaseImplementation.Implementations +{ + /// + /// Реализация IOrderStudentRecordService + /// + public class OrderStudentRecordService : + AbstractGenerticEntityService, + IOrderStudentRecordService + { + protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, OrderStudentRecordSetBindingModel model) => OperationResultModel.Success(null); + + protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, OrderStudentRecord entity, OrderStudentRecordGetBindingModel model) => OperationResultModel.Success(null); + + protected override IQueryable AdditionalCheckingWhenReadingList(IQueryable query, OrderStudentRecordGetBindingModel model) + { + if (model.OrderId.HasValue) + { + query = query.Where(x => x.OrderId == model.OrderId.Value); + } + if (model.StudentId.HasValue) + { + query = query.Where(x => x.StudentId == model.StudentId.Value); + } + if (model.StudentGroupId.HasValue) + { + query = query.Where(x => x.StudentGroupFromId == model.StudentGroupId.Value || x.StudentGroupToId == model.StudentGroupId.Value); + } + return query; + } + + protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, OrderStudentRecordSetBindingModel model) => OperationResultModel.Success(null); + + protected override void AdditionalDeleting(DbContext context, OrderStudentRecord entity, OrderStudentRecordGetBindingModel model) { } + + protected override OrderStudentRecord GetUniqueEntity(OrderStudentRecordSetBindingModel model, DbContext context) => context.Set().FirstOrDefault(x => x.StudentId == model.StudentId && x.OrderId == model.OrderId && x.Id != model.Id); + + protected override IQueryable IncludingWhenReading(IQueryable query) => query.Include(x => x.Order).Include(x => x.Student).Include(x => x.StudentGroupFrom).Include(x => x.StudentGroupTo); + + protected override IQueryable OrderingWhenReading(IQueryable query) => query.OrderBy(x => x.Order.OrderDate).ThenBy(x => x.Order.OrderNumber).ThenBy(x => x.OrderStudentMoveType).ThenBy(x => x.Student.LastName).ThenBy(x => x.Student.FirstName); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs index 23914e9..6d700e2 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentGroupService.cs @@ -6,6 +6,7 @@ using DepartmentBusinessLogic.ViewModels; using Microsoft.EntityFrameworkCore; using ModuleTools.Enums; using ModuleTools.Models; +using System; using System.Linq; namespace DepartmentDatabaseImplementation.Implementations @@ -43,7 +44,16 @@ namespace DepartmentDatabaseImplementation.Implementations protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, StudentGroupSetBindingModel model) => OperationResultModel.Success(null); - protected override void AdditionalDeleting(DbContext context, StudentGroup entity, StudentGroupGetBindingModel model) { } + protected override void AdditionalDeleting(DbContext context, StudentGroup entity, StudentGroupGetBindingModel model) + { + var orders = context.Set().Where(x => x.StudentGroupFromId == model.Id || x.StudentGroupToId == model.Id); + foreach (var o in orders) + { + o.IsDeleted = true; + o.DateDelete = DateTime.Now; + } + context.SaveChanges(); + } protected override StudentGroup GetUniqueEntity(StudentGroupSetBindingModel model, DbContext context) => context.Set().FirstOrDefault(x => x.AcademicPlanId == model.AcademicPlanId && x.EnrollmentYear == model.EnrollmentYear && x.GroupNumber == model.GroupNumber && x.Id != model.Id); diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs index 8ae889a..869a303 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/StudentService.cs @@ -5,6 +5,7 @@ using DepartmentBusinessLogic.Interfaces; using DepartmentBusinessLogic.ViewModels; using Microsoft.EntityFrameworkCore; using ModuleTools.Models; +using System; using System.Linq; namespace DepartmentDatabaseImplementation.Implementations @@ -39,7 +40,16 @@ namespace DepartmentDatabaseImplementation.Implementations protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, StudentSetBindingModel model) => OperationResultModel.Success(null); - protected override void AdditionalDeleting(DbContext context, Student entity, StudentGetBindingModel model) { } + protected override void AdditionalDeleting(DbContext context, Student entity, StudentGetBindingModel model) + { + var orders = context.Set().Where(x => x.StudentId == model.Id); + foreach (var o in orders) + { + o.IsDeleted = true; + o.DateDelete = DateTime.Now; + } + context.SaveChanges(); + } protected override Student GetUniqueEntity(StudentSetBindingModel model, DbContext context) => context.Set().FirstOrDefault(x => x.NumberOfBook == model.NumberOfBook && x.Id != model.Id); diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs index 6e9cbb1..50d21bd 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs @@ -44,7 +44,8 @@ namespace DepartmentWindowsDesktop new ControlTimeNormList(), new ControlAcademicPlanList(), new ControlStudentGroupList(), - new ControlStudentList() + new ControlStudentList(), + new ControlOrderList() }; foreach (var cntrl in _controls) diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Discipline/ControlDisciplineList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Discipline/ControlDisciplineList.cs index 94a18ac..ea9f066 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Discipline/ControlDisciplineList.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Discipline/ControlDisciplineList.cs @@ -12,6 +12,9 @@ using System.Linq; namespace DepartmentWindowsDesktop.EntityControls { + /// + /// Реализация контрола для списка дисциплин + /// public partial class ControlDisciplineList : GenericControlEntityList, IGenericControlEntityList diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.Designer.cs new file mode 100644 index 0000000..942109c --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlOrderElement + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + 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/Order/ControlOrderElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.cs new file mode 100644 index 0000000..1119a39 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.cs @@ -0,0 +1,30 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.BusinessLogics; +using DepartmentBusinessLogic.ViewModels; +using DesktopTools.Controls; +using DesktopTools.Interfaces; +using DesktopTools.Models; +using System; + +namespace DepartmentWindowsDesktop.EntityControls +{ + /// + /// Реализация контрола для приказа + /// + public partial class ControlOrderElement : + GenericControlEntityElement, + IGenericControlEntityElement + { + public ControlOrderElement() + { + InitializeComponent(); + Title = "Приказ"; + ControlId = new Guid("f4637ef8-b1f4-4980-b0ef-776496e2a5dc"); + _genericControlViewEntityElement = this; + } + + public IControl GetInstanceGenericControl() => new ControlOrderElement() { ControlId = Guid.NewGuid() }; + + public ControlViewEntityElementConfiguration GetConfigControl() => new(); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderElement.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/Order/ControlOrderList.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.Designer.cs new file mode 100644 index 0000000..3a419be --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlOrderList + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + 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/Order/ControlOrderList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.cs new file mode 100644 index 0000000..16da37d --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.cs @@ -0,0 +1,36 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.BusinessLogics; +using DepartmentBusinessLogic.ViewModels; +using DesktopTools.Controls; +using DesktopTools.Interfaces; +using DesktopTools.Models; +using ModuleTools.Enums; +using System; + +namespace DepartmentWindowsDesktop.EntityControls +{ + /// + /// Реализация контрола для списка приказов + /// + public partial class ControlOrderList : + GenericControlEntityList, + IGenericControlEntityList + { + public ControlOrderList() + { + InitializeComponent(); + Title = "Приказы"; + ControlId = new Guid("a3ba1b6e-934b-4d91-aa9a-3bcd80a929ba"); + AccessOperation = AccessOperation.Приказы; + ControlViewEntityElement = new ControlOrderElement(); + _genericControlViewEntityList = this; + } + + public IControl GetInstanceGenericControl() => new ControlOrderList() { ControlId = Guid.NewGuid() }; + + public ControlViewEntityListConfiguration GetConfigControl() => new() + { + PaginationOn = false + }; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Order/ControlOrderList.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/OrderStudentRecord/ControlOrderStudentRecordElement.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.Designer.cs new file mode 100644 index 0000000..7ea4e69 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlOrderStudentRecordElement + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + 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/OrderStudentRecord/ControlOrderStudentRecordElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.cs new file mode 100644 index 0000000..0c35d0a --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.cs @@ -0,0 +1,30 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.BusinessLogics; +using DepartmentBusinessLogic.ViewModels; +using DesktopTools.Controls; +using DesktopTools.Interfaces; +using DesktopTools.Models; +using System; + +namespace DepartmentWindowsDesktop.EntityControls +{ + /// + /// Реализация контрола для записи приказа по студентам + /// + public partial class ControlOrderStudentRecordElement : + GenericControlEntityElement, + IGenericControlEntityElement + { + public ControlOrderStudentRecordElement() + { + InitializeComponent(); + Title = "Запись приказа по студенту"; + ControlId = new Guid("6c3ffd3d-2c3e-426b-81f6-235129eceb3b"); + _genericControlViewEntityElement = this; + } + + public IControl GetInstanceGenericControl() => new ControlOrderStudentRecordElement() { ControlId = Guid.NewGuid() }; + + public ControlViewEntityElementConfiguration GetConfigControl() => new(); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordElement.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/OrderStudentRecord/ControlOrderStudentRecordList.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.Designer.cs new file mode 100644 index 0000000..3ad7ee0 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.Designer.cs @@ -0,0 +1,38 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlOrderStudentRecordList + { + /// + /// Обязательная переменная конструктора. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + 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/OrderStudentRecord/ControlOrderStudentRecordList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.cs new file mode 100644 index 0000000..d2dd19e --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.cs @@ -0,0 +1,36 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.BusinessLogics; +using DepartmentBusinessLogic.ViewModels; +using DesktopTools.Controls; +using DesktopTools.Interfaces; +using DesktopTools.Models; +using ModuleTools.Enums; +using System; + +namespace DepartmentWindowsDesktop.EntityControls +{ + /// + /// Реализация контрола для списка записей приказов по студентам + /// + public partial class ControlOrderStudentRecordList : + GenericControlEntityList, + IGenericControlEntityList + { + public ControlOrderStudentRecordList() + { + InitializeComponent(); + Title = "Приказы"; + ControlId = new Guid("1aa8cf1f-96b0-47aa-bd20-d1563d840534"); + AccessOperation = AccessOperation.Приказы; + ControlViewEntityElement = new ControlOrderElement(); + _genericControlViewEntityList = this; + } + + public IControl GetInstanceGenericControl() => new ControlOrderStudentRecordList() { ControlId = Guid.NewGuid() }; + + public ControlViewEntityListConfiguration GetConfigControl() => new() + { + PaginationOn = false + }; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/OrderStudentRecord/ControlOrderStudentRecordList.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/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs index 084367b..0d81f68 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/AccessViewModels.cs @@ -21,7 +21,7 @@ namespace SecurityBusinessLogic.ViewModels public Guid RoleId { get; set; } [ViewModelControlListProperty("Роль", ColumnWidth = 100)] - [MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)] + [MapConfiguration("Role.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)] public string RoleName { get; set; } [ViewModelControlElementProperty("Операция", ControlType.ControlEnum, MustHaveValue = true)] @@ -43,7 +43,5 @@ namespace SecurityBusinessLogic.ViewModels AccessType.View => "Просмотр", _ => "Неопределено", }; - - public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})"; } } diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs index 7c3267d..61667ce 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/EnviromentSettingViewModels.cs @@ -29,7 +29,5 @@ namespace SecurityBusinessLogic.ViewModels [ViewModelControlElementProperty("Описание", ControlType.ControlText, Height = 200)] [MapConfiguration("Description", AllowCopyWithoutRigth = false)] public string Description { get; set; } - - public override string ToString() => Key; } } \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs index df21b2b..3a93125 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/RoleViewModels.cs @@ -28,7 +28,5 @@ namespace SecurityBusinessLogic.ViewModels [ViewModelControlElementProperty("Приоритет", ControlType.ControlInt, MustHaveValue = true)] [MapConfiguration("RolePriority")] public int RolePriority { get; set; } - - public override string ToString() => RoleName; } } \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs index c7fbd51..e474bd8 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserRoleViewModels.cs @@ -21,7 +21,7 @@ namespace SecurityBusinessLogic.ViewModels public Guid UserId { get; set; } [ViewModelControlListProperty("Пользователь")] - [MapConfiguration("User.UserName", IsDifficle = true, AllowCopyWithoutRigth = false)] + [MapConfiguration("User.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)] public string UserName { get; set; } [ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")] @@ -29,9 +29,7 @@ namespace SecurityBusinessLogic.ViewModels public Guid RoleId { get; set; } [ViewModelControlListProperty("Роль")] - [MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)] + [MapConfiguration("Role.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)] public string RoleName { get; set; } - - public override string ToString() => $"{RoleName}-{UserName}"; } } \ No newline at end of file diff --git a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs index 1077e6f..803e232 100644 --- a/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs +++ b/DepartmentPortal/Security/SecurityBusinessLogic/ViewModels/UserViewModels.cs @@ -51,8 +51,5 @@ namespace SecurityBusinessLogic.ViewModels [ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt, ReadOnly = true)] [MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)] public int CountAttempt { get; set; } - - public override string ToString() => Login; - } } \ No newline at end of file