Сотрудник
This commit is contained in:
parent
f9f88d7098
commit
6368698bff
@ -35,6 +35,8 @@ namespace DatabaseCore
|
||||
modelBuilder.Entity<EmployeePost>().HasIndex(s => s.EmployeePostName).IsUnique();
|
||||
|
||||
modelBuilder.Entity<Employee>().HasIndex(p => new { p.FirstName, p.LastName, p.Patronymic }).IsUnique();
|
||||
|
||||
modelBuilder.Entity<Classroom>().HasIndex(p => new { p.Number }).IsUnique();
|
||||
}
|
||||
|
||||
#region Security
|
||||
@ -49,6 +51,7 @@ namespace DatabaseCore
|
||||
public virtual DbSet<EmployeePost> EmployeePosts { set; get; }
|
||||
public virtual DbSet<Employee> Employees { set; get; }
|
||||
public virtual DbSet<EmployeeEmployeePost> EmployeeEmployeePosts { set; get; }
|
||||
public virtual DbSet<Classroom> Classrooms { set; get; }
|
||||
#endregion
|
||||
}
|
||||
}
|
445
DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.Designer.cs
generated
Normal file
445
DepartmentPortal/Common/DatabaseCore/Migrations/20210403090025_AddClassrooms.Designer.cs
generated
Normal file
@ -0,0 +1,445 @@
|
||||
// <auto-generated />
|
||||
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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("Capacity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClassroomType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid>("EmployeeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("HaveProjector")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<byte[]>("Photo")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<string>("SecurityCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Square")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Address")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<DateTime>("DateBirth")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Email")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("FirstName")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("GroupElectricalSafety")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("HomeNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("LastName")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("MobileNumber")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Patronymic")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<byte[]>("Photo")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<Guid>("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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<Guid>("EmployeeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("EmployeePostId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsExternalCombination")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsInternalCombination")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<decimal>("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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("EmployeePostName")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("AccessOperation")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("AccessType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("RoleId");
|
||||
|
||||
b.ToTable("Accesses");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseCore.Models.Security.EnviromentSetting", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Key")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("Value")
|
||||
.IsRequired()
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("Key")
|
||||
.IsUnique();
|
||||
|
||||
b.ToTable("EnviromentSettings");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("RoleName")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<int>("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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<byte[]>("Avatar")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<int>("CountAttempt")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime?>("DateBanned")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateLastVisit")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsBanned")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("PasswordHash")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("UserName")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("UserName");
|
||||
|
||||
b.ToTable("Users");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<Guid>("RoleId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<Guid>("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
|
||||
}
|
||||
}
|
||||
}
|
@ -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<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
Number = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
||||
Title = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
EmployeeId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
|
||||
ClassroomType = table.Column<int>(type: "int", nullable: false),
|
||||
Square = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
|
||||
Capacity = table.Column<int>(type: "int", nullable: false),
|
||||
SecurityCode = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
HaveProjector = table.Column<bool>(type: "bit", nullable: false),
|
||||
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Photo = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
|
||||
DateCreate = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
DateDelete = table.Column<DateTime>(type: "datetime2", nullable: true),
|
||||
IsDeleted = table.Column<bool>(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");
|
||||
}
|
||||
}
|
||||
}
|
@ -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<Guid>("Id")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<int>("Capacity")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<int>("ClassroomType")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<DateTime>("DateCreate")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime?>("DateDelete")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<Guid>("EmployeeId")
|
||||
.HasColumnType("uniqueidentifier");
|
||||
|
||||
b.Property<bool>("HaveProjector")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<bool>("IsDeleted")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<string>("Number")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<byte[]>("Photo")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<string>("SecurityCode")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<decimal>("Square")
|
||||
.HasColumnType("decimal(18,2)");
|
||||
|
||||
b.Property<string>("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<Guid>("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");
|
||||
});
|
||||
|
||||
|
@ -0,0 +1,73 @@
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.Interfaces;
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace DatabaseCore.Models.Department
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс, описывающий аудиторию в системе
|
||||
/// </summary>
|
||||
[DataContract]
|
||||
[EntityDescription("Classroom", "Аудитрия кафедры")]
|
||||
public class Classroom : BaseEntity, IEntitySecurityExtenstion<Classroom>
|
||||
{
|
||||
[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;
|
||||
}
|
||||
}
|
||||
}
|
@ -69,6 +69,9 @@ namespace DatabaseCore.Models.Department
|
||||
[ForeignKey("EmployeeId")]
|
||||
public virtual List<EmployeeEmployeePost> EmployeeEmployeePosts { get; set; }
|
||||
|
||||
[ForeignKey("EmployeeId")]
|
||||
public virtual List<Classroom> Classrooms { get; set; }
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
||||
public Employee SecurityCheck(Employee entity, bool allowFullData)
|
||||
|
@ -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);
|
||||
|
@ -12,6 +12,6 @@ namespace ModuleTools.BindingModels
|
||||
/// Идентификатор записи
|
||||
/// </summary>
|
||||
[MapConfiguration("Id")]
|
||||
public Guid Id { get; set; }
|
||||
public Guid Id { get; set; } = Guid.NewGuid();
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@
|
||||
|
||||
Сотрудники = 101,
|
||||
|
||||
Аудитории = 101,
|
||||
Аудитории = 102,
|
||||
|
||||
Направления = 102,
|
||||
|
||||
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Используется для вывода в расписании
|
||||
/// </summary>
|
||||
public bool? UseInSchedule { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Вывод аудиторий, закрепленных за сотрудником
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using DepartmentBusinessLogic.Interfaces;
|
||||
using DepartmentBusinessLogic.ViewModels;
|
||||
using ModuleTools.BusinessLogics;
|
||||
using ModuleTools.Enums;
|
||||
|
||||
namespace DepartmentBusinessLogic.BusinessLogics
|
||||
{
|
||||
/// <summary>
|
||||
/// Логика работы с аудиториями
|
||||
/// </summary>
|
||||
public class ClassroomBusinessLogic : GenericBusinessLogic<ClassroomGetBindingModel, ClassroomSetBindingModel, ClassroomListViewModel, ClassroomViewModel>
|
||||
{
|
||||
public ClassroomBusinessLogic(IClassroomService service) : base(service, "Аудитории", AccessOperation.Аудитории) { }
|
||||
}
|
||||
}
|
@ -8,10 +8,6 @@
|
||||
<ProjectReference Include="..\..\Common\ModuleTools\ModuleTools.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Enums\" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||
</Target>
|
||||
|
@ -0,0 +1,38 @@
|
||||
namespace DepartmentBusinessLogic.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Типы аудиторий
|
||||
/// </summary>
|
||||
public enum ClassroomType
|
||||
{
|
||||
/// <summary>
|
||||
/// Класс для лабораторных занятий с компьютерами
|
||||
/// </summary>
|
||||
Дисплейный = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Класс для лекционных и практических занятий с проектором
|
||||
/// </summary>
|
||||
Лекционный = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Класс для лекционных и практических занятий юез проектора
|
||||
/// </summary>
|
||||
Обычный = 2,
|
||||
|
||||
/// <summary>
|
||||
/// Научная лаборатория
|
||||
/// </summary>
|
||||
Научный = 3,
|
||||
|
||||
/// <summary>
|
||||
/// Преподавательская
|
||||
/// </summary>
|
||||
Преподавательская = 4,
|
||||
|
||||
/// <summary>
|
||||
/// Служебный кабинет
|
||||
/// </summary>
|
||||
Служебный = 5
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using ModuleTools.Interfaces;
|
||||
|
||||
namespace DepartmentBusinessLogic.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Хранение аудиторий
|
||||
/// </summary>
|
||||
public interface IClassroomService : IGenerticEntityService<ClassroomGetBindingModel, ClassroomSetBindingModel> { }
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
using DepartmentBusinessLogic.Enums;
|
||||
using ModuleTools.Attributes;
|
||||
using ModuleTools.Enums;
|
||||
using ModuleTools.ViewModels;
|
||||
using System;
|
||||
|
||||
namespace DepartmentBusinessLogic.ViewModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Список ролей
|
||||
/// </summary>
|
||||
public class ClassroomListViewModel : ListViewModel<ClassroomViewModel> { }
|
||||
|
||||
/// <summary>
|
||||
/// Элемент ролей
|
||||
/// </summary>
|
||||
[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;
|
||||
}
|
||||
}
|
@ -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; }
|
||||
|
||||
|
@ -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")]
|
||||
|
@ -12,6 +12,9 @@ namespace DepartmentDatabaseImplementation
|
||||
DependencyManager.Instance.RegisterType<IEmployeePostService, EmployeePostService>();
|
||||
DependencyManager.Instance.RegisterType<IEmployeeService, EmployeeService>();
|
||||
DependencyManager.Instance.RegisterType<IEmployeeEmployeePostService, EmployeeEmployeePostService>();
|
||||
|
||||
|
||||
DependencyManager.Instance.RegisterType<IClassroomService, ClassroomService>();
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// Реализация интерфейса IClassroomService
|
||||
/// </summary>
|
||||
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<ClassroomSetBindingModel, Classroom>(model, true);
|
||||
context.Classrooms.Add(entity);
|
||||
context.SaveChanges();
|
||||
return OperationResultModel.Success(Mapper.MapToClass<Classroom, ClassroomViewModel>(entity, true));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (exsistEntity.IsDeleted)
|
||||
{
|
||||
exsistEntity = Mapper.MapToClass(model, exsistEntity, true);
|
||||
exsistEntity.IsDeleted = false;
|
||||
context.SaveChanges();
|
||||
return OperationResultModel.Success(Mapper.MapToClass<Classroom, ClassroomViewModel>(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<Classroom, ClassroomViewModel>(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<Classroom, ClassroomViewModel>(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<Classroom, ClassroomViewModel>(entity, true));
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
|
||||
|
@ -33,7 +33,8 @@ namespace DepartmentWindowsDesktop
|
||||
List<IControl> _controls = new()
|
||||
{
|
||||
new ControlEmployeePostList(),
|
||||
new ControlEmployeeList()
|
||||
new ControlEmployeeList(),
|
||||
new ControlClassroomList()
|
||||
};
|
||||
|
||||
foreach (var cntrl in _controls)
|
||||
|
@ -0,0 +1,33 @@
|
||||
|
||||
namespace DepartmentWindowsDesktop.EntityControls
|
||||
{
|
||||
partial class ControlClassroomElement
|
||||
{
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
using DepartmentBusinessLogic.BindingModels;
|
||||
using DepartmentBusinessLogic.BusinessLogics;
|
||||
using DepartmentBusinessLogic.ViewModels;
|
||||
using DesktopTools.Controls;
|
||||
using DesktopTools.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace DepartmentWindowsDesktop.EntityControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Реализация контрола для аудитории
|
||||
/// </summary>
|
||||
public partial class ControlClassroomElement :
|
||||
GenericControlEntityElement<ClassroomGetBindingModel, ClassroomSetBindingModel, ClassroomListViewModel, ClassroomViewModel, ClassroomBusinessLogic>,
|
||||
IGenericControlEntityElement
|
||||
{
|
||||
public ControlClassroomElement()
|
||||
{
|
||||
InitializeComponent();
|
||||
Title = "Сотрудник";
|
||||
ControlId = new Guid("b5d7c662-ee62-4f46-b58e-e6859c69a546");
|
||||
_genericControlViewEntityElement = this;
|
||||
}
|
||||
|
||||
public IControl GetInstanceGenericControl() => new ControlClassroomElement() { ControlId = Guid.NewGuid() };
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
33
DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.Designer.cs
generated
Normal file
33
DepartmentPortal/Department/DepartmentWindowsDesktop/EntityControls/ControlClassroomList.Designer.cs
generated
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
namespace DepartmentWindowsDesktop.EntityControls
|
||||
{
|
||||
partial class ControlClassroomList
|
||||
{
|
||||
/// <summary>
|
||||
/// Освободить все используемые ресурсы.
|
||||
/// </summary>
|
||||
/// <param name="disposing">истинно, если управляемый ресурс должен быть удален; иначе ложно.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Код, автоматически созданный конструктором компонентов
|
||||
|
||||
/// <summary>
|
||||
/// Требуемый метод для поддержки конструктора — не изменяйте
|
||||
/// содержимое этого метода с помощью редактора кода.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -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<ClassroomGetBindingModel, ClassroomSetBindingModel, ClassroomListViewModel, ClassroomViewModel, ClassroomBusinessLogic>,
|
||||
IGenericControlEntityList<ClassroomListViewModel, ClassroomViewModel>
|
||||
{
|
||||
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>
|
||||
{
|
||||
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();
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
@ -7,6 +7,9 @@ using System;
|
||||
|
||||
namespace DepartmentWindowsDesktop.EntityControls
|
||||
{
|
||||
/// <summary>
|
||||
/// Реализация контрола для сотрудника
|
||||
/// </summary>
|
||||
public partial class ControlEmployeeElement :
|
||||
GenericControlEntityElement<EmployeeGetBindingModel, EmployeeSetBindingModel, EmployeeListViewModel, EmployeeViewModel, EmployeeBusinessLogic>,
|
||||
IGenericControlEntityElement
|
||||
|
Loading…
Reference in New Issue
Block a user