From 6368698bffc66c9cde664c89c212d1c743eed384 Mon Sep 17 00:00:00 2001 From: kotcheshir73 Date: Sat, 3 Apr 2021 13:41:19 +0400 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BE=D1=82=D1=80=D1=83=D0=B4=D0=BD?= =?UTF-8?q?=D0=B8=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Common/DatabaseCore/DatabaseContext.cs | 3 + .../20210403090025_AddClassrooms.Designer.cs | 445 ++++++++++++++++++ .../20210403090025_AddClassrooms.cs | 78 +++ .../DatabaseContextModelSnapshot.cs | 71 ++- .../Models/Department/Classroom.cs | 73 +++ .../Models/Department/Employee.cs | 3 + .../BaseControls/BaseControlImage.cs | 2 +- .../BindingModels/SetBindingModel.cs | 2 +- .../ModuleTools/Enums/AccessOperation.cs | 2 +- .../BindingModels/ClassroomBindingModels.cs | 59 +++ .../BusinessLogics/ClassroomBusinessLogic.cs | 16 + .../DepartmentBusinessLogic.csproj | 4 - .../Enums/ClassroomType.cs | 38 ++ .../Interfaces/IClassroomService.cs | 10 + .../ViewModels/ClassroomViewModels.cs | 73 +++ .../EmployeeEmployeePostViewModels.cs | 4 +- .../ViewModels/EmployeeViewModels.cs | 2 + .../DepartmentImplementationExtensions.cs | 3 + .../Implementations/ClassroomService.cs | 138 ++++++ .../Implementations/EmployeeService.cs | 5 + .../DepartmentWindowDesktopExtension.cs | 3 +- .../ControlClassroomElement.Designer.cs | 33 ++ .../EntityControls/ControlClassroomElement.cs | 27 ++ .../ControlClassroomElement.resx | 120 +++++ .../ControlClassroomList.Designer.cs | 33 ++ .../EntityControls/ControlClassroomList.cs | 47 ++ .../EntityControls/ControlClassroomList.resx | 120 +++++ .../Employee/ControlEmployeeElement.cs | 3 + 28 files changed, 1405 insertions(+), 12 deletions(-) create mode 100644 DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.Designer.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.cs create mode 100644 DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/ClassroomBindingModels.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/ClassroomBusinessLogic.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Enums/ClassroomType.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IClassroomService.cs create mode 100644 DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs create mode 100644 DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/ClassroomService.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.resx create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.Designer.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.cs create mode 100644 DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.resx diff --git a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs index 33c046e..a32baca 100644 --- a/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs +++ b/DepartmentPortal/Common/DatabaseCore/DatabaseContext.cs @@ -35,6 +35,8 @@ namespace DatabaseCore modelBuilder.Entity().HasIndex(s => s.EmployeePostName).IsUnique(); modelBuilder.Entity().HasIndex(p => new { p.FirstName, p.LastName, p.Patronymic }).IsUnique(); + + modelBuilder.Entity().HasIndex(p => new { p.Number }).IsUnique(); } #region Security @@ -49,6 +51,7 @@ namespace DatabaseCore public virtual DbSet EmployeePosts { set; get; } public virtual DbSet Employees { set; get; } public virtual DbSet EmployeeEmployeePosts { set; get; } + public virtual DbSet Classrooms { set; get; } #endregion } } \ No newline at end of file diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.Designer.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.Designer.cs new file mode 100644 index 0000000..aff025e --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.Designer.cs @@ -0,0 +1,445 @@ +// +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("20210403090025_AddClassrooms")] + partial class AddClassrooms + { + 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.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("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.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") + .HasColumnType("nvarchar(450)"); + + b.Property("RolePriority") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleName") + .IsUnique() + .HasFilter("[RoleName] IS NOT NULL"); + + 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") + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .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.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.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.Employee", b => + { + b.Navigation("Classrooms"); + + b.Navigation("EmployeeEmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b => + { + b.Navigation("EmployeeEmployeePosts"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Security.Role", b => + { + b.Navigation("Access"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("DatabaseCore.Models.Security.User", b => + { + b.Navigation("UserRoles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.cs new file mode 100644 index 0000000..5116f39 --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.cs @@ -0,0 +1,78 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace DatabaseCore.Migrations +{ + public partial class AddClassrooms : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_Users_UserName", + table: "Users"); + + migrationBuilder.CreateTable( + name: "Classrooms", + columns: table => new + { + Id = table.Column(type: "uniqueidentifier", nullable: false), + Number = table.Column(type: "nvarchar(450)", nullable: true), + Title = table.Column(type: "nvarchar(max)", nullable: true), + EmployeeId = table.Column(type: "uniqueidentifier", nullable: false), + ClassroomType = table.Column(type: "int", nullable: false), + Square = table.Column(type: "decimal(18,2)", nullable: false), + Capacity = table.Column(type: "int", nullable: false), + SecurityCode = table.Column(type: "nvarchar(max)", nullable: true), + HaveProjector = table.Column(type: "bit", nullable: false), + Description = table.Column(type: "nvarchar(max)", nullable: true), + Photo = table.Column(type: "varbinary(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_Classrooms", x => x.Id); + table.ForeignKey( + name: "FK_Classrooms_Employees_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employees", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Users_UserName", + table: "Users", + column: "UserName"); + + migrationBuilder.CreateIndex( + name: "IX_Classrooms_EmployeeId", + table: "Classrooms", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_Classrooms_Number", + table: "Classrooms", + column: "Number", + unique: true, + filter: "[Number] IS NOT NULL"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Classrooms"); + + migrationBuilder.DropIndex( + name: "IX_Users_UserName", + table: "Users"); + + migrationBuilder.CreateIndex( + name: "IX_Users_UserName", + table: "Users", + column: "UserName", + filter: "[UserName] IS NOT NULL"); + } + } +} diff --git a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs index c603ee5..73b7ed4 100644 --- a/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs +++ b/DepartmentPortal/Common/DatabaseCore/Migrations/DatabaseContextModelSnapshot.cs @@ -19,6 +19,61 @@ namespace DatabaseCore.Migrations .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.Employee", b => { b.Property("Id") @@ -265,8 +320,7 @@ namespace DatabaseCore.Migrations b.HasKey("Id"); - b.HasIndex("UserName") - .HasFilter("[UserName] IS NOT NULL"); + b.HasIndex("UserName"); b.ToTable("Users"); }); @@ -300,6 +354,17 @@ namespace DatabaseCore.Migrations 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.EmployeeEmployeePost", b => { b.HasOne("DatabaseCore.Models.Department.Employee", "Employee") @@ -351,6 +416,8 @@ namespace DatabaseCore.Migrations modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b => { + b.Navigation("Classrooms"); + b.Navigation("EmployeeEmployeePosts"); }); diff --git a/DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs b/DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs new file mode 100644 index 0000000..e2152cc --- /dev/null +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Classroom.cs @@ -0,0 +1,73 @@ +using ModuleTools.Attributes; +using ModuleTools.Interfaces; +using System; +using System.Runtime.Serialization; + +namespace DatabaseCore.Models.Department +{ + /// + /// Класс, описывающий аудиторию в системе + /// + [DataContract] + [EntityDescription("Classroom", "Аудитрия кафедры")] + public class Classroom : BaseEntity, IEntitySecurityExtenstion + { + [DataMember] + [MapConfiguration("Number")] + public string Number { get; set; } + + [DataMember] + [MapConfiguration("Title")] + public string Title { get; set; } + + [DataMember] + [MapConfiguration("EmployeeId")] + public Guid EmployeeId { get; set; } + + [DataMember] + [MapConfiguration("ClassroomType")] + public int ClassroomType { get; set; } + + [DataMember] + [MapConfiguration("Square")] + public decimal Square { get; set; } + + [DataMember] + [MapConfiguration("Capacity")] + public int Capacity { get; set; } + + [DataMember] + [MapConfiguration("SecurityCode")] + public string SecurityCode { get; set; } + + [DataMember] + [MapConfiguration("HaveProjector")] + public bool HaveProjector { get; set; } + + [DataMember] + [MapConfiguration("Description")] + public string Description { get; set; } + + [DataMember] + [MapConfiguration("Photo")] + public byte[] Photo { get; set; } + + //------------------------------------------------------------------------- + + public virtual Employee Employee { get; set; } + + //------------------------------------------------------------------------- + + //------------------------------------------------------------------------- + + public Classroom SecurityCheck(Classroom entity, bool allowFullData) + { + if (!allowFullData) + { + entity.SecurityCode = "скрыто"; + } + + return entity; + } + } +} \ 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 eac2217..4bad4c9 100644 --- a/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs +++ b/DepartmentPortal/Common/DatabaseCore/Models/Department/Employee.cs @@ -69,6 +69,9 @@ namespace DatabaseCore.Models.Department [ForeignKey("EmployeeId")] public virtual List EmployeeEmployeePosts { get; set; } + [ForeignKey("EmployeeId")] + public virtual List Classrooms { get; set; } + //------------------------------------------------------------------------- public Employee SecurityCheck(Employee entity, bool allowFullData) diff --git a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlImage.cs b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlImage.cs index 461fedd..3935ca9 100644 --- a/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlImage.cs +++ b/DepartmentPortal/Common/DesktopTools/BaseControls/BaseControlImage.cs @@ -58,7 +58,7 @@ namespace DesktopTools.BaseControls public void SetValueToControl(object value) { - if (value != null) + if (value != null && (value as byte[])?.Length > 0) { using MemoryStream mStream = new(value as byte[]); pictureBox.Image = Image.FromStream(mStream); diff --git a/DepartmentPortal/Common/ModuleTools/BindingModels/SetBindingModel.cs b/DepartmentPortal/Common/ModuleTools/BindingModels/SetBindingModel.cs index 27f748a..dfaf502 100644 --- a/DepartmentPortal/Common/ModuleTools/BindingModels/SetBindingModel.cs +++ b/DepartmentPortal/Common/ModuleTools/BindingModels/SetBindingModel.cs @@ -12,6 +12,6 @@ namespace ModuleTools.BindingModels /// Идентификатор записи /// [MapConfiguration("Id")] - public Guid Id { get; set; } + public Guid Id { get; set; } = Guid.NewGuid(); } } \ No newline at end of file diff --git a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs index 5afb572..057d361 100644 --- a/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs +++ b/DepartmentPortal/Common/ModuleTools/Enums/AccessOperation.cs @@ -28,7 +28,7 @@ Сотрудники = 101, - Аудитории = 101, + Аудитории = 102, Направления = 102, diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/ClassroomBindingModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/ClassroomBindingModels.cs new file mode 100644 index 0000000..f15f922 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BindingModels/ClassroomBindingModels.cs @@ -0,0 +1,59 @@ +using DepartmentBusinessLogic.Enums; +using ModuleTools.Attributes; +using ModuleTools.BindingModels; +using System; +using System.ComponentModel.DataAnnotations; + +namespace DepartmentBusinessLogic.BindingModels +{ + public class ClassroomGetBindingModel : GetBindingModel + { + /// + /// Используется для вывода в расписании + /// + public bool? UseInSchedule { get; set; } + + /// + /// Вывод аудиторий, закрепленных за сотрудником + /// + public Guid? EmployeeId { get; set; } + } + + public class ClassroomSetBindingModel : SetBindingModel + { + [Required(ErrorMessage = "required")] + [MapConfiguration("Number")] + public string Number { get; set; } + + [MapConfiguration("Title")] + public string Title { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("EmployeeId")] + public Guid EmployeeId { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("ClassroomType")] + public ClassroomType ClassroomType { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Square")] + public decimal Square { get; set; } + + [Required(ErrorMessage = "required")] + [MapConfiguration("Capacity")] + public int Capacity { get; set; } + + [MapConfiguration("SecurityCode")] + public string SecurityCode { get; set; } + + [MapConfiguration("HaveProjector")] + public bool HaveProjector { get; set; } + + [MapConfiguration("Description")] + public string Description { get; set; } + + [MapConfiguration("Photo")] + public byte[] Photo { get; set; } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/ClassroomBusinessLogic.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/ClassroomBusinessLogic.cs new file mode 100644 index 0000000..a194114 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/BusinessLogics/ClassroomBusinessLogic.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 ClassroomBusinessLogic : GenericBusinessLogic + { + public ClassroomBusinessLogic(IClassroomService service) : base(service, "Аудитории", AccessOperation.Аудитории) { } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj index c9c9e22..9258d73 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/DepartmentBusinessLogic.csproj @@ -8,10 +8,6 @@ - - - - diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/ClassroomType.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/ClassroomType.cs new file mode 100644 index 0000000..17d4344 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Enums/ClassroomType.cs @@ -0,0 +1,38 @@ +namespace DepartmentBusinessLogic.Enums +{ + /// + /// Типы аудиторий + /// + public enum ClassroomType + { + /// + /// Класс для лабораторных занятий с компьютерами + /// + Дисплейный = 0, + + /// + /// Класс для лекционных и практических занятий с проектором + /// + Лекционный = 1, + + /// + /// Класс для лекционных и практических занятий юез проектора + /// + Обычный = 2, + + /// + /// Научная лаборатория + /// + Научный = 3, + + /// + /// Преподавательская + /// + Преподавательская = 4, + + /// + /// Служебный кабинет + /// + Служебный = 5 + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IClassroomService.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IClassroomService.cs new file mode 100644 index 0000000..ee8c0e2 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/Interfaces/IClassroomService.cs @@ -0,0 +1,10 @@ +using DepartmentBusinessLogic.BindingModels; +using ModuleTools.Interfaces; + +namespace DepartmentBusinessLogic.Interfaces +{ + /// + /// Хранение аудиторий + /// + public interface IClassroomService : IGenerticEntityService { } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs new file mode 100644 index 0000000..9df76f0 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/ClassroomViewModels.cs @@ -0,0 +1,73 @@ +using DepartmentBusinessLogic.Enums; +using ModuleTools.Attributes; +using ModuleTools.Enums; +using ModuleTools.ViewModels; +using System; + +namespace DepartmentBusinessLogic.ViewModels +{ + /// + /// Список ролей + /// + public class ClassroomListViewModel : ListViewModel { } + + /// + /// Элемент ролей + /// + [ViewModelControlElementClass()] + public class ClassroomViewModel : ElementViewModel + { + [ViewModelControlListProperty("Номер", 80)] + [ViewModelControlElementProperty("Номер аудитории", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("Number")] + public string Number { get; set; } + + [ViewModelControlListProperty("Название")] + [ViewModelControlElementProperty("Название", ControlType.ControlString)] + [MapConfiguration("Title")] + public string Title { get; set; } + + [ViewModelControlElementProperty("Сотрудник", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEmployeeList, DepartmentWindowsDesktop")] + [MapConfiguration("EmployeeId")] + public Guid EmployeeId { get; set; } + + [ViewModelControlListProperty("Сотрудник")] + [MapConfiguration("Employee.LastName", IsDifficle = true)] + public string EmployeeName { get; set; } + + [ViewModelControlElementProperty("Тип", ControlType.ControlEnum, MustHaveValue = true)] + [MapConfiguration("ClassroomType")] + public ClassroomType ClassroomType { get; set; } + + [ViewModelControlListProperty("Тип", 120)] + public string ClassroomTypeTitle => ClassroomType.ToString("G"); + + [ViewModelControlListProperty("Площадь", 90)] + [ViewModelControlElementProperty("Площадь", ControlType.ControlDecimal, MustHaveValue = true)] + [MapConfiguration("Square")] + public decimal Square { get; set; } + + [ViewModelControlListProperty("Кол-во мест", 100)] + [ViewModelControlElementProperty("Кол-во мест", ControlType.ControlInt, MustHaveValue = true)] + [MapConfiguration("Capacity")] + public int Capacity { get; set; } + + [ViewModelControlElementProperty("Код безоп.", ControlType.ControlString, MustHaveValue = true)] + [MapConfiguration("SecurityCode")] + public string SecurityCode { get; set; } + + [ViewModelControlElementProperty("Есть проектор", ControlType.ControlBool, MustHaveValue = true)] + [MapConfiguration("HaveProjector")] + public bool HaveProjector { 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; } + + public override string ToString() => Number; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs index 7ea58da..502b374 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeEmployeePostViewModels.cs @@ -37,14 +37,14 @@ namespace DepartmentBusinessLogic.ViewModels [MapConfiguration("Rate")] public decimal Rate { get; set; } - [ViewModelControlElementProperty("Внутр. совм.", ControlType.ControlBool)] + [ViewModelControlElementProperty("Внутр. совм.", ControlType.ControlBool, MustHaveValue = true)] [MapConfiguration("IsInternalCombination")] public bool IsInternalCombination { get; set; } [ViewModelControlListProperty("Внутр. совм.", 80)] public string InternalCombination => IsInternalCombination ? "Да" : "Нет"; - [ViewModelControlElementProperty("Внеш. совм.", ControlType.ControlBool)] + [ViewModelControlElementProperty("Внеш. совм.", ControlType.ControlBool, MustHaveValue = true)] [MapConfiguration("IsExternalCombination")] public bool IsExternalCombination { get; set; } diff --git a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs index fe469f2..8ce886f 100644 --- a/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs +++ b/DepartmentPortal/Department/DepartmentBusinessLogic/ViewModels/EmployeeViewModels.cs @@ -17,6 +17,8 @@ namespace DepartmentBusinessLogic.ViewModels [ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 700)] [ViewModelControlElementDependenceEntity(Title = "Должности", Order = 1, ParentPropertyName = "EmployeeId", ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEmployeeEmployeePostList, DepartmentWindowsDesktop")] + [ViewModelControlElementDependenceEntity(Title = "Аудитории", Order = 1, ParentPropertyName = "EmployeeId", + ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlClassroomList, DepartmentWindowsDesktop")] public class EmployeeViewModel : ElementViewModel { [ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")] diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs index 6455c6f..72110f7 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/DepartmentImplementationExtensions.cs @@ -12,6 +12,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/ClassroomService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/ClassroomService.cs new file mode 100644 index 0000000..eb3adb1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/ClassroomService.cs @@ -0,0 +1,138 @@ +using DatabaseCore; +using DatabaseCore.Models.Department; +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.Enums; +using DepartmentBusinessLogic.Interfaces; +using DepartmentBusinessLogic.ViewModels; +using Microsoft.EntityFrameworkCore; +using ModuleTools.BusinessLogics; +using ModuleTools.Enums; +using ModuleTools.Models; +using System; +using System.Linq; + +namespace DepartmentDatabaseImplementation.Implementations +{ + /// + /// Реализация интерфейса IClassroomService + /// + public class ClassroomService : IClassroomService + { + public OperationResultModel Create(ClassroomSetBindingModel model) + { + using var context = DatabaseManager.GetContext; + + var exsistEntity = context.Classrooms.FirstOrDefault(x => x.Number == model.Number); + if (exsistEntity == null) + { + var entity = Mapper.MapToClass(model, true); + context.Classrooms.Add(entity); + context.SaveChanges(); + return OperationResultModel.Success(Mapper.MapToClass(entity, true)); + } + else + { + if (exsistEntity.IsDeleted) + { + exsistEntity = Mapper.MapToClass(model, exsistEntity, true); + exsistEntity.IsDeleted = false; + context.SaveChanges(); + return OperationResultModel.Success(Mapper.MapToClass(exsistEntity, true)); + } + else + { + return OperationResultModel.Error("Error:", "Элемент уже существует", ResultServiceStatusCode.ExsistItem); + } + } + } + + public OperationResultModel Delete(ClassroomGetBindingModel model) + { + using var context = DatabaseManager.GetContext; + + var entity = context.Classrooms.FirstOrDefault(x => x.Id == model.Id); + if (entity == null) + { + return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound); + } + else if (entity.IsDeleted) + { + return OperationResultModel.Error("Error:", "Элемент был удален", ResultServiceStatusCode.WasDelete); + } + entity.IsDeleted = true; + entity.DateDelete = DateTime.Now; + + context.SaveChanges(); + + return OperationResultModel.Success(true); + } + + public OperationResultModel Read(ClassroomGetBindingModel model) + { + int countPages = 0; + using var context = DatabaseManager.GetContext; + + // для одной записи + if (model.Id.HasValue) + { + var entity = context.Classrooms.FirstOrDefault(x => x.Id == model.Id.Value); + if (entity == null) + { + return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound); + } + return OperationResultModel.Success(Mapper.MapToClass(entity, model.HaveRight)); + } + + var query = context.Classrooms.Where(x => !x.IsDeleted).AsQueryable(); + if (model.UseInSchedule.HasValue) + { + query = query.Where(x => x.ClassroomType == (int)ClassroomType.Дисплейный || x.ClassroomType == (int)ClassroomType.Лекционный || + x.ClassroomType == (int)ClassroomType.Обычный); + } + if (model.EmployeeId.HasValue) + { + query = query.Where(x => x.EmployeeId == model.EmployeeId.Value); + } + + query = query.OrderBy(x => x.Number); + + if (model.PageNumber.HasValue && model.PageSize.HasValue) + { + countPages = (int)Math.Ceiling((double)query.Count() / model.PageSize.Value); + query = query + .Skip(model.PageSize.Value * model.PageNumber.Value) + .Take(model.PageSize.Value); + } + + query = query.Include(x => x.Employee); + + var result = new ClassroomListViewModel + { + MaxCount = countPages, + List = query.Select(x => Mapper.MapToClass(x, model.HaveRight)).ToList() + }; + + return OperationResultModel.Success(result); + } + + public OperationResultModel Update(ClassroomSetBindingModel model) + { + using var context = DatabaseManager.GetContext; + + var entity = context.Classrooms.FirstOrDefault(x => x.Id == model.Id); + if (entity == null) + { + return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound); + } + else if (entity.IsDeleted) + { + return OperationResultModel.Error("Error:", "Элемент был удален", ResultServiceStatusCode.WasDelete); + } + entity = Mapper.MapToClass(model, entity, true); + + context.SaveChanges(); + + return OperationResultModel.Success(Mapper.MapToClass(entity, true)); + } + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/EmployeeService.cs b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/EmployeeService.cs index 6c78441..ef9a1a7 100644 --- a/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/EmployeeService.cs +++ b/DepartmentPortal/Department/DepartmentDatabaseImplementation.csproj/Implementations/EmployeeService.cs @@ -60,6 +60,11 @@ namespace DepartmentDatabaseImplementation.Implementations { return OperationResultModel.Error("Error:", "Элемент был удален", ResultServiceStatusCode.WasDelete); } + var classrooms = context.Classrooms.Where(x => x.EmployeeId == model.Id); + if (classrooms.Any()) + { + return OperationResultModel.Error("Error:", "Есть аудитории, у которых этот сотрудник указан ответственным", ResultServiceStatusCode.ExsistItem); + } entity.IsDeleted = true; entity.DateDelete = DateTime.Now; diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs index 94fc22a..6060c1f 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/DepartmentWindowDesktopExtension.cs @@ -33,7 +33,8 @@ namespace DepartmentWindowsDesktop List _controls = new() { new ControlEmployeePostList(), - new ControlEmployeeList() + new ControlEmployeeList(), + new ControlClassroomList() }; foreach (var cntrl in _controls) diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.Designer.cs new file mode 100644 index 0000000..b8b0901 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlClassroomElement + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + 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/ControlClassroomElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.cs new file mode 100644 index 0000000..a3e9de7 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.cs @@ -0,0 +1,27 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.BusinessLogics; +using DepartmentBusinessLogic.ViewModels; +using DesktopTools.Controls; +using DesktopTools.Interfaces; +using System; + +namespace DepartmentWindowsDesktop.EntityControls +{ + /// + /// Реализация контрола для аудитории + /// + public partial class ControlClassroomElement : + GenericControlEntityElement, + IGenericControlEntityElement + { + public ControlClassroomElement() + { + InitializeComponent(); + Title = "Сотрудник"; + ControlId = new Guid("b5d7c662-ee62-4f46-b58e-e6859c69a546"); + _genericControlViewEntityElement = this; + } + + public IControl GetInstanceGenericControl() => new ControlClassroomElement() { ControlId = Guid.NewGuid() }; + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomElement.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/ControlClassroomList.Designer.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.Designer.cs new file mode 100644 index 0000000..ffc92e8 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.Designer.cs @@ -0,0 +1,33 @@ + +namespace DepartmentWindowsDesktop.EntityControls +{ + partial class ControlClassroomList + { + /// + /// Освободить все используемые ресурсы. + /// + /// истинно, если управляемый ресурс должен быть удален; иначе ложно. + 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/ControlClassroomList.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.cs new file mode 100644 index 0000000..f1d2016 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.cs @@ -0,0 +1,47 @@ +using DepartmentBusinessLogic.BindingModels; +using DepartmentBusinessLogic.BusinessLogics; +using DepartmentBusinessLogic.ViewModels; +using DesktopTools.Controls; +using DesktopTools.Enums; +using DesktopTools.Interfaces; +using DesktopTools.Models; +using ModuleTools.Enums; +using System; +using System.Collections.Generic; + +namespace DepartmentWindowsDesktop.EntityControls +{ + public partial class ControlClassroomList : + GenericControlEntityList, + IGenericControlEntityList + { + public ControlClassroomList() + { + InitializeComponent(); + Title = "Аудитории"; + ControlId = new Guid("bfff31bc-1d23-4ba9-9464-a89a113d7286"); + AccessOperation = AccessOperation.Аудитории; + ControlViewEntityElement = new ControlClassroomElement(); + _genericControlViewEntityList = this; + } + + public IControl GetInstanceGenericControl() => new ControlClassroomList() { ControlId = Guid.NewGuid() }; + + public ControlViewEntityListConfiguration GetConfigControl() => new() + { + PaginationOn = false, + HideToolStripButton = new List + { + ToolStripButtonListNames.toolStripButtonSearch + } + }; + + public ClassroomListViewModel GetDataForControl() => _businessLogic.GetList(new ClassroomGetBindingModel()); + + public ClassroomListViewModel GetDataFromParentForControl(Guid id) => _businessLogic.GetList(new ClassroomGetBindingModel { EmployeeId = id }); + + public ClassroomListViewModel GetDataWithPageNameForControl(string key) => throw new NotImplementedException(); + + public ClassroomListViewModel GetDataWithPageNumberForControl(int page, int count) => throw new NotImplementedException(); + } +} \ No newline at end of file diff --git a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.resx b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.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/Employee/ControlEmployeeElement.cs b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Employee/ControlEmployeeElement.cs index 7ce71f4..ac34b61 100644 --- a/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Employee/ControlEmployeeElement.cs +++ b/DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/Employee/ControlEmployeeElement.cs @@ -7,6 +7,9 @@ using System; namespace DepartmentWindowsDesktop.EntityControls { + /// + /// Реализация контрола для сотрудника + /// public partial class ControlEmployeeElement : GenericControlEntityElement, IGenericControlEntityElement