добавлен год поступления

This commit is contained in:
kotcheshir73 2022-03-27 01:20:51 +04:00
parent 58cdb371c5
commit 195e81bbb0
31 changed files with 2369 additions and 28 deletions

View File

@ -7,6 +7,10 @@
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.15" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.15">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>

View File

@ -52,12 +52,14 @@ namespace CoreDatabase
modelBuilder.Entity<TimeNorm>().HasIndex(d => new { d.TimeNormName, d.TimeNormShortName }).IsUnique();
modelBuilder.Entity<AcademicPlan>().HasIndex(d => new { d.EducationDirectionId, d.YearEntrance }).IsUnique();
modelBuilder.Entity<AcademicPlan>().HasIndex(d => new { d.EducationDirectionId, d.CreateDate }).IsUnique();
modelBuilder.Entity<AcademicPlanRecord>().HasIndex(d => new { d.AcademicPlanId, d.DisciplineId, d.Semester }).IsUnique();
modelBuilder.Entity<AcademicPlanRecordTimeNormHour>().HasIndex(d => new { d.AcademicPlanRecordId, d.TimeNormId }).IsUnique();
modelBuilder.Entity<EnrollmentYear>().HasIndex(d => new { d.AcademicPlanId, d.YearEntrance }).IsUnique();
// ругается на циклическое каскадное удаление, так что по нормам времени убираем ее
modelBuilder.Entity<AcademicPlanRecordTimeNormHour>()
.HasOne(x => x.TimeNorm)
@ -122,6 +124,7 @@ namespace CoreDatabase
public virtual DbSet<OrderStudentRecord> OrderStudentRecords { set; get; }
public virtual DbSet<OrderSyncHistory> OrderSyncHistories { set; get; }
public virtual DbSet<OrderSyncHistoryRecord> OrderSyncHistoryRecords { set; get; }
public virtual DbSet<EnrollmentYear> EnrollmentYears { set; get; }
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,153 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace CoreDatabase.Migrations
{
public partial class AddEnrollmentYear : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropIndex(
name: "IX_AcademicPlans_EducationDirectionId_YearEntrance",
table: "AcademicPlans");
migrationBuilder.DropColumn(
name: "YearEntrance",
table: "AcademicPlans");
migrationBuilder.DropColumn(
name: "YearFinish",
table: "AcademicPlans");
migrationBuilder.AddColumn<Guid>(
name: "EnrollmentYearId",
table: "Students",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn<DateTime>(
name: "CreateDate",
table: "AcademicPlans",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
migrationBuilder.AddColumn<DateTime>(
name: "LastUpdateDate",
table: "AcademicPlans",
type: "datetime2",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
//требуется для создания уникального индекса IX_AcademicPlans_EducationDirectionId_CreateDate, если уже есть записи в AcademicPlans
migrationBuilder.Sql(
@"
declare @i int = 45869
UPDATE AcademicPlans
SET CreateDate = convert(datetime, @i),
SET LastUpdateDate = convert(datetime, @i),
@i = @i + 100;
");
migrationBuilder.CreateTable(
name: "EnrollmentYears",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
AcademicPlanId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
YearEntrance = table.Column<int>(type: "int", nullable: false),
YearFinish = 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_EnrollmentYears", x => x.Id);
table.ForeignKey(
name: "FK_EnrollmentYears_AcademicPlans_AcademicPlanId",
column: x => x.AcademicPlanId,
principalTable: "AcademicPlans",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_Students_EnrollmentYearId",
table: "Students",
column: "EnrollmentYearId");
migrationBuilder.CreateIndex(
name: "IX_AcademicPlans_EducationDirectionId_CreateDate",
table: "AcademicPlans",
columns: new[] { "EducationDirectionId", "CreateDate" },
unique: true,
filter: "[EducationDirectionId] IS NOT NULL");
migrationBuilder.CreateIndex(
name: "IX_EnrollmentYears_AcademicPlanId_YearEntrance",
table: "EnrollmentYears",
columns: new[] { "AcademicPlanId", "YearEntrance" },
unique: true);
migrationBuilder.AddForeignKey(
name: "FK_Students_EnrollmentYears_EnrollmentYearId",
table: "Students",
column: "EnrollmentYearId",
principalTable: "EnrollmentYears",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Students_EnrollmentYears_EnrollmentYearId",
table: "Students");
migrationBuilder.DropTable(
name: "EnrollmentYears");
migrationBuilder.DropIndex(
name: "IX_Students_EnrollmentYearId",
table: "Students");
migrationBuilder.DropIndex(
name: "IX_AcademicPlans_EducationDirectionId_CreateDate",
table: "AcademicPlans");
migrationBuilder.DropColumn(
name: "EnrollmentYearId",
table: "Students");
migrationBuilder.DropColumn(
name: "CreateDate",
table: "AcademicPlans");
migrationBuilder.DropColumn(
name: "LastUpdateDate",
table: "AcademicPlans");
migrationBuilder.AddColumn<int>(
name: "YearEntrance",
table: "AcademicPlans",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.AddColumn<int>(
name: "YearFinish",
table: "AcademicPlans",
type: "int",
nullable: false,
defaultValue: 0);
migrationBuilder.CreateIndex(
name: "IX_AcademicPlans_EducationDirectionId_YearEntrance",
table: "AcademicPlans",
columns: new[] { "EducationDirectionId", "YearEntrance" },
unique: true,
filter: "[EducationDirectionId] IS NOT NULL");
}
}
}

View File

@ -16,7 +16,7 @@ namespace CoreDatabase.Migrations
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.5")
.HasAnnotation("ProductVersion", "5.0.15")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("CoreDatabase.Models.Department.AcademicPlan", b =>
@ -24,6 +24,9 @@ namespace CoreDatabase.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("CreateDate")
.HasColumnType("datetime2");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
@ -36,15 +39,12 @@ namespace CoreDatabase.Migrations
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<int>("YearEntrance")
.HasColumnType("int");
b.Property<int>("YearFinish")
.HasColumnType("int");
b.Property<DateTime>("LastUpdateDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.HasIndex("EducationDirectionId", "YearEntrance")
b.HasIndex("EducationDirectionId", "CreateDate")
.IsUnique()
.HasFilter("[EducationDirectionId] IS NOT NULL");
@ -410,6 +410,37 @@ namespace CoreDatabase.Migrations
b.ToTable("EmployeePosts");
});
modelBuilder.Entity("CoreDatabase.Models.Department.EnrollmentYear", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("AcademicPlanId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<int>("YearEntrance")
.HasColumnType("int");
b.Property<int>("YearFinish")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("AcademicPlanId", "YearEntrance")
.IsUnique();
b.ToTable("EnrollmentYears");
});
modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b =>
{
b.Property<Guid>("Id")
@ -750,6 +781,9 @@ namespace CoreDatabase.Migrations
b.Property<string>("Email")
.HasColumnType("nvarchar(max)");
b.Property<Guid?>("EnrollmentYearId")
.HasColumnType("uniqueidentifier");
b.Property<string>("FirstName")
.IsRequired()
.HasColumnType("nvarchar(max)");
@ -789,6 +823,8 @@ namespace CoreDatabase.Migrations
b.HasKey("Id");
b.HasIndex("EnrollmentYearId");
b.HasIndex("NumberOfBook")
.IsUnique();
@ -1173,6 +1209,17 @@ namespace CoreDatabase.Migrations
b.Navigation("Post");
});
modelBuilder.Entity("CoreDatabase.Models.Department.EnrollmentYear", b =>
{
b.HasOne("CoreDatabase.Models.Department.AcademicPlan", "AcademicPlan")
.WithMany()
.HasForeignKey("AcademicPlanId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("AcademicPlan");
});
modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b =>
{
b.HasOne("CoreDatabase.Models.Department.LecturerAcademicDegree", "LecturerAcademicDegree")
@ -1261,6 +1308,10 @@ namespace CoreDatabase.Migrations
modelBuilder.Entity("CoreDatabase.Models.Department.Student", b =>
{
b.HasOne("CoreDatabase.Models.Department.EnrollmentYear", "EnrollmentYear")
.WithMany("Students")
.HasForeignKey("EnrollmentYearId");
b.HasOne("CoreDatabase.Models.Department.StudentGroup", "StudentGroup")
.WithMany("Students")
.HasForeignKey("StudentGroupId");
@ -1271,6 +1322,8 @@ namespace CoreDatabase.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("EnrollmentYear");
b.Navigation("StudentGroup");
b.Navigation("User");
@ -1370,6 +1423,11 @@ namespace CoreDatabase.Migrations
b.Navigation("EmployeePosts");
});
modelBuilder.Entity("CoreDatabase.Models.Department.EnrollmentYear", b =>
{
b.Navigation("Students");
});
modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b =>
{
b.Navigation("EducationDirections");

View File

@ -16,11 +16,11 @@ namespace CoreDatabase.Models.Department
[DataMember]
[Required(ErrorMessage = "required")]
public int YearEntrance { get; set; }
public DateTime CreateDate { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
public int YearFinish { get; set; }
public DateTime LastUpdateDate { get; set; }
//-------------------------------------------------------------------------
@ -31,10 +31,10 @@ namespace CoreDatabase.Models.Department
[ForeignKey("AcademicPlanId")]
public virtual List<AcademicPlanRecord> AcademicPlanRecords { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
public AcademicPlan SecurityCheck(AcademicPlan entity, bool allowFullData) => entity;
public AcademicPlan SecurityCheck(AcademicPlan entity, bool allowFullData) => entity;
public override string ToString() => $"{EducationDirection?.ShortName}({EducationDirection?.Profile}): {YearEntrance}-{YearFinish}";
public override string ToString() => $"{EducationDirection?.ShortName}({EducationDirection?.Profile}): {CreateDate:d}";
}
}

View File

@ -0,0 +1,40 @@
using CoreModels.ModelsDepartment;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using ToolsModule.ManagmentSecurity;
namespace CoreDatabase.Models.Department
{
[DataContract]
public class EnrollmentYear : BaseEntity, IEntitySecurityExtenstion<EnrollmentYear>, IEnrollmentYearModel
{
[DataMember]
public Guid AcademicPlanId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
public int YearEntrance { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
public int YearFinish { get; set; }
//-------------------------------------------------------------------------
public virtual AcademicPlan AcademicPlan { get; set; }
//-------------------------------------------------------------------------
[ForeignKey("EnrollmentYearId")]
public virtual List<Student> Students { get; set; }
//-------------------------------------------------------------------------
public EnrollmentYear SecurityCheck(EnrollmentYear entity, bool allowFullData) => entity;
public override string ToString() => $"{AcademicPlan?.EducationDirection?.ShortName}({AcademicPlan?.EducationDirection?.Profile}): {YearEntrance}-{YearFinish}";
}
}

View File

@ -21,6 +21,9 @@ namespace CoreDatabase.Models.Department
[DataMember]
public Guid? StudentGroupId { get; set; }
[DataMember]
public Guid? EnrollmentYearId { get; set; }
[DataMember]
[Required]
public string Iduniv { get; set; }
@ -61,6 +64,8 @@ namespace CoreDatabase.Models.Department
public virtual StudentGroup StudentGroup { get; set; }
public virtual EnrollmentYear EnrollmentYear { get; set; }
//-------------------------------------------------------------------------
[ForeignKey("StudentId")]

View File

@ -4,14 +4,14 @@ using ToolsModule.ManagmentEntity;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("AcademicPlan", "Учебный план кафедры (на каждый учебный год новый план)")]
[EntityDescription("AcademicPlan", "Учебный план кафедры")]
[EntityDependency("EducationDirection", "EducationDirectionId", "Направление, к которму относится учебный план")]
public interface IAcademicPlanModel : IId
{
Guid? EducationDirectionId { get; }
int YearEntrance { get; }
DateTime CreateDate { get; }
int YearFinish { get; }
DateTime LastUpdateDate { get; }
}
}

View File

@ -0,0 +1,17 @@
using CoreModels.Tools;
using System;
using ToolsModule.ManagmentEntity;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("EnrollmentYear", "Год зачисления")]
[EntityDependency("AcademicPlan", "AcademicPlanId", "Учебный план, по которому учатся зачисленные")]
public interface IEnrollmentYearModel : IId
{
Guid AcademicPlanId { get; }
int YearEntrance { get; }
int YearFinish { get; }
}
}

View File

@ -8,12 +8,15 @@ namespace CoreModels.ModelsDepartment
[EntityDescription("Student", "Студент кафедры")]
[EntityDependency("User", "UserId", "К какому пользователю относится студент")]
[EntityDependency("StudentGroup", "StudentGroupId", "К какой группе относится студент")]
[EntityDependency("EnrollmentYear", "EnrollmentYearId", "К какому году поступления/выпуска относится")]
public interface IStudentModel : IId
{
Guid UserId { get; }
Guid? StudentGroupId { get; }
Guid? EnrollmentYearId { get; }
string Iduniv { get; }
string NumberOfBook { get; }

View File

@ -0,0 +1,17 @@
using DepartmentContract.BindingModels;
using DepartmentContract.Logics.IGenericEntityLogic;
using DepartmentContract.Services.IGenericEntityService;
using DepartmentContract.ViewModels;
using ToolsModule.ManagmentEntity;
using ToolsModule.ManagmentSecurity;
namespace DepartmentBusinessLogic.BusinessLogics.GenericBusinessLogic
{
/// <summary>
/// Логика работы с годом поступления
/// </summary>
public class EnrollmentYearBusinessLogic : GenericBusinessLogic<EnrollmentYearGetBindingModel, EnrollmentYearSetBindingModel, EnrollmentYearListViewModel, EnrollmentYearViewModel>, IEnrollmentYearLogic
{
public EnrollmentYearBusinessLogic(IEnrollmentYearService service) : base(service, "Года поступления", AccessOperation.УчебныеПланы) { }
}
}

View File

@ -30,6 +30,7 @@ namespace DepartmentBusinessLogic
DependencyManager.Instance.RegisterType<IAcademicPlanLogic, AcademicPlanBusinessLogic>();
DependencyManager.Instance.RegisterType<IAcademicPlanRecordLogic, AcademicPlanRecordBusinessLogic>();
DependencyManager.Instance.RegisterType<IAcademicPlanRecordTimeNormHourLogic, AcademicPlanRecordTimeNormHourBusinessLogic>();
DependencyManager.Instance.RegisterType<IEnrollmentYearLogic, EnrollmentYearBusinessLogic>();
DependencyManager.Instance.RegisterType<IStudentGroupLogic, StudentGroupBusinessLogic>();

View File

@ -21,10 +21,10 @@ namespace DepartmentContract.BindingModels
public Guid? EducationDirectionId { get; set; }
[Required(ErrorMessage = "required")]
public int YearEntrance { get; set; }
public DateTime CreateDate { get; set; }
[Required(ErrorMessage = "required")]
public int YearFinish { get; set; }
public DateTime LastUpdateDate { get; set; }
}
/// <summary>

View File

@ -0,0 +1,29 @@
using CoreModels.ModelsDepartment;
using System;
using System.ComponentModel.DataAnnotations;
using ToolsModule.ManagmentEntity;
namespace DepartmentContract.BindingModels
{
/// <summary>
/// Получение года поступления
/// </summary>
public class EnrollmentYearGetBindingModel : GetBindingModel
{
public Guid? AcademicPlanId { get; set; }
}
/// <summary>
/// Сохранение года поступления
/// </summary>
public class EnrollmentYearSetBindingModel : SetBindingModel, IEnrollmentYearModel
{
public Guid AcademicPlanId { get; set; }
[Required(ErrorMessage = "required")]
public int YearEntrance { get; set; }
[Required(ErrorMessage = "required")]
public int YearFinish { get; set; }
}
}

View File

@ -15,6 +15,8 @@ namespace DepartmentContract.BindingModels
public Guid? StudentGroupId { get; set; }
public Guid? EnrollmentYearId { get; set; }
public StudentState? StudentState { get; set; }
public string NumberOfBook { get; set; }
@ -30,6 +32,8 @@ namespace DepartmentContract.BindingModels
public Guid? StudentGroupId { get; set; }
public Guid? EnrollmentYearId { get; set; }
[Required(ErrorMessage = "required")]
public string Iduniv { get; set; }
@ -54,5 +58,5 @@ namespace DepartmentContract.BindingModels
public byte[] Photo { get; set; }
public bool IsSteward { get; set; }
}
}
}

