Базовая кафедра

This commit is contained in:
kotcheshir73 2022-03-27 14:51:27 +04:00
parent 195e81bbb0
commit d1fcf069b3
33 changed files with 2429 additions and 3 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace CoreDatabase.Migrations
{
public partial class AddBasicDepartments : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "BasicDepartmentId",
table: "Students",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn<Guid>(
name: "BasicDepartmentId",
table: "Disciplines",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.CreateTable(
name: "BasicDepartment",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
LecturerId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
BasicDepartmentName = table.Column<string>(type: "nvarchar(max)", nullable: true),
BasicDepartmentDescription = table.Column<string>(type: "nvarchar(max)", nullable: true),
EnterprisesName = 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_BasicDepartment", x => x.Id);
table.ForeignKey(
name: "FK_BasicDepartment_Lecturers_LecturerId",
column: x => x.LecturerId,
principalTable: "Lecturers",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
});
migrationBuilder.CreateIndex(
name: "IX_Students_BasicDepartmentId",
table: "Students",
column: "BasicDepartmentId");
migrationBuilder.CreateIndex(
name: "IX_Disciplines_BasicDepartmentId",
table: "Disciplines",
column: "BasicDepartmentId");
migrationBuilder.CreateIndex(
name: "IX_BasicDepartment_LecturerId",
table: "BasicDepartment",
column: "LecturerId");
migrationBuilder.AddForeignKey(
name: "FK_Disciplines_BasicDepartment_BasicDepartmentId",
table: "Disciplines",
column: "BasicDepartmentId",
principalTable: "BasicDepartment",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
migrationBuilder.AddForeignKey(
name: "FK_Students_BasicDepartment_BasicDepartmentId",
table: "Students",
column: "BasicDepartmentId",
principalTable: "BasicDepartment",
principalColumn: "Id",
onDelete: ReferentialAction.Restrict);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_Disciplines_BasicDepartment_BasicDepartmentId",
table: "Disciplines");
migrationBuilder.DropForeignKey(
name: "FK_Students_BasicDepartment_BasicDepartmentId",
table: "Students");
migrationBuilder.DropTable(
name: "BasicDepartment");
migrationBuilder.DropIndex(
name: "IX_Students_BasicDepartmentId",
table: "Students");
migrationBuilder.DropIndex(
name: "IX_Disciplines_BasicDepartmentId",
table: "Disciplines");
migrationBuilder.DropColumn(
name: "BasicDepartmentId",
table: "Students");
migrationBuilder.DropColumn(
name: "BasicDepartmentId",
table: "Disciplines");
}
}
}

View File

