преподаватели (без реализации)

This commit is contained in:
kotcheshir73 2021-04-03 22:04:11 +04:00
parent 985c119bb9
commit 054ad31744
35 changed files with 2300 additions and 13 deletions

View File

@ -41,6 +41,14 @@ namespace DatabaseCore
modelBuilder.Entity<DisciplineBlock>().HasIndex(p => new { p.Title }).IsUnique();
modelBuilder.Entity<Discipline>().HasIndex(p => new { p.DisciplineName }).IsUnique();
modelBuilder.Entity<LecturerAcademicDegree>().HasIndex(p => new { p.LecturerAcademicDegreeName }).IsUnique();
modelBuilder.Entity<LecturerAcademicRank>().HasIndex(p => new { p.LecturerAcademicRankName }).IsUnique();
modelBuilder.Entity<LecturerPost>().HasIndex(p => new { p.LecturerPostName }).IsUnique();
modelBuilder.Entity<Lecturer>().HasIndex(p => new { p.FirstName, p.LastName, p.Patronymic }).IsUnique();
}
#region Security
@ -58,6 +66,11 @@ namespace DatabaseCore
public virtual DbSet<Classroom> Classrooms { set; get; }
public virtual DbSet<DisciplineBlock> DisciplineBlocks { set; get; }
public virtual DbSet<Discipline> Disciplines { set; get; }
public virtual DbSet<LecturerAcademicDegree> LecturerAcademicDegrees { set; get; }
public virtual DbSet<LecturerAcademicRank> LecturerAcademicRanks { set; get; }
public virtual DbSet<LecturerEmployeePost> LecturerEmployeePosts { set; get; }
public virtual DbSet<LecturerPost> LecturerPosts { set; get; }
public virtual DbSet<Lecturer> Lecturers { set; get; }
#endregion
}
}

View File