View File

@ -0,0 +1,11 @@
using DepartmentContract.BindingModels;
using DepartmentContract.ViewModels;
using ToolsModule.ManagmentEntity;
namespace DepartmentContract.Logics.IGenericEntityLogic
{
/// <summary>
/// Логика работы с годом поступления
/// </summary>
public interface IEnrollmentYearLogic : IGenericEntityLogic<EnrollmentYearGetBindingModel, EnrollmentYearSetBindingModel, EnrollmentYearListViewModel, EnrollmentYearViewModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentContract.BindingModels;
using ToolsModule.ManagmentEntity;
namespace DepartmentContract.Services.IGenericEntityService
{
/// <summary>
/// Хранение годов поступления
/// </summary>
public interface IEnrollmentYearService : IGenericEntityService<EnrollmentYearGetBindingModel, EnrollmentYearSetBindingModel> { }
}

View File

@ -16,6 +16,8 @@ namespace DepartmentContract.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 1200, Height = 800)]
[ViewModelControlElementDependenceEntity(Title = "Записи плана", Order = 1, ParentPropertyName = "AcademicPlanId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanRecordList, DepartmentWindowsDesktop")]
[ViewModelControlElementDependenceEntity(Title = "Года поступления", Order = 1, ParentPropertyName = "AcademicPlanId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEnrollmentYearList, DepartmentWindowsDesktop")]
public class AcademicPlanViewModel : ElementViewModel, IAcademicPlanModel
{
[ViewModelControlElementProperty("Направление", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEducationDirectionList, DepartmentWindowsDesktop")]
@ -29,12 +31,12 @@ namespace DepartmentContract.ViewModels
[MapConfiguration("EducationDirection.Profile")]
public string EducationDirectionProfile { get; set; }
[ViewModelControlListProperty("Дата начала", ColumnWidth = 120)]
[ViewModelControlElementProperty("Дата начала", ControlType.ControlInt, MustHaveValue = true)]
public int YearEntrance { get; set; }
[ViewModelControlListProperty("Дата создания", ColumnWidth = 120)]
[ViewModelControlElementProperty("Дата создания", ControlType.ControlDateTime, MustHaveValue = true)]
public DateTime CreateDate { get; set; }
[ViewModelControlListProperty("Дата окончания", ColumnWidth = 120)]
[ViewModelControlElementProperty("Дата окончания", ControlType.ControlInt, MustHaveValue = true)]
public int YearFinish { get; set; }
[ViewModelControlListProperty("Дата последнего изменения", ColumnWidth = 120)]
[ViewModelControlElementProperty("Дата последнего изменения", ControlType.ControlDateTime, MustHaveValue = true)]
public DateTime LastUpdateDate { get; set; }
}
}

View File

@ -0,0 +1,40 @@
using CoreModels.ModelsDepartment;
using System;
using ToolsModule.ManagmentEntity;
using ToolsModule.ManagmentMapping;
namespace DepartmentContract.ViewModels
{
/// <summary>
/// Список учбеных планов
/// </summary>
public class EnrollmentYearListViewModel : ListViewModel<EnrollmentYearViewModel> { }
/// <summary>
/// Элемент учебного плана
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 1200, Height = 800)]
[ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 1, ParentPropertyName = "EnrollmentYearId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
public class EnrollmentYearViewModel : ElementViewModel, IEnrollmentYearModel
{
[ViewModelControlElementProperty("Учебный план", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanList, DepartmentWindowsDesktop")]
public Guid AcademicPlanId { get; set; }
[ViewModelControlListProperty("Направление")]
[MapConfiguration("AcademicPlan.EducationDirection.Cipher")]
public string EducationDirectionCipher { get; set; }
[ViewModelControlListProperty("Профиль")]
[MapConfiguration("AcademicPlan.EducationDirection.Profile")]
public string EducationDirectionProfile { get; set; }
[ViewModelControlListProperty("Дата начала", ColumnWidth = 120)]
[ViewModelControlElementProperty("Дата начала", ControlType.ControlInt, MustHaveValue = true)]
public int YearEntrance { get; set; }
[ViewModelControlListProperty("Дата окончания", ColumnWidth = 120)]
[ViewModelControlElementProperty("Дата окончания", ControlType.ControlInt, MustHaveValue = true)]
public int YearFinish { get; set; }
}
}

View File

@ -28,6 +28,9 @@ namespace DepartmentContract.ViewModels
[MapConfiguration("StudentGroup.ToString")]
public string StudentGroupName { get; set; }
[ViewModelControlElementProperty("Год выпуска", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEnrollmentYearList, DepartmentWindowsDesktop")]
public Guid? EnrollmentYearId { get; set; }
[ViewModelControlElementProperty("Идентификатор универа", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)]
public string Iduniv { get; set; }
@ -65,5 +68,5 @@ namespace DepartmentContract.ViewModels
[ViewModelControlElementProperty("Староста", ControlType.ControlBool, MustHaveValue = true)]
public bool IsSteward { get; set; }
}
}
}

View File

@ -31,6 +31,7 @@ namespace DepartmentDatabaseImplementation
DependencyManager.Instance.RegisterType<IAcademicPlanService, AcademicPlanService>();
DependencyManager.Instance.RegisterType<IAcademicPlanRecordService, AcademicPlanRecordService>();
DependencyManager.Instance.RegisterType<IAcademicPlanRecordTimeNormHourService, AcademicPlanRecordTimeNormHourService>();
DependencyManager.Instance.RegisterType<IEnrollmentYearService, EnrollmentYearService>();
DependencyManager.Instance.RegisterType<IStudentGroupService, StudentGroupService>();

View File

@ -56,11 +56,11 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit
context.SaveChanges();
}
protected override AcademicPlan GetUniqueEntity(AcademicPlanSetBindingModel model, DbContext context) => context.Set<AcademicPlan>().FirstOrDefault(x => x.EducationDirectionId == model.EducationDirectionId && x.YearEntrance == model.YearEntrance && x.Id != model.Id);
protected override AcademicPlan GetUniqueEntity(AcademicPlanSetBindingModel model, DbContext context) => context.Set<AcademicPlan>().FirstOrDefault(x => x.EducationDirectionId == model.EducationDirectionId && x.CreateDate == model.CreateDate && x.Id != model.Id);
protected override IQueryable<AcademicPlan> IncludingWhenReading(IQueryable<AcademicPlan> query) => query.Include(x => x.EducationDirection);
protected override IQueryable<AcademicPlan> OrderingWhenReading(IQueryable<AcademicPlan> query) => query.OrderBy(x => x.EducationDirection.Cipher).ThenBy(x => x.YearEntrance);
protected override IQueryable<AcademicPlan> OrderingWhenReading(IQueryable<AcademicPlan> query) => query.OrderBy(x => x.EducationDirection.Cipher).ThenBy(x => x.CreateDate);
public OperationResultModel LoadPlx(AcademicPlanLoadPlxModel model)
{

View File

@ -0,0 +1,50 @@
using CoreDatabase;
using CoreDatabase.Models.Department;
using DepartmentContract.BindingModels;
using DepartmentContract.Services.IGenericEntityService;
using DepartmentContract.ViewModels;
using Microsoft.EntityFrameworkCore;
using System.Linq;
using ToolsModule.ManagmentEntity;
namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntityService
{
/// <summary>
/// Реализация IEnrollmentYearService
/// </summary>
public class EnrollmentYearService :
AbstractGenerticEntityService<EnrollmentYearGetBindingModel, EnrollmentYearSetBindingModel, EnrollmentYear, EnrollmentYearListViewModel, EnrollmentYearViewModel>,
IEnrollmentYearService
{
protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, EnrollmentYearSetBindingModel model) => OperationResultModel.Success(null);
protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, EnrollmentYear entity, EnrollmentYearGetBindingModel model) => OperationResultModel.Success(null);
protected override IQueryable<EnrollmentYear> AdditionalCheckingWhenReadingList(IQueryable<EnrollmentYear> query, EnrollmentYearGetBindingModel model)
{
if (model.AcademicPlanId.HasValue)
{
query = query.Where(x => x.AcademicPlanId == model.AcademicPlanId.Value);
}
return query;
}
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, EnrollmentYearSetBindingModel model) => OperationResultModel.Success(null);
protected override void AdditionalDeleting(DbContext context, EnrollmentYear entity, EnrollmentYearGetBindingModel model)
{
var records = context.Set<Student>().Where(x => x.EnrollmentYearId == model.Id);
foreach (var record in records)
{
record.EnrollmentYearId = null;
}
context.SaveChanges();
}
protected override EnrollmentYear GetUniqueEntity(EnrollmentYearSetBindingModel model, DbContext context) => context.Set<EnrollmentYear>().FirstOrDefault(x => x.AcademicPlanId == model.AcademicPlanId && x.YearEntrance == model.YearEntrance && x.Id != model.Id);
protected override IQueryable<EnrollmentYear> IncludingWhenReading(IQueryable<EnrollmentYear> query) => query.Include(x => x.AcademicPlan).Include(x => x.AcademicPlan.EducationDirection);
protected override IQueryable<EnrollmentYear> OrderingWhenReading(IQueryable<EnrollmentYear> query) => query.OrderBy(x => x.AcademicPlan.EducationDirection.Cipher).ThenBy(x => x.YearEntrance);
}
}