@ -132,6 +132,39 @@ namespace CoreDatabase.Migrations
b.ToTable("AcademicPlanRecordTimeNormHours");
});
modelBuilder.Entity("CoreDatabase.Models.Department.BasicDepartment", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("BasicDepartmentDescription")
.HasColumnType("nvarchar(max)");
b.Property<string>("BasicDepartmentName")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
b.Property<string>("EnterprisesName")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<Guid?>("LecturerId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("LecturerId");
b.ToTable("BasicDepartment");
});
modelBuilder.Entity("CoreDatabase.Models.Department.Classroom", b =>
{
b.Property<Guid>("Id")
@ -192,6 +225,9 @@ namespace CoreDatabase.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("BasicDepartmentId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
@ -219,6 +255,8 @@ namespace CoreDatabase.Migrations
b.HasKey("Id");
b.HasIndex("BasicDepartmentId");
b.HasIndex("DisciplineBlockId");
b.HasIndex("DisciplineName")
@ -769,6 +807,9 @@ namespace CoreDatabase.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("BasicDepartmentId")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
@ -823,6 +864,8 @@ namespace CoreDatabase.Migrations
b.HasKey("Id");
b.HasIndex("BasicDepartmentId");
b.HasIndex("EnrollmentYearId");
b.HasIndex("NumberOfBook")
@ -1146,6 +1189,15 @@ namespace CoreDatabase.Migrations
b.Navigation("TimeNorm");
});
modelBuilder.Entity("CoreDatabase.Models.Department.BasicDepartment", b =>
{
b.HasOne("CoreDatabase.Models.Department.Lecturer", "Lecturer")
.WithMany("BasicDepartments")
.HasForeignKey("LecturerId");
b.Navigation("Lecturer");
});
modelBuilder.Entity("CoreDatabase.Models.Department.Classroom", b =>
{
b.HasOne("CoreDatabase.Models.Department.Employee", "Employee")
@ -1159,12 +1211,18 @@ namespace CoreDatabase.Migrations
modelBuilder.Entity("CoreDatabase.Models.Department.Discipline", b =>
{
b.HasOne("CoreDatabase.Models.Department.BasicDepartment", "BasicDepartment")
.WithMany("Disciplines")
.HasForeignKey("BasicDepartmentId");
b.HasOne("CoreDatabase.Models.Department.DisciplineBlock", "DisciplineBlock")
.WithMany("Disciplines")
.HasForeignKey("DisciplineBlockId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BasicDepartment");
b.Navigation("DisciplineBlock");
});
@ -1308,6 +1366,10 @@ namespace CoreDatabase.Migrations
modelBuilder.Entity("CoreDatabase.Models.Department.Student", b =>
{
b.HasOne("CoreDatabase.Models.Department.BasicDepartment", "BasicDepartment")
.WithMany("Students")
.HasForeignKey("BasicDepartmentId");
b.HasOne("CoreDatabase.Models.Department.EnrollmentYear", "EnrollmentYear")
.WithMany("Students")
.HasForeignKey("EnrollmentYearId");
@ -1322,6 +1384,8 @@ namespace CoreDatabase.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("BasicDepartment");
b.Navigation("EnrollmentYear");
b.Navigation("StudentGroup");
@ -1397,6 +1461,13 @@ namespace CoreDatabase.Migrations
b.Navigation("AcademicPlanRecordTimeNormHours");
});
modelBuilder.Entity("CoreDatabase.Models.Department.BasicDepartment", b =>
{
b.Navigation("Disciplines");
b.Navigation("Students");
});
modelBuilder.Entity("CoreDatabase.Models.Department.Discipline", b =>
{
b.Navigation("AcademicPlanRecords");
@ -1430,6 +1501,8 @@ namespace CoreDatabase.Migrations
modelBuilder.Entity("CoreDatabase.Models.Department.Lecturer", b =>
{
b.Navigation("BasicDepartments");
b.Navigation("EducationDirections");
b.Navigation("LecturerPosts");

View File

@ -0,0 +1,42 @@
using CoreModels.ModelsDepartment;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
using ToolsModule.ManagmentSecurity;
namespace CoreDatabase.Models.Department
{
/// <summary>
/// Класс, описывающий базовую кафедру
/// </summary>
[DataContract]
public class BasicDepartment : BaseEntity, IEntitySecurityExtenstion<BasicDepartment>, IBasicDepartmentModel
{
public Guid? LecturerId { get; set; }
public string BasicDepartmentName { get; set; }
public string BasicDepartmentDescription { get; set; }
public string EnterprisesName { get; set; }
//-------------------------------------------------------------------------
public virtual Lecturer Lecturer { get; set; }
//-------------------------------------------------------------------------
[ForeignKey("BasicDepartmentId")]
public virtual List<Discipline> Disciplines { get; set; }
[ForeignKey("BasicDepartmentId")]
public virtual List<Student> Students { get; set; }
//-------------------------------------------------------------------------
public BasicDepartment SecurityCheck(BasicDepartment entity, bool allowFullData) => entity;
public override string ToString() => BasicDepartmentName;
}
}

View File

@ -18,6 +18,9 @@ namespace CoreDatabase.Models.Department
[Required(ErrorMessage = "required")]
public Guid DisciplineBlockId { get; set; }
[DataMember]
public Guid? BasicDepartmentId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
public string DisciplineName { get; set; }
@ -34,6 +37,8 @@ namespace CoreDatabase.Models.Department
public virtual DisciplineBlock DisciplineBlock { get; set; }
public virtual BasicDepartment BasicDepartment { get; set; }
//-------------------------------------------------------------------------
[ForeignKey("DisciplineId")]

View File

@ -87,6 +87,9 @@ namespace CoreDatabase.Models.Department
[ForeignKey("LecturerId")]
public virtual List<StudentGroup> StudentGroups { get; set; }
[ForeignKey("LecturerId")]
public virtual List<BasicDepartment> BasicDepartments { get; set; }
//-------------------------------------------------------------------------
public Lecturer SecurityCheck(Lecturer entity, bool allowFullData)

View File

@ -24,6 +24,9 @@ namespace CoreDatabase.Models.Department
[DataMember]
public Guid? EnrollmentYearId { get; set; }
[DataMember]
public Guid? BasicDepartmentId { get; set; }
[DataMember]
[Required]
public string Iduniv { get; set; }
@ -66,6 +69,8 @@ namespace CoreDatabase.Models.Department
public virtual EnrollmentYear EnrollmentYear { get; set; }
public virtual BasicDepartment BasicDepartment { get; set; }
//-------------------------------------------------------------------------
[ForeignKey("StudentId")]

View File

@ -0,0 +1,19 @@
using CoreModels.Tools;
using System;
using ToolsModule.ManagmentEntity;
namespace CoreModels.ModelsDepartment
{
[EntityDescription("BasicDepartment", "Базовая кафедра")]
[EntityDependency("Lecturer", "LecturerId", "Преподаватель, отвечающий за взаимодействие с предприятием")]
public interface IBasicDepartmentModel : IId
{
Guid? LecturerId { get; }
string BasicDepartmentName { get; }
string BasicDepartmentDescription { get; }
string EnterprisesName { get; }
}
}

View File

@ -6,10 +6,13 @@ namespace CoreModels.ModelsDepartment
{
[EntityDescription("Discipline", "Дисципилна кафедры")]
[EntityDependency("DisciplineBlock", "DisciplineBlockId", "Блок дисцпилн, к которому относится дисциплина")]
[EntityDependency("BasicDepartment", "BasicDepartmentId", "Базовая кафедра, к которой относится дисциплина")]
public interface IDisciplineModel : IId
{
Guid DisciplineBlockId { get; }
Guid? BasicDepartmentId { get; }
string DisciplineName { get; }
string DisciplineShortName { get; }

View File

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

View File

@ -48,6 +48,8 @@
Приказы = 111,
БазовыеКафедры = 112,
СинхронизацияПриказов = 150,
#endregion

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 BasicDepartmentBusinessLogic : GenericBusinessLogic<BasicDepartmentGetBindingModel, BasicDepartmentSetBindingModel, BasicDepartmentListViewModel, BasicDepartmentViewModel>, IBasicDepartmentLogic
{
public BasicDepartmentBusinessLogic(IBasicDepartmentService service) : base(service, "Базовые кафедры", AccessOperation.БазовыеКафедры) { }
}
}

View File

@ -41,6 +41,8 @@ namespace DepartmentBusinessLogic
DependencyManager.Instance.RegisterType<IOrderSyncHistoryLogic, OrderSyncHistoryBusinessLogic>();
DependencyManager.Instance.RegisterType<IOrderSyncHistoryRecordLogic, OrderSyncHistoryRecordBusinessLogic>();
DependencyManager.Instance.RegisterType<IBasicDepartmentLogic, BasicDepartmentBusinessLogic>();
}
}
}

View File

@ -0,0 +1,31 @@
using CoreModels.ModelsDepartment;
using System;
using System.ComponentModel.DataAnnotations;
using ToolsModule.ManagmentEntity;
namespace DepartmentContract.BindingModels
{
/// <summary>
/// Получение базовой кафедры
/// </summary>
public class BasicDepartmentGetBindingModel : GetBindingModel
{
public Guid? LecturerId { get; set; }
}
/// <summary>
/// Сохранение базовой кафедры
/// </summary>
public class BasicDepartmentSetBindingModel : SetBindingModel, IBasicDepartmentModel
{
public Guid? LecturerId { get; set; }
[Required(ErrorMessage = "required")]
public string BasicDepartmentName { get; set; }
public string BasicDepartmentDescription { get; set; }
[Required(ErrorMessage = "required")]
public string EnterprisesName { get; set; }
}
}

View File

@ -15,6 +15,11 @@ namespace DepartmentContract.BindingModels
/// </summary>
public Guid? DisciplineBlockId { get; set; }
/// <summary>
/// Выбрка по базовым кафедрам
/// </summary>
public Guid? BasicDepartmentId { get; set; }
/// <summary>
/// Поиск по названию
/// </summary>
@ -29,6 +34,8 @@ namespace DepartmentContract.BindingModels
[Required(ErrorMessage = "required")]
public Guid DisciplineBlockId { get; set; }
public Guid? BasicDepartmentId { get; set; }
[Required(ErrorMessage = "required")]
public string DisciplineName { get; set; }

View File

@ -17,6 +17,8 @@ namespace DepartmentContract.BindingModels
public Guid? EnrollmentYearId { get; set; }
public Guid? BasicDepartmentId { get; set; }
public StudentState? StudentState { get; set; }
public string NumberOfBook { get; set; }
@ -34,6 +36,8 @@ namespace DepartmentContract.BindingModels
public Guid? EnrollmentYearId { get; set; }
public Guid? BasicDepartmentId { get; set; }
[Required(ErrorMessage = "required")]
public string Iduniv { 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 IBasicDepartmentLogic : IGenericEntityLogic<BasicDepartmentGetBindingModel, BasicDepartmentSetBindingModel, BasicDepartmentListViewModel, BasicDepartmentViewModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentContract.BindingModels;
using ToolsModule.ManagmentEntity;
namespace DepartmentContract.Services.IGenericEntityService
{
/// <summary>
/// Хранение базовых кафедр
/// </summary>
public interface IBasicDepartmentService : IGenericEntityService<BasicDepartmentGetBindingModel, BasicDepartmentSetBindingModel> { }
}

View File

@ -0,0 +1,42 @@
using CoreModels.ModelsDepartment;
using System;
using ToolsModule.ManagmentEntity;
using ToolsModule.ManagmentMapping;
namespace DepartmentContract.ViewModels
{
/// <summary>
/// Список аудиторий
/// </summary>
public class BasicDepartmentListViewModel : ListViewModel<BasicDepartmentViewModel> { }
/// <summary>
/// Элемент аудитории
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 700)]
[ViewModelControlElementDependenceEntity(Title = "Дисциплины", Order = 1, ParentPropertyName = "BasicDepartmentId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlDisciplineList, DepartmentWindowsDesktop")]
[ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 2, ParentPropertyName = "BasicDepartmentId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
public class BasicDepartmentViewModel : ElementViewModel, IBasicDepartmentModel
{
[ViewModelControlElementProperty("Ответственный", ControlType.ControlGuid, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")]
public Guid? LecturerId { get; set; }
[ViewModelControlListProperty("Ответственный")]
[MapConfiguration("Lecturer.LastName")]
public string LecturerName { get; set; }
[ViewModelControlListProperty("Название", ColumnWidth = 100)]
[ViewModelControlElementProperty("Название", ControlType.ControlString, MustHaveValue = true)]
public string BasicDepartmentName { get; set; }
[ViewModelControlListProperty("Описание", ColumnWidth = 100)]
[ViewModelControlElementProperty("Описание", ControlType.ControlString)]
public string BasicDepartmentDescription { get; set; }
[ViewModelControlListProperty("Предприятие", ColumnWidth = 100)]
[ViewModelControlElementProperty("Предприятие", ControlType.ControlString, MustHaveValue = true)]
public string EnterprisesName { get; set; }
}
}

View File

@ -20,6 +20,12 @@ namespace DepartmentContract.ViewModels
[ViewModelControlElementProperty("Блок дисциплин", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlDisciplineBlockList, DepartmentWindowsDesktop")]
public Guid DisciplineBlockId { get; set; }
[ViewModelControlElementProperty("Базовая кафедра", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlBasicDepartmentList, DepartmentWindowsDesktop")]
public Guid? BasicDepartmentId { get; set; }
[ViewModelControlListProperty("Базовая кафедра")]
public bool IsBasicDepartmentId => BasicDepartmentId.HasValue ? true : false;
[ViewModelControlListProperty("Название дисциплины")]
[ViewModelControlElementProperty("Название дисциплины", ControlType.ControlString, MustHaveValue = true)]
public string DisciplineName { get; set; }

View File

@ -31,6 +31,9 @@ namespace DepartmentContract.ViewModels
[ViewModelControlElementProperty("Год выпуска", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlEnrollmentYearList, DepartmentWindowsDesktop")]
public Guid? EnrollmentYearId { get; set; }
[ViewModelControlElementProperty("Базовая кафедра", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlBasicDepartmentList, DepartmentWindowsDesktop")]
public Guid? BasicDepartmentId { get; set; }
[ViewModelControlElementProperty("Идентификатор универа", ControlType.ControlString, MustHaveValue = true, ReadOnly = true)]
public string Iduniv { get; set; }
@ -54,6 +57,9 @@ namespace DepartmentContract.ViewModels
[ViewModelControlElementProperty("Эл. почта", ControlType.ControlString, MustHaveValue = true)]
public string Email { get; set; }
[ViewModelControlListProperty("Базовая кафедра")]
public bool IsBasicDepartmentId => BasicDepartmentId.HasValue ? true : false;
[ViewModelControlElementProperty("Описание", ControlType.ControlText)]
public string Description { get; set; }

View File

@ -42,6 +42,8 @@ namespace DepartmentDatabaseImplementation
DependencyManager.Instance.RegisterType<IOrderSyncHistoryService, OrderSyncHistoryService>();
DependencyManager.Instance.RegisterType<IOrderSyncHistoryRecordService, OrderSyncHistoryRecordService>();
DependencyManager.Instance.RegisterType<IBasicDepartmentService, BasicDepartmentService>();
}
}
}

View File

@ -0,0 +1,57 @@
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>
/// Реализация интерфейса IBasicDepartmentService
/// </summary>
public class BasicDepartmentService :
AbstractGenerticEntityService<BasicDepartmentGetBindingModel, BasicDepartmentSetBindingModel, BasicDepartment, BasicDepartmentListViewModel, BasicDepartmentViewModel>,
IBasicDepartmentService
{
protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, BasicDepartmentSetBindingModel model) => OperationResultModel.Success(null);
protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, BasicDepartment entity, BasicDepartmentGetBindingModel model) => OperationResultModel.Success(null);
protected override IQueryable<BasicDepartment> AdditionalCheckingWhenReadingList(IQueryable<BasicDepartment> query, BasicDepartmentGetBindingModel model)
{
if (model.LecturerId.HasValue)
{
query = query.Where(x => x.LecturerId == model.LecturerId.Value);
}
return query;
}
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, BasicDepartmentSetBindingModel model) => OperationResultModel.Success(null);
protected override void AdditionalDeleting(DbContext context, BasicDepartment entity, BasicDepartmentGetBindingModel model)
{
var studentrecords = context.Set<Student>().Where(x => x.BasicDepartmentId == model.Id);
foreach (var record in studentrecords)
{
record.BasicDepartmentId = null;
}
context.SaveChanges();
var disciplinerecords = context.Set<Discipline>().Where(x => x.BasicDepartmentId == model.Id);
foreach (var record in disciplinerecords)
{
record.BasicDepartmentId = null;
}
context.SaveChanges();
}
protected override BasicDepartment GetUniqueEntity(BasicDepartmentSetBindingModel model, DbContext context) => context.Set<BasicDepartment>().FirstOrDefault(x => x.BasicDepartmentName == model.BasicDepartmentName && x.Id != model.Id);
protected override IQueryable<BasicDepartment> IncludingWhenReading(IQueryable<BasicDepartment> query) => query.Include(x => x.Lecturer);
protected override IQueryable<BasicDepartment> OrderingWhenReading(IQueryable<BasicDepartment> query) => query.OrderBy(x => x.BasicDepartmentName);
}
}

View File

@ -38,6 +38,10 @@ namespace DepartmentDatabaseImplementation.Implementations.AbstractGenerticEntit
{
query = query.Where(x => x.DisciplineBlockId == model.DisciplineBlockId.Value);
}
if (model.BasicDepartmentId.HasValue)
{
query = query.Where(x => x.BasicDepartmentId == model.BasicDepartmentId.Value);
}
return query;
}

View File

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

View File

@ -43,7 +43,8 @@ namespace DepartmentWindowsDesktop
new ControlStudentGroupList(),
new ControlStudentList(),
new ControlOrderList(),
new ControlOrderSyncHistoryList()
new ControlOrderSyncHistoryList(),
new ControlBasicDepartmentList()
};
foreach (var cntrl in _controls)

View File

@ -0,0 +1,33 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlBasicDepartmentElement
{
/// <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 ControlBasicDepartmentElement :
GenericControlEntityElement<BasicDepartmentGetBindingModel, BasicDepartmentSetBindingModel, BasicDepartmentListViewModel, BasicDepartmentViewModel, IBasicDepartmentLogic>,
IGenericControlEntityElement
{
public ControlBasicDepartmentElement()
{
InitializeComponent();
Title = "Базовая кафедра";
ControlId = new Guid("bce7c7f4-2b7f-4b0c-aa4b-0c7a026967c6");
_genericControlViewEntityElement = this;
}
public IControl GetInstanceGenericControl() => new ControlBasicDepartmentElement() { 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 ControlBasicDepartmentList
{
/// <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 ControlBasicDepartmentList :
GenericControlEntityList<BasicDepartmentGetBindingModel, BasicDepartmentSetBindingModel, BasicDepartmentListViewModel, BasicDepartmentViewModel, IBasicDepartmentLogic>,
IGenericControlEntityList
{
public ControlBasicDepartmentList()
{
InitializeComponent();
Title = "Базовые кафедры";
ControlId = new Guid("3f6d5487-f10d-43d9-8f5a-2059403b8946");
AccessOperation = AccessOperation.БазовыеКафедры;
ControlViewEntityElement = new ControlBasicDepartmentElement();
_genericControlViewEntityList = this;
}
public IControl GetInstanceGenericControl() => new ControlBasicDepartmentList() { 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>

View File

@ -24,7 +24,7 @@ namespace DepartmentWindowsDesktop.EntityControls
Title = "Года поступления";
ControlId = new Guid("c0b26e65-78fa-40b6-b6ab-2f9c5a0b19dc");
AccessOperation = AccessOperation.Должности;
ControlViewEntityElement = new ControlEmployeePostElement();
ControlViewEntityElement = new ControlEnrollmentYearElement();
_genericControlViewEntityList = this;
}