@ -0,0 +1,829 @@
// <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("20210403180333_AddLecturers")]
partial class AddLecturers
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.4")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("DatabaseCore.Models.Department.Classroom", b =>
{
b.Property<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.Discipline", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
b.Property<Guid>("DisciplineBlockId")
.HasColumnType("uniqueidentifier");
b.Property<string>("DisciplineBlueAsteriskName")
.HasColumnType("nvarchar(max)");
b.Property<string>("DisciplineName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<string>("DisciplineShortName")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.HasKey("Id");
b.HasIndex("DisciplineBlockId");
b.HasIndex("DisciplineName")
.IsUnique();
b.ToTable("Disciplines");
});
modelBuilder.Entity("DatabaseCore.Models.Department.DisciplineBlock", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
b.Property<string>("DisciplineBlockBlueAsteriskName")
.HasColumnType("nvarchar(max)");
b.Property<int>("DisciplineBlockOrder")
.HasColumnType("int");
b.Property<bool>("DisciplineBlockUseForGrouping")
.HasColumnType("bit");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.HasKey("Id");
b.HasIndex("Title")
.IsUnique();
b.ToTable("DisciplineBlocks");
});
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("UserId");
b.HasIndex("FirstName", "LastName", "Patronymic")
.IsUnique()
.HasFilter("[FirstName] IS NOT NULL AND [LastName] IS NOT NULL AND [Patronymic] IS NOT NULL");
b.ToTable("Employees");
});
modelBuilder.Entity("DatabaseCore.Models.Department.EmployeeEmployeePost", b =>
{
b.Property<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.Department.Lecturer", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Address")
.IsRequired()
.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")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.IsRequired()
.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")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<Guid?>("LecturerAcademicDegreeId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("LecturerAcademicRankId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LecturerPostId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("LecturerPostRate")
.HasColumnType("decimal(18,2)");
b.Property<string>("MobileNumber")
.IsRequired()
.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("LecturerAcademicDegreeId");
b.HasIndex("LecturerAcademicRankId");
b.HasIndex("LecturerPostId");
b.HasIndex("UserId");
b.HasIndex("FirstName", "LastName", "Patronymic")
.IsUnique()
.HasFilter("[Patronymic] IS NOT NULL");
b.ToTable("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicDegree", b =>
{
b.Property<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>("LecturerAcademicDegreeName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LecturerAcademicDegreeName")
.IsUnique();
b.ToTable("LecturerAcademicDegrees");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicRank", 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>("LecturerAcademicRankName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LecturerAcademicRankName")
.IsUnique();
b.ToTable("LecturerAcademicRanks");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerEmployeePost", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
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<Guid>("LecturerId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("Rate")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("EmployeePostId");
b.HasIndex("LecturerId");
b.ToTable("LecturerEmployeePosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
b.Property<int>("Hours")
.HasColumnType("int");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LecturerPostName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LecturerPostName")
.IsUnique();
b.ToTable("LecturerPosts");
});
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")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("RolePriority")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("RoleName")
.IsUnique();
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")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("UserName")
.IsRequired()
.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.Discipline", b =>
{
b.HasOne("DatabaseCore.Models.Department.DisciplineBlock", "DisciplineBlock")
.WithMany("Disciplines")
.HasForeignKey("DisciplineBlockId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("DisciplineBlock");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b =>
{
b.HasOne("DatabaseCore.Models.Security.User", "User")
.WithMany("Employees")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("DatabaseCore.Models.Department.EmployeeEmployeePost", b =>
{
b.HasOne("DatabaseCore.Models.Department.Employee", "Employee")
.WithMany("EmployeeEmployeePosts")
.HasForeignKey("EmployeeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseCore.Models.Department.EmployeePost", "EmployeePost")
.WithMany("EmployeeEmployeePosts")
.HasForeignKey("EmployeePostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Employee");
b.Navigation("EmployeePost");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b =>
{
b.HasOne("DatabaseCore.Models.Department.LecturerAcademicDegree", "LecturerAcademicDegree")
.WithMany("Lecturers")
.HasForeignKey("LecturerAcademicDegreeId");
b.HasOne("DatabaseCore.Models.Department.LecturerAcademicRank", "LecturerAcademicRank")
.WithMany("Lecturers")
.HasForeignKey("LecturerAcademicRankId");
b.HasOne("DatabaseCore.Models.Department.LecturerPost", "LecturerPost")
.WithMany("Lecturers")
.HasForeignKey("LecturerPostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseCore.Models.Security.User", "User")
.WithMany("Lecturers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LecturerAcademicDegree");
b.Navigation("LecturerAcademicRank");
b.Navigation("LecturerPost");
b.Navigation("User");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerEmployeePost", b =>
{
b.HasOne("DatabaseCore.Models.Department.EmployeePost", "EmployeePost")
.WithMany()
.HasForeignKey("EmployeePostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer")
.WithMany()
.HasForeignKey("LecturerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EmployeePost");
b.Navigation("Lecturer");
});
modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
{
b.HasOne("DatabaseCore.Models.Security.Role", "Role")
.WithMany("Access")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
});
modelBuilder.Entity("DatabaseCore.Models.Security.UserRole", b =>
{
b.HasOne("DatabaseCore.Models.Security.Role", "Role")
.WithMany("UserRoles")
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseCore.Models.Security.User", "User")
.WithMany("UserRoles")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Role");
b.Navigation("User");
});
modelBuilder.Entity("DatabaseCore.Models.Department.DisciplineBlock", b =>
{
b.Navigation("Disciplines");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b =>
{
b.Navigation("Classrooms");
b.Navigation("EmployeeEmployeePosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.EmployeePost", b =>
{
b.Navigation("EmployeeEmployeePosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicDegree", b =>
{
b.Navigation("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicRank", b =>
{
b.Navigation("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", b =>
{
b.Navigation("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
{
b.Navigation("Access");
b.Navigation("UserRoles");
});
modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
{
b.Navigation("Employees");
b.Navigation("Lecturers");
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,239 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace DatabaseCore.Migrations
{
public partial class AddLecturers : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "LecturerAcademicDegrees",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LecturerAcademicDegreeName = table.Column<string>(type: "nvarchar(450)", nullable: false),
Order = table.Column<int>(type: "int", nullable: false),
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_LecturerAcademicDegrees", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LecturerAcademicRanks",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LecturerAcademicRankName = table.Column<string>(type: "nvarchar(450)", nullable: false),
Order = table.Column<int>(type: "int", nullable: false),
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_LecturerAcademicRanks", x => x.Id);
});
migrationBuilder.CreateTable(
name: "LecturerPosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LecturerPostName = table.Column<string>(type: "nvarchar(450)", nullable: false),
Hours = table.Column<int>(type: "int", nullable: false),
Order = table.Column<int>(type: "int", nullable: false),
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_LecturerPosts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "Lecturers",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
UserId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LecturerPostId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LecturerPostRate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
LecturerAcademicRankId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LecturerAcademicDegreeId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
LastName = table.Column<string>(type: "nvarchar(450)", nullable: false),
FirstName = table.Column<string>(type: "nvarchar(450)", nullable: false),
Patronymic = table.Column<string>(type: "nvarchar(450)", nullable: true),
DateBirth = table.Column<DateTime>(type: "datetime2", nullable: false),
Address = table.Column<string>(type: "nvarchar(max)", nullable: false),
Email = table.Column<string>(type: "nvarchar(max)", nullable: false),
MobileNumber = table.Column<string>(type: "nvarchar(max)", nullable: false),
HomeNumber = table.Column<string>(type: "nvarchar(max)", nullable: true),
Description = table.Column<string>(type: "nvarchar(max)", nullable: true),
Photo = table.Column<byte[]>(type: "varbinary(max)", nullable: true),
GroupElectricalSafety = table.Column<string>(type: "nvarchar(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_Lecturers", x => x.Id);
table.ForeignKey(
name: "FK_Lecturers_LecturerAcademicDegrees_LecturerAcademicDegreeId",
column: x => x.LecturerAcademicDegreeId,
principalTable: "LecturerAcademicDegrees",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Lecturers_LecturerAcademicRanks_LecturerAcademicRankId",
column: x => x.LecturerAcademicRankId,
principalTable: "LecturerAcademicRanks",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
table.ForeignKey(
name: "FK_Lecturers_LecturerPosts_LecturerPostId",
column: x => x.LecturerPostId,
principalTable: "LecturerPosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_Lecturers_Users_UserId",
column: x => x.UserId,
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateTable(
name: "LecturerEmployeePosts",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LecturerId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
EmployeePostId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Rate = table.Column<decimal>(type: "decimal(18,2)", nullable: false),
IsInternalCombination = table.Column<bool>(type: "bit", nullable: false),
IsExternalCombination = table.Column<bool>(type: "bit", nullable: false),
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_LecturerEmployeePosts", x => x.Id);
table.ForeignKey(
name: "FK_LecturerEmployeePosts_EmployeePosts_EmployeePostId",
column: x => x.EmployeePostId,
principalTable: "EmployeePosts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_LecturerEmployeePosts_Lecturers_LecturerId",
column: x => x.LecturerId,
principalTable: "Lecturers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Employees_UserId",
table: "Employees",
column: "UserId");
migrationBuilder.CreateIndex(
name: "IX_LecturerAcademicDegrees_LecturerAcademicDegreeName",
table: "LecturerAcademicDegrees",
column: "LecturerAcademicDegreeName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LecturerAcademicRanks_LecturerAcademicRankName",
table: "LecturerAcademicRanks",
column: "LecturerAcademicRankName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_LecturerEmployeePosts_EmployeePostId",
table: "LecturerEmployeePosts",
column: "EmployeePostId");
migrationBuilder.CreateIndex(
name: "IX_LecturerEmployeePosts_LecturerId",
table: "LecturerEmployeePosts",
column: "LecturerId");
migrationBuilder.CreateIndex(
name: "IX_LecturerPosts_LecturerPostName",
table: "LecturerPosts",
column: "LecturerPostName",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_Lecturers_FirstName_LastName_Patronymic",
table: "Lecturers",
columns: new[] { "FirstName", "LastName", "Patronymic" },
unique: true,
filter: "[Patronymic] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_Lecturers_LecturerAcademicDegreeId",
table: "Lecturers",
column: "LecturerAcademicDegreeId");
migrationBuilder.CreateIndex(
name: "IX_Lecturers_LecturerAcademicRankId",
table: "Lecturers",
column: "LecturerAcademicRankId");
migrationBuilder.CreateIndex(
name: "IX_Lecturers_LecturerPostId",
table: "Lecturers",
column: "LecturerPostId");
migrationBuilder.CreateIndex(
name: "IX_Lecturers_UserId",
table: "Lecturers",
column: "UserId");
migrationBuilder.AddForeignKey(
name: "FK_Employees_Users_UserId",
table: "Employees",
column: "UserId",
principalTable: "Users",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Employees_Users_UserId",
table: "Employees");
migrationBuilder.DropTable(
name: "LecturerEmployeePosts");
migrationBuilder.DropTable(
name: "Lecturers");
migrationBuilder.DropTable(
name: "LecturerAcademicDegrees");
migrationBuilder.DropTable(
name: "LecturerAcademicRanks");
migrationBuilder.DropTable(
name: "LecturerPosts");
migrationBuilder.DropIndex(
name: "IX_Employees_UserId",
table: "Employees");
}
}
}

View File

@ -198,6 +198,8 @@ namespace DatabaseCore.Migrations
b.HasKey("Id");
b.HasIndex("UserId");
b.HasIndex("FirstName", "LastName", "Patronymic")
.IsUnique()
.HasFilter("[FirstName] IS NOT NULL AND [LastName] IS NOT NULL AND [Patronymic] IS NOT NULL");
@ -272,6 +274,218 @@ namespace DatabaseCore.Migrations
b.ToTable("EmployeePosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Address")
.IsRequired()
.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")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("FirstName")
.IsRequired()
.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")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<Guid?>("LecturerAcademicDegreeId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("LecturerAcademicRankId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("LecturerPostId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("LecturerPostRate")
.HasColumnType("decimal(18,2)");
b.Property<string>("MobileNumber")
.IsRequired()
.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("LecturerAcademicDegreeId");
b.HasIndex("LecturerAcademicRankId");
b.HasIndex("LecturerPostId");
b.HasIndex("UserId");
b.HasIndex("FirstName", "LastName", "Patronymic")
.IsUnique()
.HasFilter("[Patronymic] IS NOT NULL");
b.ToTable("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicDegree", b =>
{
b.Property<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>("LecturerAcademicDegreeName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LecturerAcademicDegreeName")
.IsUnique();
b.ToTable("LecturerAcademicDegrees");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicRank", 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>("LecturerAcademicRankName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LecturerAcademicRankName")
.IsUnique();
b.ToTable("LecturerAcademicRanks");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerEmployeePost", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
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<Guid>("LecturerId")
.HasColumnType("uniqueidentifier");
b.Property<decimal>("Rate")
.HasColumnType("decimal(18,2)");
b.HasKey("Id");
b.HasIndex("EmployeePostId");
b.HasIndex("LecturerId");
b.ToTable("LecturerEmployeePosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
b.Property<int>("Hours")
.HasColumnType("int");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<string>("LecturerPostName")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("Order")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("LecturerPostName")
.IsUnique();
b.ToTable("LecturerPosts");
});
modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
{
b.Property<Guid>("Id")
@ -450,6 +664,17 @@ namespace DatabaseCore.Migrations
b.Navigation("DisciplineBlock");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Employee", b =>
{
b.HasOne("DatabaseCore.Models.Security.User", "User")
.WithMany("Employees")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("DatabaseCore.Models.Department.EmployeeEmployeePost", b =>
{
b.HasOne("DatabaseCore.Models.Department.Employee", "Employee")
@ -469,6 +694,56 @@ namespace DatabaseCore.Migrations
b.Navigation("EmployeePost");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Lecturer", b =>
{
b.HasOne("DatabaseCore.Models.Department.LecturerAcademicDegree", "LecturerAcademicDegree")
.WithMany("Lecturers")
.HasForeignKey("LecturerAcademicDegreeId");
b.HasOne("DatabaseCore.Models.Department.LecturerAcademicRank", "LecturerAcademicRank")
.WithMany("Lecturers")
.HasForeignKey("LecturerAcademicRankId");
b.HasOne("DatabaseCore.Models.Department.LecturerPost", "LecturerPost")
.WithMany("Lecturers")
.HasForeignKey("LecturerPostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseCore.Models.Security.User", "User")
.WithMany("Lecturers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LecturerAcademicDegree");
b.Navigation("LecturerAcademicRank");
b.Navigation("LecturerPost");
b.Navigation("User");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerEmployeePost", b =>
{
b.HasOne("DatabaseCore.Models.Department.EmployeePost", "EmployeePost")
.WithMany()
.HasForeignKey("EmployeePostId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseCore.Models.Department.Lecturer", "Lecturer")
.WithMany()
.HasForeignKey("LecturerId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EmployeePost");
b.Navigation("Lecturer");
});
modelBuilder.Entity("DatabaseCore.Models.Security.Access", b =>
{
b.HasOne("DatabaseCore.Models.Security.Role", "Role")
@ -516,6 +791,21 @@ namespace DatabaseCore.Migrations
b.Navigation("EmployeeEmployeePosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicDegree", b =>
{
b.Navigation("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerAcademicRank", b =>
{
b.Navigation("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Department.LecturerPost", b =>
{
b.Navigation("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Security.Role", b =>
{
b.Navigation("Access");
@ -525,6 +815,10 @@ namespace DatabaseCore.Migrations
modelBuilder.Entity("DatabaseCore.Models.Security.User", b =>
{
b.Navigation("Employees");
b.Navigation("Lecturers");
b.Navigation("UserRoles");
});
#pragma warning restore 612, 618

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using DatabaseCore.Models.Security;
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
using System.Collections.Generic;
@ -12,6 +13,7 @@ namespace DatabaseCore.Models.Department
/// </summary>
[DataContract]
[EntityDescription("Employee", "Сотрудника кафедры")]
[EntityDependency("User", "UserId", "К какому пользователю относится сотрудник")]
public class Employee : BaseEntity, IEntitySecurityExtenstion<Employee>
{
[DataMember]
@ -64,6 +66,8 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public virtual User User { get; set; }
//-------------------------------------------------------------------------
[ForeignKey("EmployeeId")]

View File

@ -0,0 +1,123 @@
using DatabaseCore.Models.Security;
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий преподавателя
/// </summary>
[DataContract]
[EntityDescription("Lecturer", "Преподаваетль кафедры")]
[EntityDependency("User", "UserId", "К какому пользователю относится преподаватель")]
[EntityDependency("LecturerPost", "LecturerPostId", "К какой должности относится преподаватель")]
[EntityDependency("LecturerAcademicRank", "LecturerAcademicRankId", "Какое звание имеет преподаватель")]
[EntityDependency("LecturerAcademicDegree", "LecturerAcademicDegreeId", "Какую степень имеет преподаватель")]
public class Lecturer : BaseEntity, IEntitySecurityExtenstion<Lecturer>
{
[DataMember]
[Required]
[MapConfiguration("UserId")]
public Guid UserId { get; set; }
[DataMember]
[Required]
[MapConfiguration("LecturerPostId")]
public Guid LecturerPostId { get; set; }
[DataMember]
[Required]
[MapConfiguration("LecturerPostRate")]
public decimal LecturerPostRate { get; set; }
[DataMember]
[MapConfiguration("LecturerAcademicRankId")]
public Guid? LecturerAcademicRankId { get; set; }
[DataMember]
[MapConfiguration("LecturerAcademicDegreeId")]
public Guid? LecturerAcademicDegreeId { get; set; }
[DataMember]
[Required]
[MapConfiguration("LastName")]
public string LastName { get; set; }
[DataMember]
[Required]
[MapConfiguration("FirstName")]
public string FirstName { get; set; }
[DataMember]
[MapConfiguration("Patronymic")]
public string Patronymic { get; set; }
[DataMember]
[Required]
[MapConfiguration("DateBirth")]
public DateTime DateBirth { get; set; }
[DataMember]
[Required]
[MapConfiguration("Address")]
public string Address { get; set; }
[DataMember]
[Required]
[MapConfiguration("Email")]
public string Email { get; set; }
[DataMember]
[Required]
[MapConfiguration("MobileNumber")]
public string MobileNumber { get; set; }
[DataMember]
[MapConfiguration("HomeNumber")]
public string HomeNumber { get; set; }
[DataMember]
[MapConfiguration("Description")]
public string Description { get; set; }
[DataMember]
[MapConfiguration("Photo")]
public byte[] Photo { get; set; }
[DataMember]
[MapConfiguration("GroupElectricalSafety")]
public string GroupElectricalSafety { get; set; }
//-------------------------------------------------------------------------
public virtual User User { get; set; }
public virtual LecturerPost LecturerPost { get; set; }
public virtual LecturerAcademicRank LecturerAcademicRank { get; set; }
public virtual LecturerAcademicDegree LecturerAcademicDegree { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
public Lecturer SecurityCheck(Lecturer entity, bool allowFullData)
{
if (!allowFullData)
{
entity.DateBirth = DateTime.Now;
entity.Address = "скрыто";
entity.Email = "скрыто";
entity.MobileNumber = "скрыто";
entity.HomeNumber = "скрыто";
entity.Photo = null;
}
return entity;
}
}
}

View File

@ -0,0 +1,37 @@
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий ученой степени преподавателя кафедры
/// </summary>
[DataContract]
[EntityDescription("LecturerAcademicDegree", "Ученой степени преподавателя кафедры")]
public class LecturerAcademicDegree : BaseEntity, IEntitySecurityExtenstion<LecturerAcademicDegree>
{
[DataMember]
[Required]
[MapConfiguration("LecturerAcademicDegreeName")]
public string LecturerAcademicDegreeName { get; set; }
[DataMember]
[MapConfiguration("Order")]
public int Order { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
[ForeignKey("LecturerAcademicDegreeId")]
public virtual List<Lecturer> Lecturers { get; set; }
//-------------------------------------------------------------------------
public LecturerAcademicDegree SecurityCheck(LecturerAcademicDegree entity, bool allowFullData) => entity;
}
}

View File

@ -0,0 +1,37 @@
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий ученое звание преподавателя кафедры
/// </summary>
[DataContract]
[EntityDescription("LecturerAcademicRank", "Ученое звание преподавателя кафедры")]
public class LecturerAcademicRank : BaseEntity, IEntitySecurityExtenstion<LecturerAcademicRank>
{
[DataMember]
[Required]
[MapConfiguration("LecturerAcademicRankName")]
public string LecturerAcademicRankName { get; set; }
[DataMember]
[MapConfiguration("Order")]
public int Order { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
[ForeignKey("LecturerAcademicRankId")]
public virtual List<Lecturer> Lecturers { get; set; }
//-------------------------------------------------------------------------
public LecturerAcademicRank SecurityCheck(LecturerAcademicRank entity, bool allowFullData) => entity;
}
}

View File

@ -0,0 +1,53 @@
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий связь преподавателя и должность кафедры
/// </summary>
[DataContract]
[EntityDescription("LecturerEmployeePost", "Связь преподавателя и должность кафедры")]
[EntityDependency("EmployeePost", "EmployeePostId", "К какой должности относится преподаватель")]
[EntityDependency("Lecturer", "LecturerId", "К какой должности относится преподаватель")]
public class LecturerEmployeePost : BaseEntity, IEntitySecurityExtenstion<LecturerEmployeePost>
{
[DataMember]
[Required]
[MapConfiguration("LecturerId")]
public Guid LecturerId { get; set; }
[DataMember]
[Required]
[MapConfiguration("EmployeePostId")]
public Guid EmployeePostId { get; set; }
[DataMember]
[Required]
[MapConfiguration("Rate")]
public decimal Rate { get; set; }
[DataMember]
[MapConfiguration("IsInternalCombination")]
public bool IsInternalCombination { get; set; }
[DataMember]
[MapConfiguration("IsExternalCombination")]
public bool IsExternalCombination { get; set; }
//-------------------------------------------------------------------------
public virtual EmployeePost EmployeePost { get; set; }
public virtual Lecturer Lecturer { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
public LecturerEmployeePost SecurityCheck(LecturerEmployeePost entity, bool allowFullData) => entity;
}
}

View File

@ -0,0 +1,42 @@
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий должность преподавателя кафедры
/// </summary>
[DataContract]
[EntityDescription("LecturerPost", "Должность преподавателя кафедры")]
public class LecturerPost : BaseEntity, IEntitySecurityExtenstion<LecturerPost>
{
[DataMember]
[Required]
[MapConfiguration("LecturerPostName")]
public string LecturerPostName { get; set; }
[DataMember]
[Required]
[MapConfiguration("Hours")]
public int Hours { get; set; }
[DataMember]
[MapConfiguration("Order")]
public int Order { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
[ForeignKey("LecturerPostId")]
public virtual List<Lecturer> Lecturers { get; set; }
//-------------------------------------------------------------------------
public LecturerPost SecurityCheck(LecturerPost entity, bool allowFullData) => entity;
}
}

View File

@ -1,4 +1,5 @@
using ModuleTools.Attributes;
using DatabaseCore.Models.Department;
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
using System.Collections.Generic;
@ -52,6 +53,12 @@ namespace DatabaseCore.Models.Security
[ForeignKey("UserId")]
public virtual List<UserRole> UserRoles { get; set; }
[ForeignKey("UserId")]
public virtual List<Employee> Employees { get; set; }
[ForeignKey("UserId")]
public virtual List<Lecturer> Lecturers { get; set; }
//-------------------------------------------------------------------------
public User SecurityCheck(User entity, bool allowFullData)

View File

@ -32,9 +32,9 @@
Дисциплины = 103, // + Блоки дисциплин
Направления = 102,
Преподаватели = 104, // + должности, звания
Преподаватели = 103, // + должности, звания
Направления = 102,
Группы = 105, //

View File

@ -10,6 +10,7 @@ namespace DepartmentBusinessLogic.BindingModels
/// </summary>
public class EmployeeGetBindingModel : GetBindingModel
{
public Guid? UserId { get; set; }
}
/// <summary>
@ -21,14 +22,14 @@ namespace DepartmentBusinessLogic.BindingModels
[MapConfiguration("UserId")]
public Guid UserId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("FirstName")]
public string FirstName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("LastName")]
public string LastName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("FirstName")]
public string FirstName { get; set; }
[MapConfiguration("Patronymic")]
public string Patronymic { get; set; }

View File

@ -0,0 +1,27 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение ученой степени преподавателя
/// </summary>
public class LecturerAcademicDegreeGetBindingModel : GetBindingModel
{
}
/// <summary>
/// Сохранение ученой степени преподавателя
/// </summary>
public class LecturerAcademicDegreeSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("LecturerAcademicDegreeName")]
public string LecturerAcademicDegreeName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Order")]
public int Order { get; set; }
}
}

View File

@ -0,0 +1,27 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение ученого звания преподавателя
/// </summary>
public class LecturerAcademicRankGetBindingModel : GetBindingModel
{
}
/// <summary>
/// Сохранение ученого звания преподавателя
/// </summary>
public class LecturerAcademicRankSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("LecturerAcademicRankName")]
public string LecturerAcademicRankName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Order")]
public int Order { get; set; }
}
}

View File

@ -0,0 +1,81 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение преподавателя
/// </summary>
public class LecturerGetBindingModel : GetBindingModel
{
public Guid? UserId { get; set; }
}
/// <summary>
/// Сохранение преподавателя
/// </summary>
public class LecturerSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("UserId")]
public Guid UserId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("LecturerPostId")]
public Guid LecturerPostId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("LecturerPostRate")]
public decimal LecturerPostRate { get; set; }
[MapConfiguration("LecturerAcademicRankId")]
public Guid? LecturerAcademicRankId { get; set; }
[MapConfiguration("LecturerAcademicDegreeId")]
public Guid? LecturerAcademicDegreeId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("LastName")]
public string LastName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("FirstName")]
public string FirstName { get; set; }
[MapConfiguration("Patronymic")]
public string Patronymic { get; set; }
[MapConfiguration("Abbreviation")]
public string Abbreviation { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("DateBirth")]
public DateTime DateBirth { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Address")]
public string Address { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Email")]
public string Email { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("MobileNumber")]
public string MobileNumber { get; set; }
[MapConfiguration("HomeNumber")]
public string HomeNumber { get; set; }
[MapConfiguration("Description")]
public string Description { get; set; }
[MapConfiguration("Photo")]
public byte[] Photo { get; set; }
[MapConfiguration("OnlyForPrivate")]
public bool OnlyForPrivate { get; set; }
}
}

View File

@ -0,0 +1,41 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение связи преподавателя с должностью
/// </summary>
public class LecturerEmployeePostGetBindingModel : GetBindingModel
{
public Guid? LecturerId { get; set; }
public Guid? EmployeePostId { get; set; }
}
/// <summary>
/// Сохранение связи преподавателя с должностью
/// </summary>
public class LecturerEmployeePostSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("LecturerId")]
public Guid LecturerId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("EmployeePostId")]
public Guid EmployeePostId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Rate")]
public decimal Rate { get; set; }
[MapConfiguration("IsInternalCombination")]
public bool IsInternalCombination { get; set; }
[MapConfiguration("IsExternalCombination")]
public bool IsExternalCombination { get; set; }
}
}

View File

@ -0,0 +1,31 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение должности преподавателя
/// </summary>
public class LecturerPostGetBindingModel : GetBindingModel
{
}
/// <summary>
/// Сохранение должности преподавателя
/// </summary>
public class LecturerPostSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("LecturerPostName")]
public string LecturerPostName { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Hours")]
public int Hours { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Order")]
public int Order { get; set; }
}
}

View File

@ -7,7 +7,7 @@ using ModuleTools.Enums;
namespace DepartmentBusinessLogic.BusinessLogics
{
/// <summary>
/// Логика работы с должностями сотрудников
/// Логика работы с сотрудниками
/// </summary>
public class EmployeeBusinessLogic : GenericBusinessLogic<EmployeeGetBindingModel, EmployeeSetBindingModel, EmployeeListViewModel, EmployeeViewModel>
{

View File

@ -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 LecturerAcademicDegreeBusinessLogic : GenericBusinessLogic<LecturerAcademicDegreeGetBindingModel, LecturerAcademicDegreeSetBindingModel, LecturerAcademicDegreeListViewModel, LecturerAcademicDegreeViewModel>
{
public LecturerAcademicDegreeBusinessLogic(ILecturerAcademicDegreeService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { }
}
}

View File

@ -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 LecturerAcademicRankBusinessLogic : GenericBusinessLogic<LecturerAcademicRankGetBindingModel, LecturerAcademicRankSetBindingModel, LecturerAcademicRankListViewModel, LecturerAcademicRankViewModel>
{
public LecturerAcademicRankBusinessLogic(ILecturerAcademicRankService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { }
}
}

View File

@ -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 LecturerBusinessLogic : GenericBusinessLogic<LecturerGetBindingModel, LecturerSetBindingModel, LecturerListViewModel, LecturerViewModel>
{
public LecturerBusinessLogic(ILecturerService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { }
}
}

View File

@ -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 LecturerEmployeePostBusinessLogic : GenericBusinessLogic<LecturerEmployeePostGetBindingModel, LecturerEmployeePostSetBindingModel, LecturerEmployeePostListViewModel, LecturerEmployeePostViewModel>
{
public LecturerEmployeePostBusinessLogic(ILecturerEmployeePostService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { }
}
}

View File

@ -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 LecturerPostBusinessLogic : GenericBusinessLogic<LecturerPostGetBindingModel, LecturerPostSetBindingModel, LecturerPostListViewModel, LecturerPostViewModel>
{
public LecturerPostBusinessLogic(ILecturerPostService service) : base(service, "Преподаватели", AccessOperation.Преподаватели) { }
}
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение ученых степеней преподавателей
/// </summary>
public interface ILecturerAcademicDegreeService : IGenerticEntityService<LecturerAcademicDegreeGetBindingModel, LecturerAcademicDegreeSetBindingModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение ученых званий преподавателей
/// </summary>
public interface ILecturerAcademicRankService : IGenerticEntityService<LecturerAcademicRankGetBindingModel, LecturerAcademicRankSetBindingModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение должностей преподавателей
/// </summary>
public interface ILecturerEmployeePostService : IGenerticEntityService<LecturerEmployeePostGetBindingModel, LecturerEmployeePostSetBindingModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение должностей преподавателей
/// </summary>
public interface ILecturerPostService : IGenerticEntityService<LecturerPostGetBindingModel, LecturerPostSetBindingModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение преподавателей
/// </summary>
public interface ILecturerService : IGenerticEntityService<LecturerGetBindingModel, LecturerSetBindingModel> { }
}

View File

@ -5,12 +5,12 @@ using ModuleTools.ViewModels;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список ролей
/// Список должностей сотрудников
/// </summary>
public class EmployeePostListViewModel : ListViewModel<EmployeePostViewModel> { }
/// <summary>
/// Элемент ролей
/// Элемент должности сотрудников
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Сотрудники", Order = 1, ParentPropertyName = "EmployeePostId",
@ -18,7 +18,7 @@ namespace DepartmentBusinessLogic.ViewModels
public class EmployeePostViewModel : ElementViewModel
{
[ViewModelControlListProperty("Название должности")]
[ViewModelControlElementProperty("Название должность", ControlType.ControlString, MustHaveValue = true)]
[ViewModelControlElementProperty("Название должности", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("EmployeePostName")]
public string EmployeePostName { get; set; }

View File

@ -0,0 +1,32 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список должностей преподавателей
/// </summary>
public class LecturerAcademicDegreeListViewModel : ListViewModel<LecturerAcademicDegreeViewModel> { }
/// <summary>
/// Элемент должности преподавателей
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Преподаватели", Order = 1, ParentPropertyName = "LecturerPostId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostEmployeeList, DepartmentWindowsDesktop")]
public class LecturerAcademicDegreeViewModel : ElementViewModel
{
[ViewModelControlListProperty("Ученая степень")]
[ViewModelControlElementProperty("Ученая степень", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("LecturerAcademicDegreeName")]
public string LecturerAcademicDegreeName { get; set; }
[ViewModelControlListProperty("Порядок", ColumnWidth = 100)]
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => LecturerAcademicDegreeName;
}
}

View File

@ -0,0 +1,32 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список должностей преподавателей
/// </summary>
public class LecturerAcademicRankListViewModel : ListViewModel<LecturerAcademicRankViewModel> { }
/// <summary>
/// Элемент должности преподавателей
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Преподаватели", Order = 1, ParentPropertyName = "LecturerPostId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostEmployeeList, DepartmentWindowsDesktop")]
public class LecturerAcademicRankViewModel : ElementViewModel
{
[ViewModelControlListProperty("Ученая степень")]
[ViewModelControlElementProperty("Ученая степень", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("LecturerAcademicRankName")]
public string LecturerAcademicRankName { get; set; }
[ViewModelControlListProperty("Порядок", ColumnWidth = 100)]
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => LecturerAcademicRankName;
}
}

View File

@ -0,0 +1,56 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
using System;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список связей преподавателей и должностей
/// </summary>
public class LecturerEmployeePostListViewModel : ListViewModel<LecturerEmployeePostViewModel> { }
/// <summary>
/// Связь преподавателя и должности
/// </summary>
[ViewModelControlElementClass()]
public class LecturerEmployeePostViewModel : ElementViewModel
{
[ViewModelControlElementProperty("Сотрудник", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")]
[MapConfiguration("LecturerId", AllowCopyWithoutRigth = false)]
public Guid LecturerId { get; set; }
[ViewModelControlListProperty("Преподаватель")]
[MapConfiguration("Lecturer.LastName", IsDifficle = true)]
public string LecturerName { get; set; }
[ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEmployeePostList, DepartmentWindowsDesktop")]
[MapConfiguration("EmployeePostId")]
public Guid EmployeePostId { get; set; }
[ViewModelControlListProperty("Должность")]
[MapConfiguration("EmployeePost.EmployeePostName", IsDifficle = true)]
public string EmployeePostName { get; set; }
[ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")]
[ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, DecimalPlaces = 1, MustHaveValue = true)]
[MapConfiguration("Rate")]
public decimal Rate { get; set; }
[ViewModelControlElementProperty("Внутр. совм.", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("IsInternalCombination")]
public bool IsInternalCombination { get; set; }
[ViewModelControlListProperty("Внутр. совм.", ColumnWidth = 80)]
public string InternalCombination => IsInternalCombination ? "Да" : "Нет";
[ViewModelControlElementProperty("Внеш. совм.", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("IsExternalCombination")]
public bool IsExternalCombination { get; set; }
[ViewModelControlListProperty("Внеш. совм.", ColumnWidth = 80)]
public string ExternalCombination => IsExternalCombination ? "Да" : "Нет";
public override string ToString() => $"{LecturerName}-{EmployeePostName}";
}
}

View File

@ -0,0 +1,37 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список должностей преподавателей
/// </summary>
public class LecturerPostListViewModel : ListViewModel<LecturerPostViewModel> { }
/// <summary>
/// Элемент должности преподавателей
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Преподаватели", Order = 1, ParentPropertyName = "LecturerPostId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostEmployeeList, DepartmentWindowsDesktop")]
public class LecturerPostViewModel : ElementViewModel
{
[ViewModelControlListProperty("Название должности")]
[ViewModelControlElementProperty("Название должности", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("LecturerPostName")]
public string LecturerPostName { get; set; }
[ViewModelControlListProperty("Часы", ColumnWidth = 100)]
[ViewModelControlElementProperty("Часы", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Hours")]
public int Hours { get; set; }
[ViewModelControlListProperty("Порядок", ColumnWidth = 100)]
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => LecturerPostName;
}
}

View File

@ -0,0 +1,114 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.Extensions;
using ModuleTools.ViewModels;
using System;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список преподавателей
/// </summary>
public class LecturerListViewModel : ListViewModel<LecturerViewModel> { }
/// <summary>
/// Элемент преподаватель
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 700)]
[ViewModelControlElementDependenceEntity(Title = "Должности", Order = 1, ParentPropertyName = "LecturerId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerEmployeePostList, DepartmentWindowsDesktop")]
public class LecturerViewModel : ElementViewModel
{
[ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")]
[MapConfiguration("UserId")]
public Guid UserId { get; set; }
[ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerPostList, DepartmentWindowsDesktop")]
[MapConfiguration("LecturerPostId")]
public Guid LecturerPostId { get; set; }
[ViewModelControlListProperty("Должность")]
[MapConfiguration("LecturerPost.LecturerPostName", IsDifficle = true)]
public string EmployeePostName { get; set; }
[ViewModelControlListProperty("Ставка")]
[ViewModelControlElementProperty("Ставка", ControlType.ControlDecimal, MustHaveValue = true)]
[MapConfiguration("LecturerPostRate")]
public decimal LecturerPostRate { get; set; }
[ViewModelControlElementProperty("Уч. степень", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerAcademicDegreeList, DepartmentWindowsDesktop")]
[MapConfiguration("LecturerAcademicDegreeId")]
public Guid? LecturerAcademicDegreeId { get; set; }
[ViewModelControlListProperty("Уч. степень")]
[MapConfiguration("LecturerAcademicDegree.LecturerAcademicDegreeName", IsDifficle = true)]
public string LecturerAcademicDegree { get; set; }
[ViewModelControlElementProperty("Уч. звание", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerAcademicRankList, DepartmentWindowsDesktop")]
[MapConfiguration("LecturerAcademicRankId")]
public Guid? LecturerAcademicRankId { get; set; }
[ViewModelControlListProperty("Уч. звание")]
[MapConfiguration("LecturerAcademicRank.LecturerAcademicRankName", IsDifficle = true)]
public string LecturerAcademicRank { get; set; }
[ViewModelControlListProperty("Фамилия")]
[ViewModelControlElementProperty("Фамилия", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("LastName")]
public string LastName { get; set; }
[ViewModelControlListProperty("Имя")]
[ViewModelControlElementProperty("Имя", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("FirstName")]
public string FirstName { get; set; }
[ViewModelControlListProperty("Отчество")]
[ViewModelControlElementProperty("Отчество", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("Patronymic")]
public string Patronymic { get; set; }
[ViewModelControlElementProperty("Аббревиатура", ControlType.ControlString)]
[MapConfiguration("Abbreviation")]
public string Abbreviation { get; set; }
[ViewModelControlListProperty("Дата рожд.", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")]
[ViewModelControlElementProperty("Дата рожд.", ControlType.ControlDateTime, MustHaveValue = true)]
[MapConfiguration("DateBirth", AllowCopyWithoutRigth = false)]
public DateTime DateBirth { get; set; }
[ViewModelControlListProperty("Адрес", ColumnWidth = 90)]
[ViewModelControlElementProperty("Адрес", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("Address", AllowCopyWithoutRigth = false)]
public string Address { get; set; }
[ViewModelControlListProperty("Эл. почта", ColumnWidth = 90)]
[ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("Email", AllowCopyWithoutRigth = false)]
public string Email { get; set; }
[ViewModelControlListProperty("Моб. номер", ColumnWidth = 100)]
[ViewModelControlElementProperty("Моб. номер", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("MobileNumber", AllowCopyWithoutRigth = false)]
public string MobileNumber { get; set; }
[ViewModelControlListProperty("Дом. номер", ColumnWidth = 100)]
[ViewModelControlElementProperty("Дом. номер", ControlType.ControlString)]
[MapConfiguration("HomeNumber", AllowCopyWithoutRigth = false)]
public string HomeNumber { get; set; }
[ViewModelControlElementProperty("Описание", ControlType.ControlText)]
[MapConfiguration("Description")]
public string Description { get; set; }
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)]
[MapConfiguration("Photo")]
public byte[] Photo { get; set; }
[ViewModelControlElementProperty("Для внутр. пользования", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("OnlyForPrivate")]
public bool OnlyForPrivate { get; set; }
public override string ToString() =>
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
}
}