View File

@ -32,6 +32,10 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit
{
query = query.Where(x => x.StudentGroupId == model.StudentGroupId.Value);
}
if (model.EnrollmentYearId.HasValue)
{
query = query.Where(x => x.EnrollmentYearId == model.EnrollmentYearId.Value);
}
if (model.StudentState.HasValue)
{
query = query.Where(x => x.StudentState == model.StudentState.Value);

View File

@ -0,0 +1,33 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlEnrollmentYearElement
{
/// <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
}
}

View File

@ -0,0 +1,30 @@
using DepartmentContract.BindingModels;
using DepartmentContract.Logics.IGenericEntityLogic;
using DepartmentContract.ViewModels;
using System;
using ToolsDesktop.Controls;
using ToolsDesktop.Interfaces;
using ToolsDesktop.Models;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для года поступления
/// </summary>
public partial class ControlEnrollmentYearElement :
GenericControlEntityElement<EnrollmentYearGetBindingModel, EnrollmentYearSetBindingModel, EnrollmentYearListViewModel, EnrollmentYearViewModel, IEnrollmentYearLogic>,
IGenericControlEntityElement
{
public ControlEnrollmentYearElement()
{
InitializeComponent();
Title = "Год поступления";
ControlId = new Guid("363636d3-b3d0-4374-a573-2bcc78ca4eea");
_genericControlViewEntityElement = this;
}
public IControl GetInstanceGenericControl() => new ControlEnrollmentYearElement() { ControlId = Guid.NewGuid() };
public ControlViewEntityElementConfiguration GetConfigControl() => new();
}
}

