From 054ad3174496fa1438a486093773658613c32f26 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Sat, 3 Apr 2021 22:04:11 +0400 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B5=D0=BF=D0=BE=D0=B4=D0=B0?= =?UTF-8?q?=D0=B2=D0=B0=D1=82=D0=B5=D0=BB=D0=B8=20(=D0=B1=D0=B5=D0=B7=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0=D1=86=D0=B8=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DatabaseCore/DatabaseContext.cs | 13 + .../20210403180333_AddLecturers.Designer.cs | 829 ++++++++++++++++++ .../Migrations/20210403180333_AddLecturers.cs | 239 +++++ .../DatabaseContextModelSnapshot.cs | 294 +++++++ .../Models/Department/Employee.cs | 8 +- .../Models/Department/Lecturer.cs | 123 +++ .../Department/LecturerAcademicDegree.cs | 37 + .../Models/Department/LecturerAcademicRank.cs | 37 + .../Models/Department/LecturerEmployeePost.cs | 53 ++ .../Models/Department/LecturerPost.cs | 42 + .../DatabaseCore/Models/Security/User.cs | 9 +- .../ModuleTools/Enums/AccessOperation.cs | 4 +- .../BindingModels/EmployeeBindingModels.cs | 9 +- .../LecturerAcademicDegreeBindingModels.cs | 27 + .../LecturerAcademicRankBindingModels.cs | 27 + .../BindingModels/LecturerBindingModels.cs | 81 ++ .../LecturerEmployeePostBindingModels.cs | 41 + .../LecturerPostBindingModels.cs | 31 + .../BusinessLogics/EmployeeBusinessLogic.cs | 2 +- .../LecturerAcademicDegreeBusinessLogic.cs | 16 + .../LecturerAcademicRankBusinessLogic.cs | 16 + .../BusinessLogics/LecturerBusinessLogic.cs | 16 + .../LecturerEmployeePostBusinessLogic.cs | 16 + .../LecturerPostBusinessLogic.cs | 16 + .../ILecturerAcademicDegreeService.cs | 10 + .../ILecturerAcademicRankService.cs | 10 + .../ILecturerEmployeePostService.cs | 10 + .../Interfaces/ILecturerPostService.cs | 10 + .../Interfaces/ILecturerService.cs | 10 + .../ViewModels/EmployeePostViewModels.cs | 6 +- .../LecturerAcademicDegreeViewModels.cs | 32 + .../LecturerAcademicRankViewModels.cs | 32 + .../LecturerEmployeePostViewModels.cs | 56 ++ .../ViewModels/LecturerPostViewModels.cs | 37 + .../ViewModels/LecturerViewModels.cs | 114 +++ 35 files changed, 2300 insertions(+), 13 deletions(-) create mode 100644 DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.Designer.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerEmployeePost.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicDegreeBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicRankBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerEmployeePostBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerPostBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicDegreeBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicRankBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerEmployeePostBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerPostBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicDegreeService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicRankService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerEmployeePostService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerPostService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicRankViewModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerEmployeePostViewModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs diff --git a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs index 0c0798d..0bce762 100644 --- a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs +++ b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs @@ -41,6 +41,14 @@ namespace DatabaseCore modelBuilder.Entity().HasIndex(p => new { p.Title }).IsUnique(); modelBuilder.Entity().HasIndex(p => new { p.DisciplineName }).IsUnique(); + + modelBuilder.Entity().HasIndex(p => new { p.LecturerAcademicDegreeName }).IsUnique(); + + modelBuilder.Entity().HasIndex(p => new { p.LecturerAcademicRankName }).IsUnique(); + + modelBuilder.Entity().HasIndex(p => new { p.LecturerPostName }).IsUnique(); + + modelBuilder.Entity().HasIndex(p => new { p.FirstName, p.LastName, p.Patronymic }).IsUnique(); } #region Security @@ -58,6 +66,11 @@ namespace DatabaseCore public virtual DbSet Classrooms { set; get; } public virtual DbSet DisciplineBlocks { set; get; } public virtual DbSet Disciplines { set; get; } + public virtual DbSet LecturerAcademicDegrees { set; get; } + public virtual DbSet LecturerAcademicRanks { set; get; } + public virtual DbSet LecturerEmployeePosts { set; get; } + public virtual DbSet LecturerPosts { set; get; } + public virtual DbSet Lecturers { set; get; } #endregion } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.Designer.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.Designer.cs new file mode 100644 index 0000000..d3e8fe3 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.Designer.cs @@ -0,0 +1,829 @@ +// +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("20210403180333_AddLecturers")] + partial class AddLecturers + { + 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.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") + .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() + .HasFilter("[Number] IS NOT NULL"); + + 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("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.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.EmployeeEmployeePost", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EmployeeId") + .HasColumnType("uniqueidentifier"); + + b.Property("EmployeePostId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsExternalCombination") + .HasColumnType("bit"); + + b.Property("IsInternalCombination") + .HasColumnType("bit"); + + b.Property("Rate") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.HasIndex("EmployeePostId"); + + b.ToTable("EmployeeEmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EmployeePostName") + .HasColumnType("nvarchar(450)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("Order") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("EmployeePostName") + .IsUnique() + .HasFilter("[EmployeePostName] IS NOT NULL"); + + b.ToTable("EmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + 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("LecturerPostId") + .HasColumnType("uniqueidentifier"); + + b.Property("LecturerPostRate") + .HasColumnType("decimal(18,2)"); + + b.Property("MobileNumber") + .IsRequired() + .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("LecturerAcademicDegreeId"); + + b.HasIndex("LecturerAcademicRankId"); + + b.HasIndex("LecturerPostId"); + + 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("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.LecturerEmployeePost", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EmployeePostId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsExternalCombination") + .HasColumnType("bit"); + + b.Property("IsInternalCombination") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Rate") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeePostId"); + + b.HasIndex("LecturerId"); + + b.ToTable("LecturerEmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", 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("LecturerPostName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Order") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LecturerPostName") + .IsUnique(); + + b.ToTable("LecturerPosts"); + }); + + 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("Description") + .HasColumnType("nvarchar(max)"); + + 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.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.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.EmployeeEmployeePost", b => + { + b.HasOne("DatabaseCore.Models.Department.Employee", "Employee") + .WithMany("EmployeeEmployeePosts") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.EmployeePost", "EmployeePost") + .WithMany("EmployeeEmployeePosts") + .HasForeignKey("EmployeePostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Employee"); + + b.Navigation("EmployeePost"); + }); + + 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.Department.LecturerPost", "LecturerPost") + .WithMany("Lecturers") + .HasForeignKey("LecturerPostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Security.User", "User") + .WithMany("Lecturers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LecturerAcademicDegree"); + + b.Navigation("LecturerAcademicRank"); + + b.Navigation("LecturerPost"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.LecturerEmployeePost", b => + { + b.HasOne("DatabaseCore.Models.Department.EmployeePost", "EmployeePost") + .WithMany() + .HasForeignKey("EmployeePostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer") + .WithMany() + .HasForeignKey("LecturerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EmployeePost"); + + b.Navigation("Lecturer"); + }); + + 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.DisciplineBlock", b => + { + b.Navigation("Disciplines"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b => + { + b.Navigation("Classrooms"); + + b.Navigation("EmployeeEmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b => + { + b.Navigation("EmployeeEmployeePosts"); + }); + + 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.LecturerPost", b => + { + b.Navigation("Lecturers"); + }); + + 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("UserRoles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.cs new file mode 100644 index 0000000..764fbae --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403180333_AddLecturers.cs @@ -0,0 +1,239 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DatabaseCore.Migrations +{ + public partial class AddLecturers : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "LecturerAcademicDegrees", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + LecturerAcademicDegreeName = table.Column(type: "nvarchar(450)", nullable: false), + Order = 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_LecturerAcademicDegrees", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "LecturerAcademicRanks", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + LecturerAcademicRankName = table.Column(type: "nvarchar(450)", nullable: false), + Order = 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_LecturerAcademicRanks", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "LecturerPosts", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + LecturerPostName = table.Column(type: "nvarchar(450)", nullable: false), + Hours = table.Column(type: "int", nullable: false), + Order = 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_LecturerPosts", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Lecturers", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + UserId = table.Column(type: "uniqueidentifier", nullable: false), + LecturerPostId = table.Column(type: "uniqueidentifier", nullable: false), + LecturerPostRate = table.Column(type: "decimal(18,2)", nullable: false), + LecturerAcademicRankId = table.Column(type: "uniqueidentifier", nullable: true), + LecturerAcademicDegreeId = table.Column(type: "uniqueidentifier", nullable: true), + LastName = table.Column(type: "nvarchar(450)", nullable: false), + FirstName = table.Column(type: "nvarchar(450)", nullable: false), + Patronymic = table.Column(type: "nvarchar(450)", nullable: true), + DateBirth = table.Column(type: "datetime2", nullable: false), + Address = table.Column(type: "nvarchar(max)", nullable: false), + Email = table.Column(type: "nvarchar(max)", nullable: false), + MobileNumber = table.Column(type: "nvarchar(max)", nullable: false), + HomeNumber = table.Column(type: "nvarchar(max)", nullable: true), + Description = table.Column(type: "nvarchar(max)", nullable: true), + Photo = table.Column(type: "varbinary(max)", nullable: true), + GroupElectricalSafety = 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_Lecturers", x => x.Id); + table.ForeignKey( + name: "FK_Lecturers_LecturerAcademicDegrees_LecturerAcademicDegreeId", + column: x => x.LecturerAcademicDegreeId, + principalTable: "LecturerAcademicDegrees", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Lecturers_LecturerAcademicRanks_LecturerAcademicRankId", + column: x => x.LecturerAcademicRankId, + principalTable: "LecturerAcademicRanks", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Lecturers_LecturerPosts_LecturerPostId", + column: x => x.LecturerPostId, + principalTable: "LecturerPosts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Lecturers_Users_UserId", + column: x => x.UserId, + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "LecturerEmployeePosts", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + LecturerId = table.Column(type: "uniqueidentifier", nullable: false), + EmployeePostId = table.Column(type: "uniqueidentifier", nullable: false), + Rate = table.Column(type: "decimal(18,2)", nullable: false), + IsInternalCombination = table.Column(type: "bit", nullable: false), + IsExternalCombination = table.Column(type: "bit", nullable: false), + DateCreate = table.Column(type: "datetime2", nullable: false), + DateDelete = table.Column(type: "datetime2", nullable: true), + IsDeleted = table.Column(type: "bit", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LecturerEmployeePosts", x => x.Id); + table.ForeignKey( + name: "FK_LecturerEmployeePosts_EmployeePosts_EmployeePostId", + column: x => x.EmployeePostId, + principalTable: "EmployeePosts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_LecturerEmployeePosts_Lecturers_LecturerId", + column: x => x.LecturerId, + principalTable: "Lecturers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Employees_UserId", + table: "Employees", + column: "UserId"); + + migrationBuilder.CreateIndex( + name: "IX_LecturerAcademicDegrees_LecturerAcademicDegreeName", + table: "LecturerAcademicDegrees", + column: "LecturerAcademicDegreeName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_LecturerAcademicRanks_LecturerAcademicRankName", + table: "LecturerAcademicRanks", + column: "LecturerAcademicRankName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_LecturerEmployeePosts_EmployeePostId", + table: "LecturerEmployeePosts", + column: "EmployeePostId"); + + migrationBuilder.CreateIndex( + name: "IX_LecturerEmployeePosts_LecturerId", + table: "LecturerEmployeePosts", + column: "LecturerId"); + + migrationBuilder.CreateIndex( + name: "IX_LecturerPosts_LecturerPostName", + table: "LecturerPosts", + column: "LecturerPostName", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Lecturers_FirstName_LastName_Patronymic", + table: "Lecturers", + columns: new[] { "FirstName", "LastName", "Patronymic" }, + unique: true, + filter: "[Patronymic] IS NOT NULL"); + + migrationBuilder.CreateIndex( + name: "IX_Lecturers_LecturerAcademicDegreeId", + table: "Lecturers", + column: "LecturerAcademicDegreeId"); + + migrationBuilder.CreateIndex( + name: "IX_Lecturers_LecturerAcademicRankId", + table: "Lecturers", + column: "LecturerAcademicRankId"); + + migrationBuilder.CreateIndex( + name: "IX_Lecturers_LecturerPostId", + table: "Lecturers", + column: "LecturerPostId"); + + migrationBuilder.CreateIndex( + name: "IX_Lecturers_UserId", + table: "Lecturers", + column: "UserId"); + + migrationBuilder.AddForeignKey( + name: "FK_Employees_Users_UserId", + table: "Employees", + column: "UserId", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Employees_Users_UserId", + table: "Employees"); + + migrationBuilder.DropTable( + name: "LecturerEmployeePosts"); + + migrationBuilder.DropTable( + name: "Lecturers"); + + migrationBuilder.DropTable( + name: "LecturerAcademicDegrees"); + + migrationBuilder.DropTable( + name: "LecturerAcademicRanks"); + + migrationBuilder.DropTable( + name: "LecturerPosts"); + + migrationBuilder.DropIndex( + name: "IX_Employees_UserId", + table: "Employees"); + } + } +} diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs index 2a568c8..71fea8b 100644 --- a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs @@ -198,6 +198,8 @@ namespace DatabaseCore.Migrations 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"); @@ -272,6 +274,218 @@ namespace DatabaseCore.Migrations b.ToTable("EmployeePosts"); }); + modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + 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("LecturerPostId") + .HasColumnType("uniqueidentifier"); + + b.Property("LecturerPostRate") + .HasColumnType("decimal(18,2)"); + + b.Property("MobileNumber") + .IsRequired() + .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("LecturerAcademicDegreeId"); + + b.HasIndex("LecturerAcademicRankId"); + + b.HasIndex("LecturerPostId"); + + 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("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.LecturerEmployeePost", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("DateCreate") + .HasColumnType("datetime2"); + + b.Property("DateDelete") + .HasColumnType("datetime2"); + + b.Property("EmployeePostId") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsExternalCombination") + .HasColumnType("bit"); + + b.Property("IsInternalCombination") + .HasColumnType("bit"); + + b.Property("LecturerId") + .HasColumnType("uniqueidentifier"); + + b.Property("Rate") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("EmployeePostId"); + + b.HasIndex("LecturerId"); + + b.ToTable("LecturerEmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", 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("LecturerPostName") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Order") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("LecturerPostName") + .IsUnique(); + + b.ToTable("LecturerPosts"); + }); + modelBuilder.Entity("DatabaseCore.Models.Security.Access", b => { b.Property("Id") @@ -450,6 +664,17 @@ namespace DatabaseCore.Migrations b.Navigation("DisciplineBlock"); }); + 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.EmployeeEmployeePost", b => { b.HasOne("DatabaseCore.Models.Department.Employee", "Employee") @@ -469,6 +694,56 @@ namespace DatabaseCore.Migrations b.Navigation("EmployeePost"); }); + 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.Department.LecturerPost", "LecturerPost") + .WithMany("Lecturers") + .HasForeignKey("LecturerPostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Security.User", "User") + .WithMany("Lecturers") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("LecturerAcademicDegree"); + + b.Navigation("LecturerAcademicRank"); + + b.Navigation("LecturerPost"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.LecturerEmployeePost", b => + { + b.HasOne("DatabaseCore.Models.Department.EmployeePost", "EmployeePost") + .WithMany() + .HasForeignKey("EmployeePostId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer") + .WithMany() + .HasForeignKey("LecturerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("EmployeePost"); + + b.Navigation("Lecturer"); + }); + modelBuilder.Entity("DatabaseCore.Models.Security.Access", b => { b.HasOne("DatabaseCore.Models.Security.Role", "Role") @@ -516,6 +791,21 @@ namespace DatabaseCore.Migrations b.Navigation("EmployeeEmployeePosts"); }); + 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.LecturerPost", b => + { + b.Navigation("Lecturers"); + }); + modelBuilder.Entity("DatabaseCore.Models.Security.Role", b => { b.Navigation("Access"); @@ -525,6 +815,10 @@ namespace DatabaseCore.Migrations modelBuilder.Entity("DatabaseCore.Models.Security.User", b => { + b.Navigation("Employees"); + + b.Navigation("Lecturers"); + b.Navigation("UserRoles"); }); #pragma warning restore 612, 618 diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs index 3391d87..70364d8 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs @@ -1,4 +1,5 @@ -using ModuleTools.Attributes; +using DatabaseCore.Models.Security; +using ModuleTools.Attributes; using ModuleTools.Interfaces; using System; using System.Collections.Generic; @@ -12,7 +13,8 @@ namespace DatabaseCore.Models.Department /// [DataContract] [EntityDescription("Employee", "Сотрудника кафедры")] - public class Employee : BaseEntity, IEntitySecurityExtenstion + [EntityDependency("User", "UserId", "К какому пользователю относится сотрудник")] + public class Employee : BaseEntity, IEntitySecurityExtenstion { [DataMember] [MapConfiguration("UserId")] @@ -64,6 +66,8 @@ namespace DatabaseCore.Models.Department //------------------------------------------------------------------------- + public virtual User User { get; set; } + //------------------------------------------------------------------------- [ForeignKey("EmployeeId")] diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs new file mode 100644 index 0000000..d2068a8 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Lecturer.cs @@ -0,0 +1,123 @@ +using DatabaseCore.Models.Security; +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий преподавателя + /// + [DataContract] + [EntityDescription("Lecturer", "Преподаваетль кафедры")] + [EntityDependency("User", "UserId", "К какому пользователю относится преподаватель")] + [EntityDependency("LecturerPost", "LecturerPostId", "К какой должности относится преподаватель")] + [EntityDependency("LecturerAcademicRank", "LecturerAcademicRankId", "Какое звание имеет преподаватель")] + [EntityDependency("LecturerAcademicDegree", "LecturerAcademicDegreeId", "Какую степень имеет преподаватель")] + public class Lecturer : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [Required] + [MapConfiguration("UserId")] + public Guid UserId { get; set; } + + [DataMember] + [Required] + [MapConfiguration("LecturerPostId")] + public Guid LecturerPostId { get; set; } + + [DataMember] + [Required] + [MapConfiguration("LecturerPostRate")] + public decimal LecturerPostRate { get; set; } + + [DataMember] + [MapConfiguration("LecturerAcademicRankId")] + public Guid? LecturerAcademicRankId { get; set; } + + [DataMember] + [MapConfiguration("LecturerAcademicDegreeId")] + public Guid? LecturerAcademicDegreeId { get; set; } + + [DataMember] + [Required] + [MapConfiguration("LastName")] + public string LastName { get; set; } + + [DataMember] + [Required] + [MapConfiguration("FirstName")] + public string FirstName { get; set; } + + [DataMember] + [MapConfiguration("Patronymic")] + public string Patronymic { get; set; } + + [DataMember] + [Required] + [MapConfiguration("DateBirth")] + public DateTime DateBirth { get; set; } + + [DataMember] + [Required] + [MapConfiguration("Address")] + public string Address { get; set; } + + [DataMember] + [Required] + [MapConfiguration("Email")] + public string Email { get; set; } + + [DataMember] + [Required] + [MapConfiguration("MobileNumber")] + public string MobileNumber { get; set; } + + [DataMember] + [MapConfiguration("HomeNumber")] + public string HomeNumber { get; set; } + + [DataMember] + [MapConfiguration("Description")] + public string Description { get; set; } + + [DataMember] + [MapConfiguration("Photo")] + public byte[] Photo { get; set; } + + [DataMember] + [MapConfiguration("GroupElectricalSafety")] + public string GroupElectricalSafety { get; set; } + + //------------------------------------------------------------------------- + + public virtual User User { get; set; } + + public virtual LecturerPost LecturerPost { get; set; } + + public virtual LecturerAcademicRank LecturerAcademicRank { get; set; } + + public virtual LecturerAcademicDegree LecturerAcademicDegree { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + public Lecturer SecurityCheck(Lecturer entity, bool allowFullData) + { + if (!allowFullData) + { + entity.DateBirth = DateTime.Now; + entity.Address = "скрыто"; + entity.Email = "скрыто"; + entity.MobileNumber = "скрыто"; + entity.HomeNumber = "скрыто"; + entity.Photo = null; + } + + return entity; + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs new file mode 100644 index 0000000..1c80fbb --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicDegree.cs @@ -0,0 +1,37 @@ +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий ученой степени преподавателя кафедры + /// + [DataContract] + [EntityDescription("LecturerAcademicDegree", "Ученой степени преподавателя кафедры")] + public class LecturerAcademicDegree : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [Required] + [MapConfiguration("LecturerAcademicDegreeName")] + public string LecturerAcademicDegreeName { get; set; } + + [DataMember] + [MapConfiguration("Order")] + public int Order { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + [ForeignKey("LecturerAcademicDegreeId")] + public virtual List Lecturers { get; set; } + + //------------------------------------------------------------------------- + + public LecturerAcademicDegree SecurityCheck(LecturerAcademicDegree entity, bool allowFullData) => entity; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs new file mode 100644 index 0000000..beb232a --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerAcademicRank.cs @@ -0,0 +1,37 @@ +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий ученое звание преподавателя кафедры + /// + [DataContract] + [EntityDescription("LecturerAcademicRank", "Ученое звание преподавателя кафедры")] + public class LecturerAcademicRank : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [Required] + [MapConfiguration("LecturerAcademicRankName")] + public string LecturerAcademicRankName { get; set; } + + [DataMember] + [MapConfiguration("Order")] + public int Order { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + [ForeignKey("LecturerAcademicRankId")] + public virtual List Lecturers { get; set; } + + //------------------------------------------------------------------------- + + public LecturerAcademicRank SecurityCheck(LecturerAcademicRank entity, bool allowFullData) => entity; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerEmployeePost.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerEmployeePost.cs new file mode 100644 index 0000000..a9f59d4 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerEmployeePost.cs @@ -0,0 +1,53 @@ +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий связь преподавателя и должность кафедры + /// + [DataContract] + [EntityDescription("LecturerEmployeePost", "Связь преподавателя и должность кафедры")] + [EntityDependency("EmployeePost", "EmployeePostId", "К какой должности относится преподаватель")] + [EntityDependency("Lecturer", "LecturerId", "К какой должности относится преподаватель")] + public class LecturerEmployeePost : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [Required] + [MapConfiguration("LecturerId")] + public Guid LecturerId { get; set; } + + [DataMember] + [Required] + [MapConfiguration("EmployeePostId")] + public Guid EmployeePostId { get; set; } + + [DataMember] + [Required] + [MapConfiguration("Rate")] + public decimal Rate { get; set; } + + [DataMember] + [MapConfiguration("IsInternalCombination")] + public bool IsInternalCombination { get; set; } + + [DataMember] + [MapConfiguration("IsExternalCombination")] + public bool IsExternalCombination { get; set; } + + //------------------------------------------------------------------------- + + public virtual EmployeePost EmployeePost { get; set; } + + public virtual Lecturer Lecturer { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + public LecturerEmployeePost SecurityCheck(LecturerEmployeePost entity, bool allowFullData) => entity; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs new file mode 100644 index 0000000..492b0db --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/LecturerPost.cs @@ -0,0 +1,42 @@ +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий должность преподавателя кафедры + /// + [DataContract] + [EntityDescription("LecturerPost", "Должность преподавателя кафедры")] + public class LecturerPost : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [Required] + [MapConfiguration("LecturerPostName")] + public string LecturerPostName { get; set; } + + [DataMember] + [Required] + [MapConfiguration("Hours")] + public int Hours { get; set; } + + [DataMember] + [MapConfiguration("Order")] + public int Order { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + [ForeignKey("LecturerPostId")] + public virtual List Lecturers { get; set; } + + //------------------------------------------------------------------------- + + public LecturerPost SecurityCheck(LecturerPost entity, bool allowFullData) => entity; + } +} \ 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 3c53870..4aa5cad 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Security/User.cs @@ -1,4 +1,5 @@ -using ModuleTools.Attributes; +using DatabaseCore.Models.Department; +using ModuleTools.Attributes; using ModuleTools.Interfaces; using System; using System.Collections.Generic; @@ -52,6 +53,12 @@ namespace DatabaseCore.Models.Security [ForeignKey("UserId")] public virtual List UserRoles { get; set; } + [ForeignKey("UserId")] + public virtual List Employees { get; set; } + + [ForeignKey("UserId")] + public virtual List Lecturers { get; set; } + //------------------------------------------------------------------------- public User SecurityCheck(User entity, bool allowFullData) diff --git a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs index 27ac8f8..c9d20f7 100644 --- a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs +++ b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs @@ -32,9 +32,9 @@ Дисциплины = 103, // + Блоки дисциплин - Направления = 102, + Преподаватели = 104, // + должности, звания - Преподаватели = 103, // + должности, звания + Направления = 102, Группы = 105, // diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs index 1db4e0a..4da4219 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/EmployeeBindingModels.cs @@ -10,6 +10,7 @@ namespace DepartmentBusinessLogic.BindingModels /// public class EmployeeGetBindingModel : GetBindingModel { + public Guid? UserId { get; set; } } /// @@ -21,14 +22,14 @@ namespace DepartmentBusinessLogic.BindingModels [MapConfiguration("UserId")] public Guid UserId { get; set; } - [Required(ErrorMessage = "required")] - [MapConfiguration("FirstName")] - public string FirstName { get; set; } - [Required(ErrorMessage = "required")] [MapConfiguration("LastName")] public string LastName { get; set; } + [Required(ErrorMessage = "required")] + [MapConfiguration("FirstName")] + public string FirstName { get; set; } + [MapConfiguration("Patronymic")] public string Patronymic { get; set; } diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicDegreeBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicDegreeBindingModels.cs new file mode 100644 index 0000000..88eb1be --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicDegreeBindingModels.cs @@ -0,0 +1,27 @@ +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение ученой степени преподавателя + /// + public class LecturerAcademicDegreeGetBindingModel : GetBindingModel + { + } + + /// + /// Сохранение ученой степени преподавателя + /// + public class LecturerAcademicDegreeSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("LecturerAcademicDegreeName")] + public string LecturerAcademicDegreeName { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Order")] + public int Order { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicRankBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicRankBindingModels.cs new file mode 100644 index 0000000..3c2e12b --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerAcademicRankBindingModels.cs @@ -0,0 +1,27 @@ +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение ученого звания преподавателя + /// + public class LecturerAcademicRankGetBindingModel : GetBindingModel + { + } + + /// + /// Сохранение ученого звания преподавателя + /// + public class LecturerAcademicRankSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("LecturerAcademicRankName")] + public string LecturerAcademicRankName { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Order")] + public int Order { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerBindingModels.cs new file mode 100644 index 0000000..d77bcb8 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerBindingModels.cs @@ -0,0 +1,81 @@ +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение преподавателя + /// + public class LecturerGetBindingModel : GetBindingModel + { + public Guid? UserId { get; set; } + } + + /// + /// Сохранение преподавателя + /// + public class LecturerSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("UserId")] + public Guid UserId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("LecturerPostId")] + public Guid LecturerPostId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("LecturerPostRate")] + public decimal LecturerPostRate { get; set; } + + [MapConfiguration("LecturerAcademicRankId")] + public Guid? LecturerAcademicRankId { get; set; } + + [MapConfiguration("LecturerAcademicDegreeId")] + public Guid? LecturerAcademicDegreeId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("LastName")] + public string LastName { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("FirstName")] + public string FirstName { get; set; } + + [MapConfiguration("Patronymic")] + public string Patronymic { get; set; } + + [MapConfiguration("Abbreviation")] + public string Abbreviation { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("DateBirth")] + public DateTime DateBirth { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Address")] + public string Address { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Email")] + public string Email { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("MobileNumber")] + public string MobileNumber { get; set; } + + [MapConfiguration("HomeNumber")] + public string HomeNumber { get; set; } + + [MapConfiguration("Description")] + public string Description { get; set; } + + [MapConfiguration("Photo")] + public byte[] Photo { get; set; } + + [MapConfiguration("OnlyForPrivate")] + public bool OnlyForPrivate { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerEmployeePostBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerEmployeePostBindingModels.cs new file mode 100644 index 0000000..90c04e7 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerEmployeePostBindingModels.cs @@ -0,0 +1,41 @@ +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение связи преподавателя с должностью + /// + public class LecturerEmployeePostGetBindingModel : GetBindingModel + { + public Guid? LecturerId { get; set; } + + public Guid? EmployeePostId { get; set; } + } + + /// + /// Сохранение связи преподавателя с должностью + /// + public class LecturerEmployeePostSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("LecturerId")] + public Guid LecturerId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("EmployeePostId")] + public Guid EmployeePostId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Rate")] + public decimal Rate { get; set; } + + [MapConfiguration("IsInternalCombination")] + public bool IsInternalCombination { get; set; } + + [MapConfiguration("IsExternalCombination")] + public bool IsExternalCombination { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerPostBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerPostBindingModels.cs new file mode 100644 index 0000000..a03f96f --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/LecturerPostBindingModels.cs @@ -0,0 +1,31 @@ +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + /// + /// Получение должности преподавателя + /// + public class LecturerPostGetBindingModel : GetBindingModel + { + } + + /// + /// Сохранение должности преподавателя + /// + public class LecturerPostSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("LecturerPostName")] + public string LecturerPostName { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Hours")] + public int Hours { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Order")] + public int Order { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeBusinessLogic.cs index 90fce14..4293a5e 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeBusinessLogic.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/EmployeeBusinessLogic.cs @@ -7,7 +7,7 @@ using ModuleTools.Enums; namespace DepartmentBusinessLogic.BusinessLogics { /// - /// Логика работы с должностями сотрудников + /// Логика работы с сотрудниками /// public class EmployeeBusinessLogic : GenericBusinessLogic { diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicDegreeBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicDegreeBusinessLogic.cs new file mode 100644 index 0000000..dd7602f --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicDegreeBusinessLogic.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 LecturerAcademicDegreeBusinessLogic : GenericBusinessLogic + { + public LecturerAcademicDegreeBusinessLogic(ILecturerAcademicDegreeService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicRankBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicRankBusinessLogic.cs new file mode 100644 index 0000000..5316efd --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerAcademicRankBusinessLogic.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 LecturerAcademicRankBusinessLogic : GenericBusinessLogic + { + public LecturerAcademicRankBusinessLogic(ILecturerAcademicRankService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerBusinessLogic.cs new file mode 100644 index 0000000..faabede --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerBusinessLogic.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 LecturerBusinessLogic : GenericBusinessLogic + { + public LecturerBusinessLogic(ILecturerService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerEmployeePostBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerEmployeePostBusinessLogic.cs new file mode 100644 index 0000000..26a9c40 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerEmployeePostBusinessLogic.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 LecturerEmployeePostBusinessLogic : GenericBusinessLogic + { + public LecturerEmployeePostBusinessLogic(ILecturerEmployeePostService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerPostBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerPostBusinessLogic.cs new file mode 100644 index 0000000..99adad0 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/LecturerPostBusinessLogic.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 LecturerPostBusinessLogic : GenericBusinessLogic + { + public LecturerPostBusinessLogic(ILecturerPostService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicDegreeService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicDegreeService.cs new file mode 100644 index 0000000..a0abbf5 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicDegreeService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение ученых степеней преподавателей + /// + public interface ILecturerAcademicDegreeService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicRankService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicRankService.cs new file mode 100644 index 0000000..c538374 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerAcademicRankService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение ученых званий преподавателей + /// + public interface ILecturerAcademicRankService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerEmployeePostService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerEmployeePostService.cs new file mode 100644 index 0000000..f465c19 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerEmployeePostService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение должностей преподавателей + /// + public interface ILecturerEmployeePostService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerPostService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerPostService.cs new file mode 100644 index 0000000..b230302 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerPostService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение должностей преподавателей + /// + public interface ILecturerPostService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerService.cs new file mode 100644 index 0000000..d24df98 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/ILecturerService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение преподавателей + /// + public interface ILecturerService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs index 4c0af27..f5abb7c 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeePostViewModels.cs @@ -5,12 +5,12 @@ using ModuleTools.ViewModels; namespace DepartmentBusinessLogic.ViewModels { /// - /// Список ролей + /// Список должностей сотрудников /// public class EmployeePostListViewModel : ListViewModel { } /// - /// Элемент ролей + /// Элемент должности сотрудников /// [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] [ViewModelControlElementDependenceEntity(Title = "Сотрудники", Order = 1, ParentPropertyName = "EmployeePostId", @@ -18,7 +18,7 @@ namespace DepartmentBusinessLogic.ViewModels public class EmployeePostViewModel : ElementViewModel { [ViewModelControlListProperty("Название должности")] - [ViewModelControlElementProperty("Название должность", ControlType.ControlString, MustHaveValue = true)] + [ViewModelControlElementProperty("Название должности", ControlType.ControlString, MustHaveValue = true)] [MapConfiguration("EmployeePostName")] public string EmployeePostName { get; set; } diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs new file mode 100644 index 0000000..ff6467e --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicDegreeViewModels.cs @@ -0,0 +1,32 @@ +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список должностей преподавателей + /// + public class LecturerAcademicDegreeListViewModel : ListViewModel { } + + /// + /// Элемент должности преподавателей + /// + [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] + [ViewModelControlElementDependenceEntity(Title = "Преподаватели", Order = 1, ParentPropertyName = "LecturerPostId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostEmployeeList, DepartmentWindowsDesktop")] + public class LecturerAcademicDegreeViewModel : ElementViewModel + { + [ViewModelControlListProperty("Ученая степень")] + [ViewModelControlElementProperty("Ученая степень", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("LecturerAcademicDegreeName")] + public string LecturerAcademicDegreeName { get; set; } + + [ViewModelControlListProperty("Порядок", ColumnWidth = 100)] + [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 new file mode 100644 index 0000000..b3bd22a --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerAcademicRankViewModels.cs @@ -0,0 +1,32 @@ +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список должностей преподавателей + /// + public class LecturerAcademicRankListViewModel : ListViewModel { } + + /// + /// Элемент должности преподавателей + /// + [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] + [ViewModelControlElementDependenceEntity(Title = "Преподаватели", Order = 1, ParentPropertyName = "LecturerPostId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostEmployeeList, DepartmentWindowsDesktop")] + public class LecturerAcademicRankViewModel : ElementViewModel + { + [ViewModelControlListProperty("Ученая степень")] + [ViewModelControlElementProperty("Ученая степень", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("LecturerAcademicRankName")] + public string LecturerAcademicRankName { get; set; } + + [ViewModelControlListProperty("Порядок", ColumnWidth = 100)] + [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/LecturerEmployeePostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerEmployeePostViewModels.cs new file mode 100644 index 0000000..af03dcc --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerEmployeePostViewModels.cs @@ -0,0 +1,56 @@ +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; +using System; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список связей преподавателей и должностей + /// + public class LecturerEmployeePostListViewModel : ListViewModel { } + + /// + /// Связь преподавателя и должности + /// + [ViewModelControlElementClass()] + public class LecturerEmployeePostViewModel : ElementViewModel + { + [ViewModelControlElementProperty("Сотрудник", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")] + [MapConfiguration("LecturerId", AllowCopyWithoutRigth = false)] + public Guid LecturerId { get; set; } + + [ViewModelControlListProperty("Преподаватель")] + [MapConfiguration("Lecturer.LastName", IsDifficle = true)] + public string LecturerName { get; set; } + + [ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEmployeePostList, DepartmentWindowsDesktop")] + [MapConfiguration("EmployeePostId")] + public Guid EmployeePostId { get; set; } + + [ViewModelControlListProperty("Должность")] + [MapConfiguration("EmployeePost.EmployeePostName", IsDifficle = true)] + public string EmployeePostName { get; set; } + + [ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")] + [ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, DecimalPlaces = 1, MustHaveValue = true)] + [MapConfiguration("Rate")] + public decimal Rate { get; set; } + + [ViewModelControlElementProperty("Внутр. совм.", ControlType.ControlBool, MustHaveValue = true)] + [MapConfiguration("IsInternalCombination")] + public bool IsInternalCombination { get; set; } + + [ViewModelControlListProperty("Внутр. совм.", ColumnWidth = 80)] + public string InternalCombination => IsInternalCombination ? "Да" : "Нет"; + + [ViewModelControlElementProperty("Внеш. совм.", ControlType.ControlBool, MustHaveValue = true)] + [MapConfiguration("IsExternalCombination")] + public bool IsExternalCombination { get; set; } + + [ViewModelControlListProperty("Внеш. совм.", ColumnWidth = 80)] + public string ExternalCombination => IsExternalCombination ? "Да" : "Нет"; + + public override string ToString() => $"{LecturerName}-{EmployeePostName}"; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs new file mode 100644 index 0000000..4614dbf --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerPostViewModels.cs @@ -0,0 +1,37 @@ +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список должностей преподавателей + /// + public class LecturerPostListViewModel : ListViewModel { } + + /// + /// Элемент должности преподавателей + /// + [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)] + [ViewModelControlElementDependenceEntity(Title = "Преподаватели", Order = 1, ParentPropertyName = "LecturerPostId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostEmployeeList, DepartmentWindowsDesktop")] + public class LecturerPostViewModel : ElementViewModel + { + [ViewModelControlListProperty("Название должности")] + [ViewModelControlElementProperty("Название должности", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("LecturerPostName")] + public string LecturerPostName { get; set; } + + [ViewModelControlListProperty("Часы", ColumnWidth = 100)] + [ViewModelControlElementProperty("Часы", ControlType.ControlInt, MustHaveValue = true)] + [MapConfiguration("Hours")] + public int Hours { get; set; } + + [ViewModelControlListProperty("Порядок", ColumnWidth = 100)] + [ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)] + [MapConfiguration("Order")] + public int Order { get; set; } + + public override string ToString() => LecturerPostName; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs new file mode 100644 index 0000000..673d626 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/LecturerViewModels.cs @@ -0,0 +1,114 @@ +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.Extensions; +using ModuleTools.ViewModels; +using System; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список преподавателей + /// + public class LecturerListViewModel : ListViewModel { } + + /// + /// Элемент преподаватель + /// + [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 700)] + [ViewModelControlElementDependenceEntity(Title = "Должности", Order = 1, ParentPropertyName = "LecturerId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerEmployeePostList, DepartmentWindowsDesktop")] + public class LecturerViewModel : ElementViewModel + { + [ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")] + [MapConfiguration("UserId")] + public Guid UserId { get; set; } + + [ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostList, DepartmentWindowsDesktop")] + [MapConfiguration("LecturerPostId")] + public Guid LecturerPostId { get; set; } + + [ViewModelControlListProperty("Должность")] + [MapConfiguration("LecturerPost.LecturerPostName", IsDifficle = true)] + public string EmployeePostName { get; set; } + + [ViewModelControlListProperty("Ставка")] + [ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, MustHaveValue = true)] + [MapConfiguration("LecturerPostRate")] + public decimal LecturerPostRate { get; set; } + + [ViewModelControlElementProperty("Уч. степень", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerAcademicDegreeList, DepartmentWindowsDesktop")] + [MapConfiguration("LecturerAcademicDegreeId")] + public Guid? LecturerAcademicDegreeId { get; set; } + + [ViewModelControlListProperty("Уч. степень")] + [MapConfiguration("LecturerAcademicDegree.LecturerAcademicDegreeName", IsDifficle = true)] + public string LecturerAcademicDegree { get; set; } + + [ViewModelControlElementProperty("Уч. звание", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerAcademicRankList, DepartmentWindowsDesktop")] + [MapConfiguration("LecturerAcademicRankId")] + public Guid? LecturerAcademicRankId { get; set; } + + [ViewModelControlListProperty("Уч. звание")] + [MapConfiguration("LecturerAcademicRank.LecturerAcademicRankName", IsDifficle = true)] + public string LecturerAcademicRank { get; set; } + + [ViewModelControlListProperty("Фамилия")] + [ViewModelControlElementProperty("Фамилия", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("LastName")] + public string LastName { get; set; } + + [ViewModelControlListProperty("Имя")] + [ViewModelControlElementProperty("Имя", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("FirstName")] + public string FirstName { get; set; } + + [ViewModelControlListProperty("Отчество")] + [ViewModelControlElementProperty("Отчество", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("Patronymic")] + public string Patronymic { get; set; } + + [ViewModelControlElementProperty("Аббревиатура", ControlType.ControlString)] + [MapConfiguration("Abbreviation")] + public string Abbreviation { get; set; } + + [ViewModelControlListProperty("Дата рожд.", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")] + [ViewModelControlElementProperty("Дата рожд.", ControlType.ControlDateTime, MustHaveValue = true)] + [MapConfiguration("DateBirth", AllowCopyWithoutRigth = false)] + public DateTime DateBirth { get; set; } + + [ViewModelControlListProperty("Адрес", ColumnWidth = 90)] + [ViewModelControlElementProperty("Адрес", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("Address", AllowCopyWithoutRigth = false)] + public string Address { get; set; } + + [ViewModelControlListProperty("Эл. почта", ColumnWidth = 90)] + [ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("Email", AllowCopyWithoutRigth = false)] + public string Email { get; set; } + + [ViewModelControlListProperty("Моб. номер", ColumnWidth = 100)] + [ViewModelControlElementProperty("Моб. номер", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("MobileNumber", AllowCopyWithoutRigth = false)] + public string MobileNumber { get; set; } + + [ViewModelControlListProperty("Дом. номер", ColumnWidth = 100)] + [ViewModelControlElementProperty("Дом. номер", ControlType.ControlString)] + [MapConfiguration("HomeNumber", AllowCopyWithoutRigth = false)] + public string HomeNumber { get; set; } + + [ViewModelControlElementProperty("Описание", ControlType.ControlText)] + [MapConfiguration("Description")] + public string Description { get; set; } + + [ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)] + [MapConfiguration("Photo")] + public byte[] Photo { get; set; } + + [ViewModelControlElementProperty("Для внутр. пользования", ControlType.ControlBool, MustHaveValue = true)] + [MapConfiguration("OnlyForPrivate")] + public bool OnlyForPrivate { 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