View File

@ -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>

View File

@ -0,0 +1,33 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlEnrollmentYearList
{
/// <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
}
}

View File

@ -0,0 +1,42 @@
using DepartmentContract.BindingModels;
using DepartmentContract.Logics.IGenericEntityLogic;
using DepartmentContract.ViewModels;
using System;
using System.Collections.Generic;
using ToolsDesktop.Controls;
using ToolsDesktop.Enums;
using ToolsDesktop.Interfaces;
using ToolsDesktop.Models;
using ToolsModule.ManagmentSecurity;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка годов поступления
/// </summary>
public partial class ControlEnrollmentYearList :
GenericControlEntityList<EnrollmentYearGetBindingModel, EnrollmentYearSetBindingModel, EnrollmentYearListViewModel, EnrollmentYearViewModel, IEnrollmentYearLogic>,
IGenericControlEntityList
{
public ControlEnrollmentYearList()
{
InitializeComponent();
Title = "Года поступления";
ControlId = new Guid("c0b26e65-78fa-40b6-b6ab-2f9c5a0b19dc");
AccessOperation = AccessOperation.Должности;
ControlViewEntityElement = new ControlEmployeePostElement();
_genericControlViewEntityList = this;
}
public IControl GetInstanceGenericControl() => new ControlEnrollmentYearList() { ControlId = Guid.NewGuid() };
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = false,
HideToolStripButton = new List<ToolStripButtonListNames>
{
ToolStripButtonListNames.toolStripButtonSearch
}
};
}
}

View File

@ -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>