приказы

This commit is contained in:
kotcheshir73 2021-04-13 12:52:45 +04:00
parent 301854f284
commit d93117f01a
82 changed files with 3026 additions and 82 deletions

View File

@ -58,9 +58,38 @@ namespace DatabaseCore
modelBuilder.Entity<AcademicPlanRecordTimeNormHour>().HasIndex(d => new { d.AcademicPlanRecordId, d.TimeNormId }).IsUnique();
// ругается на циклическое каскадное удаление, так что по нормам времени убираем ее
modelBuilder.Entity<AcademicPlanRecordTimeNormHour>()
.HasOne(x => x.TimeNorm)
.WithMany(x => x.AcademicPlanRecordTimeNormHours)
.OnDelete(DeleteBehavior.NoAction);
modelBuilder.Entity<StudentGroup>().HasIndex(d => new { d.AcademicPlanId, d.EnrollmentYear, d.GroupNumber }).IsUnique();
modelBuilder.Entity<Student>().HasIndex(d => new { d.NumberOfBook }).IsUnique();
modelBuilder.Entity<Order>().HasIndex(d => new { d.OrderNumber }).IsUnique();
modelBuilder.Entity<OrderStudentRecord>().HasIndex(d => new { d.StudentId, d.OrderId }).IsUnique();
modelBuilder.Entity<OrderStudentRecord>()
.HasOne(x => x.StudentGroupFrom)
.WithMany(p => p.OrderStudentRecordFroms)
.HasForeignKey(pt => pt.StudentGroupFromId)
.OnDelete(DeleteBehavior.SetNull);
modelBuilder.Entity<OrderStudentRecord>()
.HasOne(x => x.StudentGroupTo)
.WithMany(p => p.OrderStudentRecordTos)
.HasForeignKey(pt => pt.StudentGroupToId)
.OnDelete(DeleteBehavior.NoAction);
// ругается на циклическое каскадное удаление, так что по нормам времени убираем ее
modelBuilder.Entity<OrderStudentRecord>()
.HasOne(x => x.Student)
.WithMany(x => x.OrderStudentRecords)
.OnDelete(DeleteBehavior.NoAction);
}
#region Security
@ -89,6 +118,8 @@ namespace DatabaseCore
public virtual DbSet<AcademicPlanRecordTimeNormHour> AcademicPlanRecordTimeNormHours { set; get; }
public virtual DbSet<StudentGroup> StudentGroups { set; get; }
public virtual DbSet<Student> Students { set; get; }
public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<OrderStudentRecord> OrderStudentRecords { set; get; }
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,108 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace DatabaseCore.Migrations
{
public partial class AddOrders : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Orders",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OrderNumber = table.Column<string>(type: "nvarchar(450)", nullable: false),
OrderDate = table.Column<DateTime>(type: "datetime2", nullable: false),
OrderType = 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_Orders", x => x.Id);
});
migrationBuilder.CreateTable(
name: "OrderStudentRecords",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OrderId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StudentId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
StudentGroupFromId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
StudentGroupToId = table.Column<Guid>(type: "uniqueidentifier", nullable: true),
OrderStudentMoveType = table.Column<int>(type: "int", nullable: false),
Info = 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_OrderStudentRecords", x => x.Id);
table.ForeignKey(
name: "FK_OrderStudentRecords_Orders_OrderId",
column: x => x.OrderId,
principalTable: "Orders",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_OrderStudentRecords_StudentGroups_StudentGroupFromId",
column: x => x.StudentGroupFromId,
principalTable: "StudentGroups",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
table.ForeignKey(
name: "FK_OrderStudentRecords_StudentGroups_StudentGroupToId",
column: x => x.StudentGroupToId,
principalTable: "StudentGroups",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
table.ForeignKey(
name: "FK_OrderStudentRecords_Students_StudentId",
column: x => x.StudentId,
principalTable: "Students",
principalColumn: "Id",
onDelete: ReferentialAction.NoAction);
});
migrationBuilder.CreateIndex(
name: "IX_Orders_OrderNumber",
table: "Orders",
column: "OrderNumber",
unique: true);
migrationBuilder.CreateIndex(
name: "IX_OrderStudentRecords_OrderId",
table: "OrderStudentRecords",
column: "OrderId");
migrationBuilder.CreateIndex(
name: "IX_OrderStudentRecords_StudentGroupFromId",
table: "OrderStudentRecords",
column: "StudentGroupFromId");
migrationBuilder.CreateIndex(
name: "IX_OrderStudentRecords_StudentGroupToId",
table: "OrderStudentRecords",
column: "StudentGroupToId");
migrationBuilder.CreateIndex(
name: "IX_OrderStudentRecords_StudentId_OrderId",
table: "OrderStudentRecords",
columns: new[] { "StudentId", "OrderId" },
unique: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "OrderStudentRecords");
migrationBuilder.DropTable(
name: "Orders");
}
}
}

View File

@ -591,6 +591,84 @@ namespace DatabaseCore.Migrations
b.ToTable("LecturerPosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Order", 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<DateTime>("OrderDate")
.HasColumnType("datetime2");
b.Property<string>("OrderNumber")
.IsRequired()
.HasColumnType("nvarchar(450)");
b.Property<int>("OrderType")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("OrderNumber")
.IsUnique();
b.ToTable("Orders");
});
modelBuilder.Entity("DatabaseCore.Models.Department.OrderStudentRecord", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateDelete")
.HasColumnType("datetime2");
b.Property<string>("Info")
.HasColumnType("nvarchar(max)");
b.Property<bool>("IsDeleted")
.HasColumnType("bit");
b.Property<Guid>("OrderId")
.HasColumnType("uniqueidentifier");
b.Property<int>("OrderStudentMoveType")
.HasColumnType("int");
b.Property<Guid?>("StudentGroupFromId")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("StudentGroupToId")
.HasColumnType("uniqueidentifier");
b.Property<Guid>("StudentId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("OrderId");
b.HasIndex("StudentGroupFromId");
b.HasIndex("StudentGroupToId");
b.HasIndex("StudentId", "OrderId")
.IsUnique();
b.ToTable("OrderStudentRecords");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Post", b =>
{
b.Property<Guid>("Id")
@ -1102,6 +1180,39 @@ namespace DatabaseCore.Migrations
b.Navigation("Post");
});
modelBuilder.Entity("DatabaseCore.Models.Department.OrderStudentRecord", b =>
{
b.HasOne("DatabaseCore.Models.Department.Order", "Order")
.WithMany("OrderStudentRecords")
.HasForeignKey("OrderId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupFrom")
.WithMany("OrderStudentRecordFroms")
.HasForeignKey("StudentGroupFromId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupTo")
.WithMany("OrderStudentRecordTos")
.HasForeignKey("StudentGroupToId")
.OnDelete(DeleteBehavior.SetNull);
b.HasOne("DatabaseCore.Models.Department.Student", "Student")
.WithMany("OrderStudentRecords")
.HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Order");
b.Navigation("Student");
b.Navigation("StudentGroupFrom");
b.Navigation("StudentGroupTo");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Student", b =>
{
b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroup")
@ -1234,6 +1345,11 @@ namespace DatabaseCore.Migrations
b.Navigation("Lecturers");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Order", b =>
{
b.Navigation("OrderStudentRecords");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Post", b =>
{
b.Navigation("EmployeePosts");
@ -1241,8 +1357,17 @@ namespace DatabaseCore.Migrations
b.Navigation("LecturerPosts");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Student", b =>
{
b.Navigation("OrderStudentRecords");
});
modelBuilder.Entity("DatabaseCore.Models.Department.StudentGroup", b =>
{
b.Navigation("OrderStudentRecordFroms");
b.Navigation("OrderStudentRecordTos");
b.Navigation("Students");
});

View File

@ -45,5 +45,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public AcademicPlan SecurityCheck(AcademicPlan entity, bool allowFullData) => entity;
public override string ToString() => $"{EducationDirection?.ShortName}({EducationDirection?.Profile}): {YearEntrance}-{YearFinish}";
}
}

View File

@ -68,5 +68,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public AcademicPlanRecord SecurityCheck(AcademicPlanRecord entity, bool allowFullData) => entity;
public override string ToString() => $"{Discipline} - {Semester + 1} семестр";
}
}

View File

@ -41,5 +41,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public AcademicPlanRecordTimeNormHour SecurityCheck(AcademicPlanRecordTimeNormHour entity, bool allowFullData) => entity;
public override string ToString() => $"{AcademicPlanRecord.Discipline}({(AcademicPlanRecord.Semester + 1)}) - {TimeNorm}";
}
}

View File

@ -76,5 +76,7 @@ namespace DatabaseCore.Models.Department
return entity;
}
public override string ToString() => Number;
}
}

View File

@ -49,5 +49,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public Discipline SecurityCheck(Discipline entity, bool allowFullData) => entity;
public override string ToString() => DisciplineName;
}
}

View File

@ -44,5 +44,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public DisciplineBlock SecurityCheck(DisciplineBlock entity, bool allowFullData) => entity;
public override string ToString() => Title;
}
}

View File

@ -59,5 +59,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public EducationDirection SecurityCheck(EducationDirection entity, bool allowFullData) => entity;
public override string ToString() => $"{Cipher} {ShortName}({Profile})";
}
}

View File

@ -1,5 +1,6 @@
using DatabaseCore.Models.Security;
using ModuleTools.Attributes;
using ModuleTools.Extensions;
using ModuleTools.Interfaces;
using System;
using System.Collections.Generic;
@ -92,5 +93,8 @@ namespace DatabaseCore.Models.Department
return entity;
}
public override string ToString() =>
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
}
}

View File

@ -45,5 +45,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public EmployeePost SecurityCheck(EmployeePost entity, bool allowFullData) => entity;
public override string ToString() => $"{Post}-{Employee}";
}
}

View File

@ -1,5 +1,6 @@
using DatabaseCore.Models.Security;
using ModuleTools.Attributes;
using ModuleTools.Extensions;
using ModuleTools.Interfaces;
using System;
using System.Collections.Generic;
@ -125,5 +126,8 @@ namespace DatabaseCore.Models.Department
return entity;
}
public override string ToString() =>
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
}
}

View File

@ -37,5 +37,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public LecturerAcademicDegree SecurityCheck(LecturerAcademicDegree entity, bool allowFullData) => entity;
public override string ToString() => LecturerAcademicDegreeName;
}
}

View File

@ -33,5 +33,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public LecturerAcademicRank SecurityCheck(LecturerAcademicRank entity, bool allowFullData) => entity;
public override string ToString() => LecturerAcademicRankName;
}
}

View File

@ -49,5 +49,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public LecturerPost SecurityCheck(LecturerPost entity, bool allowFullData) => entity;
public override string ToString() => $"{Lecturer}-{Post}";
}
}

View File

@ -0,0 +1,46 @@
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
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("Order", "Приказ")]
public class Order : BaseEntity, IEntitySecurityExtenstion<Order>
{
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderNumber")]
public string OrderNumber { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderDate")]
public DateTime OrderDate { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderType")]
public int OrderType { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
[ForeignKey("OrderId")]
public virtual List<OrderStudentRecord> OrderStudentRecords { get; set; }
//-------------------------------------------------------------------------
public Order SecurityCheck(Order entity, bool allowFullData) => entity;
public override string ToString() => $"№{OrderNumber} от {OrderDate.ToShortDateString()}";
}
}

View File

@ -0,0 +1,74 @@
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий запись приказа по студенту
/// </summary>
[DataContract]
[EntityDescription("OrderStudentRecord", "Запись приказа по студенту")]
[EntityDependency("Order", "OrderId", "Приказ, к которому относится запись")]
[EntityDependency("Student", "StudentId", "Студент, указанный в приказе")]
[EntityDependency("StudentGroup", "StudentGroupFromId", "Из какой группы уходит студент")]
[EntityDependency("StudentGroup", "StudentGroupToId", "В какую группу приходит студент")]
public class OrderStudentRecord : BaseEntity, IEntitySecurityExtenstion<OrderStudentRecord>
{
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderId")]
public Guid OrderId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("StudentId")]
public Guid StudentId { get; set; }
[DataMember]
[MapConfiguration("StudentGroupFromId")]
public Guid? StudentGroupFromId { get; set; }
[DataMember]
[MapConfiguration("StudentGroupToId")]
public Guid? StudentGroupToId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderStudentMoveType")]
public int OrderStudentMoveType { get; set; }
[DataMember]
[MapConfiguration("Info")]
public string Info { get; set; }
//-------------------------------------------------------------------------
public virtual Order Order { get; set; }
public virtual Student Student { get; set; }
public virtual StudentGroup StudentGroupFrom { get; set; }
public virtual StudentGroup StudentGroupTo { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
public OrderStudentRecord SecurityCheck(OrderStudentRecord entity, bool allowFullData)
{
if (!allowFullData)
{
entity.Info = string.Empty;
entity.OrderStudentMoveType = 0;
}
return entity;
}
public override string ToString() => $"{Student} {OrderStudentMoveType}";
}
}

View File

@ -38,5 +38,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public Post SecurityCheck(Post entity, bool allowFullData) => entity;
public override string ToString() => PostName;
}
}

View File

@ -1,8 +1,11 @@
using DatabaseCore.Models.Security;
using ModuleTools.Attributes;
using ModuleTools.Extensions;
using ModuleTools.Interfaces;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
@ -74,6 +77,9 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
[ForeignKey("StudentId")]
public virtual List<OrderStudentRecord> OrderStudentRecords { get; set; }
//-------------------------------------------------------------------------
public Student SecurityCheck(Student entity, bool allowFullData)
@ -87,5 +93,8 @@ namespace DatabaseCore.Models.Department
return entity;
}
public override string ToString() =>
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
}
}

View File

@ -47,8 +47,16 @@ namespace DatabaseCore.Models.Department
[ForeignKey("StudentGroupId")]
public virtual List<Student> Students { get; set; }
[ForeignKey("StudentGroupFromId")]
public virtual List<OrderStudentRecord> OrderStudentRecordFroms { get; set; }
[ForeignKey("StudentGroupToId")]
public virtual List<OrderStudentRecord> OrderStudentRecordTos { get; set; }
//-------------------------------------------------------------------------
public StudentGroup SecurityCheck(StudentGroup entity, bool allowFullData) => entity;
public override string ToString() => $"{AcademicPlan.EducationDirection.ShortName}({EnrollmentYear})-{GroupNumber}";
}
}

View File

@ -81,5 +81,7 @@ namespace DatabaseCore.Models.Department
//-------------------------------------------------------------------------
public TimeNorm SecurityCheck(TimeNorm entity, bool allowFullData) => entity;
public override string ToString() => TimeNormName;
}
}

View File

@ -46,5 +46,7 @@ namespace DatabaseCore.Models.Security
}
return entity;
}
public override string ToString() => $"{Role.RoleName}-{AccessOperation.ToString("G")}({AccessType.ToString("G")})";
}
}

View File

@ -40,5 +40,7 @@ namespace DatabaseCore.Models.Security
}
return entity;
}
public override string ToString() => Key;
}
}

View File

@ -37,5 +37,7 @@ namespace DatabaseCore.Models.Security
public Role SecurityCheck(Role entity, bool allowFullData) => entity;
public override string ToString() => RoleName;
}
}

View File

@ -78,5 +78,7 @@ namespace DatabaseCore.Models.Security
return entity;
}
public override string ToString() => UserName;
}
}

View File

@ -33,5 +33,7 @@ namespace DatabaseCore.Models.Security
//-------------------------------------------------------------------------
public UserRole SecurityCheck(UserRole entity, bool allowFullData) => entity;
public override string ToString() => $"{Role.RoleName}-{User.UserName}";
}
}

View File

@ -64,6 +64,11 @@ namespace ModuleTools.BusinessLogics
var props = customAttribute.PropertyNameFromModel.Split('.');
foreach (var prop in props)
{
if(prop == "ToString")
{
value = value.ToString();
break;
}
var bindingProperty = value.GetType().GetProperty(prop);
if (bindingProperty != null)
{
@ -82,6 +87,10 @@ namespace ModuleTools.BusinessLogics
}
else
{
if (customAttribute.PropertyNameFromModel == "ToString")
{
value = value.ToString();
}
var bindingProperty = typeFrom.GetProperty(customAttribute.PropertyNameFromModel);
if (bindingProperty != null)
{

View File

@ -46,7 +46,7 @@
Студенты = 110,
Приказы_студентов = 107,
Приказы = 111,
#endregion
// Меню Учебный процесс

View File

@ -11,5 +11,10 @@ namespace ModuleTools.ViewModels
[ViewModelControlListProperty("Идентификатор", IsHide = true)]
[MapConfiguration("Id")]
public Guid Id { get; set; }
[MapConfiguration("ToString")]
public string ElementViewString { get; set; }
public override string ToString() => ElementViewString;
}
}

View File

@ -0,0 +1,33 @@
using DepartmentBusinessLogic.Enums;
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение приказа
/// </summary>
public class OrderGetBindingModel : GetBindingModel
{
}
/// <summary>
/// Сохранение приказа
/// </summary>
public class OrderSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderNumber")]
public string OrderNumber { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderDate")]
public DateTime OrderDate { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderType")]
public OrderType OrderType { get; set; }
}
}

View File

@ -0,0 +1,47 @@
using DepartmentBusinessLogic.Enums;
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение записи приказа по студенту
/// </summary>
public class OrderStudentRecordGetBindingModel : GetBindingModel
{
public Guid? OrderId { get; set; }
public Guid? StudentId { get; set; }
public Guid? StudentGroupId { get; set; }
}
/// <summary>
/// Сохранение записи приказа по студенту
/// </summary>
public class OrderStudentRecordSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderId")]
public Guid OrderId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("StudentId")]
public Guid StudentId { get; set; }
[MapConfiguration("StudentGroupFromId")]
public Guid? StudentGroupFromId { get; set; }
[MapConfiguration("StudentGroupToId")]
public Guid? StudentGroupToId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderStudentMoveType")]
public OrderStudentMoveType OrderStudentMoveType { get; set; }
[MapConfiguration("Info")]
public string Info { get; set; }
}
}

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 OrderBusinessLogic : GenericBusinessLogic<OrderGetBindingModel, OrderSetBindingModel, OrderListViewModel, OrderViewModel>
{
public OrderBusinessLogic(IOrderService 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 OrderStudentRecordBusinessLogic : GenericBusinessLogic<OrderStudentRecordGetBindingModel, OrderStudentRecordSetBindingModel, OrderStudentRecordListViewModel, OrderStudentRecordViewModel>
{
public OrderStudentRecordBusinessLogic(IOrderStudentRecordService service) : base(service, "Приказы", AccessOperation.Приказы) { }
}
}

View File

@ -0,0 +1,38 @@
namespace DepartmentBusinessLogic.Enums
{
/// <summary>
/// Типы приказов по студентам
/// </summary>
public enum OrderStudentMoveType
{
Зачисление = 0,
Распределение = 1,
ПереводНаКурс = 3,
ПереводВГруппу = 4,
Движение = 2,
ИзАкадема = 5,
ВАкадем = 6,
ПродлАкадем = 13,
ОтчислитьЗаНеуспевамость = 7,
ОтчислитьВСвязиСПереводом = 8,
ОтчислитьПоСобственному = 9,
ЗачислитьПоПереводу = 10,
Восстановить = 11,
ОтчислитьПоЗавершению = 12,
ОтчислитьЗаНевыходСАкадема = 14
}
}

View File

@ -0,0 +1,14 @@
namespace DepartmentBusinessLogic.Enums
{
/// <summary>
/// Тип приказа
/// </summary>
public enum OrderType
{
ЗачислениеСтудентов = 0,
РаспределениеСтудентов = 1,
ДвижениеСтудентов = 2,
}
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение приказов
/// </summary>
public interface IOrderService : IGenerticEntityService<OrderGetBindingModel, OrderSetBindingModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение записей приказов по студентам
/// </summary>
public interface IOrderStudentRecordService : IGenerticEntityService<OrderStudentRecordGetBindingModel, OrderStudentRecordSetBindingModel> { }
}

View File

@ -22,7 +22,7 @@ namespace DepartmentBusinessLogic.ViewModels
public Guid AcademicPlanRecordId { get; set; }
[ViewModelControlListProperty("Дисциплина")]
[MapConfiguration("AcademicPlanRecord.Discipline.DisciplineName", IsDifficle = true)]
[MapConfiguration("AcademicPlanRecord.Discipline.ToString", IsDifficle = true)]
public string DisciplineName { get; set; }
[MapConfiguration("AcademicPlanRecord.Semester", IsDifficle = true)]
@ -36,7 +36,7 @@ namespace DepartmentBusinessLogic.ViewModels
public Guid TimeNormId { get; set; }
[ViewModelControlListProperty("Норма времени")]
[MapConfiguration("TimeNorm.TimeNormName", IsDifficle = true)]
[MapConfiguration("TimeNorm.ToString", IsDifficle = true)]
public string TimeNormName { get; set; }
[ViewModelControlListProperty("Часы", ColumnWidth = 80)]

View File

@ -28,7 +28,7 @@ namespace DepartmentBusinessLogic.ViewModels
public Guid DisciplineId { get; set; }
[ViewModelControlListProperty("Дисциплина")]
[MapConfiguration("Discipline.DisciplineName", IsDifficle = true)]
[MapConfiguration("Discipline.ToString", IsDifficle = true)]
public string DisciplineName { get; set; }
[ViewModelControlElementProperty("Преподается на кафедре", ControlType.ControlBool, MustHaveValue = true)]

View File

@ -41,7 +41,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Дата окончания", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("YearFinish")]
public int YearFinish { get; set; }
public override string ToString() =>$"{EducationDirectionCipher}: {YearEntrance}-{YearFinish}";
}
}

View File

@ -71,7 +71,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Фото", ControlType.ControlImage, Width = 200, Height = 200)]
[MapConfiguration("Photo")]
public byte[] Photo { get; set; }
public override string ToString() => Number;
}
}

View File

@ -36,7 +36,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Назв. в планах", ControlType.ControlString)]
[MapConfiguration("DisciplineBlockBlueAsteriskName")]
public string DisciplineBlockBlueAsteriskName { get; set; }
public override string ToString() => Title;
}
}

View File

@ -40,7 +40,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Название в планах", ControlType.ControlString)]
[MapConfiguration("DisciplineBlueAsteriskName")]
public string DisciplineBlueAsteriskName { get; set; }
public override string ToString() => DisciplineName;
}
}

View File

@ -58,7 +58,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Описание", ControlType.ControlText, Height = 80)]
[MapConfiguration("Description")]
public string Description { get; set; }
public override string ToString() => $"{Cipher} {ShortName}";
}
}

View File

@ -21,7 +21,7 @@ namespace DepartmentBusinessLogic.ViewModels
public Guid EmployeeId { get; set; }
[ViewModelControlListProperty("Сотрудник")]
[MapConfiguration("Employee.LastName", IsDifficle = true)]
[MapConfiguration("Employee.ToString", IsDifficle = true)]
public string EmployeeName { get; set; }
[ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlPostList, DepartmentWindowsDesktop")]
@ -29,7 +29,7 @@ namespace DepartmentBusinessLogic.ViewModels
public Guid PostId { get; set; }
[ViewModelControlListProperty("Должность")]
[MapConfiguration("Post.PostName", IsDifficle = true)]
[MapConfiguration("Post.ToString", IsDifficle = true)]
public string PostName { get; set; }
[ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")]
@ -50,7 +50,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlListProperty("Внеш. совм.", ColumnWidth = 80)]
public string ExternalCombination => IsExternalCombination ? "Да" : "Нет";
public override string ToString() => $"{EmployeeName}-{PostName}";
}
}

View File

@ -1,6 +1,5 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.Extensions;
using ModuleTools.ViewModels;
using System;
@ -77,8 +76,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Группа эл.безоп", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("GroupElectricalSafety")]
public string GroupElectricalSafety { get; set; }
public override string ToString() =>
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
}
}

View File

@ -31,7 +31,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => LecturerAcademicDegreeName;
}
}

View File

@ -26,7 +26,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => LecturerAcademicRankName;
}
}

View File

@ -21,7 +21,7 @@ namespace DepartmentBusinessLogic.ViewModels
public Guid LecturerId { get; set; }
[ViewModelControlListProperty("Преподаватель")]
[MapConfiguration("Lecturer.LastName", IsDifficle = true)]
[MapConfiguration("Lecturer.ToString", IsDifficle = true)]
public string LecturerName { get; set; }
[ViewModelControlElementProperty("Должность", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlPostList, DepartmentWindowsDesktop")]
@ -29,7 +29,7 @@ namespace DepartmentBusinessLogic.ViewModels
public Guid PostId { get; set; }
[ViewModelControlListProperty("Должность")]
[MapConfiguration("Post.PostName", IsDifficle = true)]
[MapConfiguration("Post.ToString", IsDifficle = true)]
public string PostName { get; set; }
[ViewModelControlListProperty("Ставка", ColumnWidth = 80, DefaultCellStyleFormat = "N1")]
@ -50,7 +50,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlListProperty("Внеш. совм.", ColumnWidth = 80)]
public string ExternalCombination => IsExternalCombination ? "Да" : "Нет";
public override string ToString() => $"{LecturerName}-{PostName}";
}
}

View File

@ -1,6 +1,5 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.Extensions;
using ModuleTools.ViewModels;
using System;
@ -103,8 +102,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Группа эл.безоп", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("GroupElectricalSafety")]
public string GroupElectricalSafety { get; set; }
public override string ToString() =>
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
}
}

View File

@ -0,0 +1,45 @@
using DepartmentBusinessLogic.Enums;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
using System;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список приказов
/// </summary>
public class OrderStudentRecordListViewModel : ListViewModel<OrderStudentRecordViewModel> { }
/// <summary>
/// Элемент приказа
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = false)]
public class OrderStudentRecordViewModel : ElementViewModel
{
[ViewModelControlElementProperty("Приказ", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderList, DepartmentWindowsDesktop")]
[MapConfiguration("OrderId")]
public Guid OrderId { get; set; }
[ViewModelControlElementProperty("Студент", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentId")]
public Guid StudentId { get; set; }
[ViewModelControlElementProperty("Из группы", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentGroupFromId")]
public Guid StudentGroupFromId { get; set; }
[ViewModelControlElementProperty("В группу", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentGroupList, DepartmentWindowsDesktop")]
[MapConfiguration("StudentGroupToId")]
public Guid StudentGroupToId { get; set; }
[ViewModelControlElementProperty("Тип приказа", ControlType.ControlEnum, MustHaveValue = true)]
[MapConfiguration("OrderStudentMoveType")]
public OrderStudentMoveType OrderStudentMoveType { get; set; }
[ViewModelControlListProperty("Тип приказа")]
public string OrderStudentMoveTypeTitle => OrderStudentMoveType.ToString("G");
public override string ToString() => $"";
}
}

View File

@ -0,0 +1,39 @@
using DepartmentBusinessLogic.Enums;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
using System;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список приказов
/// </summary>
public class OrderListViewModel : ListViewModel<OrderViewModel> { }
/// <summary>
/// Элемент приказа
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Записи по студентам", Order = 1, ParentPropertyName = "AcademicPlanId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")]
public class OrderViewModel : ElementViewModel
{
[ViewModelControlListProperty("Номер приказа", ColumnWidth = 120)]
[ViewModelControlElementProperty("Номер приказа", ControlType.ControlString, MustHaveValue = true)]
[MapConfiguration("OrderNumber")]
public string OrderNumber { get; set; }
[ViewModelControlListProperty("Дата приказа", ColumnWidth = 120, DefaultCellStyleFormat = "dd.MM.yyyy")]
[ViewModelControlElementProperty("Дата приказа", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("OrderDate")]
public DateTime OrderDate { get; set; }
[ViewModelControlElementProperty("Тип приказа", ControlType.ControlEnum, MustHaveValue = true)]
[MapConfiguration("OrderType")]
public OrderType OrderType { get; set; }
[ViewModelControlListProperty("Тип приказа")]
public string OrderTypeTitle => OrderType.ToString("G");
}
}

View File

@ -35,7 +35,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Порядок", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("Order")]
public int Order { get; set; }
public override string ToString() => PostName;
}
}

View File

@ -1,6 +1,5 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.Extensions;
using ModuleTools.ViewModels;
using System;
@ -17,6 +16,8 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Студенты", Order = 1, ParentPropertyName = "StudentGroupId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlStudentList, DepartmentWindowsDesktop")]
[ViewModelControlElementDependenceEntity(Title = "Приказы", Order = 1, ParentPropertyName = "StudentGroupId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")]
public class StudentGroupViewModel : ElementViewModel
{
[ViewModelControlElementProperty("Учебный план", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanList, DepartmentWindowsDesktop")]
@ -51,18 +52,8 @@ namespace DepartmentBusinessLogic.ViewModels
[MapConfiguration("LecturerId")]
public Guid? CuratorId { get; set; }
[MapConfiguration("Lecturer.LastName", IsDifficle = true)]
public string LecturerLastName { get; set; }
[MapConfiguration("Lecturer.FirstName", IsDifficle = true)]
public string LecturerFirstName { get; set; }
[MapConfiguration("Lecturer.Patronymic", IsDifficle = true)]
public string LecturerPatronymic { get; set; }
[ViewModelControlListProperty("Куратор")]
public string Lecturer => $"{LecturerLastName}{(LecturerFirstName.IsNotEmpty() ? $" {LecturerFirstName[0]}." : string.Empty)}{(LecturerPatronymic.IsNotEmpty() ? $"{LecturerPatronymic[0]}." : string.Empty)}";
public override string ToString() => GroupName;
[MapConfiguration("Lecturer.ToString", IsDifficle = true)]
public string Lecturer { get; set; }
}
}

View File

@ -1,7 +1,6 @@
using DepartmentBusinessLogic.Enums;
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.Extensions;
using ModuleTools.ViewModels;
using System;
@ -16,8 +15,8 @@ namespace DepartmentBusinessLogic.ViewModels
/// Элемент студент
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
//[ViewModelControlElementDependenceEntity(Title = "Записи учебного плана", Order = 1, ParentPropertyName = "DisciplineId",
// ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlAcademicPlanRecordList, DepartmentWindowsDesktop")]
[ViewModelControlElementDependenceEntity(Title = "Приказы по студенту", Order = 1, ParentPropertyName = "StudentId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderStudentRecordList, DepartmentWindowsDesktop")]
public class StudentViewModel : ElementViewModel
{
[ViewModelControlElementProperty("Пользователь", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlUserList, SecurityWindowsDesktop")]
@ -71,8 +70,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Староста", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("IsSteward")]
public bool IsSteward { get; set; }
public override string ToString() =>
$"{LastName}{(FirstName.IsNotEmpty() ? $" {FirstName[0]}." : string.Empty)}{(Patronymic.IsNotEmpty() ? $"{Patronymic[0]}." : string.Empty)}";
}
}

View File

@ -73,7 +73,5 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Выводить для сайта", ControlType.ControlBool, MustHaveValue = true)]
[MapConfiguration("UseInSite")]
public bool UseInSite { get; set; }
public override string ToString() => TimeNormName;
}
}

View File

@ -35,6 +35,9 @@ namespace DepartmentDatabaseImplementation
DependencyManager.Instance.RegisterType<IStudentGroupService, StudentGroupService>();
DependencyManager.Instance.RegisterType<IStudentService, StudentService>();
DependencyManager.Instance.RegisterType<IOrderService, OrderService>();
DependencyManager.Instance.RegisterType<IOrderStudentRecordService, OrderStudentRecordService>();
}
}
}

View File

@ -0,0 +1,44 @@
using DatabaseCore;
using DatabaseCore.Models.Department;
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels;
using Microsoft.EntityFrameworkCore;
using ModuleTools.Enums;
using ModuleTools.Models;
using System.Linq;
namespace DepartmentDatabaseImplementation.Implementations
{
/// <summary>
/// Реализация IOrderService
/// </summary>
public class OrderService :
AbstractGenerticEntityService<OrderGetBindingModel, OrderSetBindingModel, Order, OrderListViewModel, OrderViewModel>,
IOrderService
{
protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, OrderSetBindingModel model) => OperationResultModel.Success(null);
protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, Order entity, OrderGetBindingModel model)
{
if (context.Set<OrderStudentRecord>().Any(x => x.OrderId == model.Id && !x.IsDeleted))
{
return OperationResultModel.Error("Error:", "Есть записи приказа по студентам, относящиеся к этому приказу", ResultServiceStatusCode.ExsistItem);
}
return OperationResultModel.Success(null);
}
protected override IQueryable<Order> AdditionalCheckingWhenReadingList(IQueryable<Order> query, OrderGetBindingModel model) => query;
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, OrderSetBindingModel model) => OperationResultModel.Success(null);
protected override void AdditionalDeleting(DbContext context, Order entity, OrderGetBindingModel model) { }
protected override Order GetUniqueEntity(OrderSetBindingModel model, DbContext context) => context.Set<Order>().FirstOrDefault(x => x.OrderNumber == model.OrderNumber && x.Id != model.Id);
protected override IQueryable<Order> IncludingWhenReading(IQueryable<Order> query) => query;
protected override IQueryable<Order> OrderingWhenReading(IQueryable<Order> query) => query.OrderBy(x => x.OrderDate).ThenBy(x => x.OrderNumber);
}
}

View File

@ -0,0 +1,50 @@
using DatabaseCore;
using DatabaseCore.Models.Department;
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels;
using Microsoft.EntityFrameworkCore;
using ModuleTools.Models;
using System.Linq;
namespace DepartmentDatabaseImplementation.Implementations
{
/// <summary>
/// Реализация IOrderStudentRecordService
/// </summary>
public class OrderStudentRecordService :
AbstractGenerticEntityService<OrderStudentRecordGetBindingModel, OrderStudentRecordSetBindingModel, OrderStudentRecord, OrderStudentRecordListViewModel, OrderStudentRecordViewModel>,
IOrderStudentRecordService
{
protected override OperationResultModel AdditionalCheckingWhenAdding(DbContext context, OrderStudentRecordSetBindingModel model) => OperationResultModel.Success(null);
protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, OrderStudentRecord entity, OrderStudentRecordGetBindingModel model) => OperationResultModel.Success(null);
protected override IQueryable<OrderStudentRecord> AdditionalCheckingWhenReadingList(IQueryable<OrderStudentRecord> query, OrderStudentRecordGetBindingModel model)
{
if (model.OrderId.HasValue)
{
query = query.Where(x => x.OrderId == model.OrderId.Value);
}
if (model.StudentId.HasValue)
{
query = query.Where(x => x.StudentId == model.StudentId.Value);
}
if (model.StudentGroupId.HasValue)
{
query = query.Where(x => x.StudentGroupFromId == model.StudentGroupId.Value || x.StudentGroupToId == model.StudentGroupId.Value);
}
return query;
}
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, OrderStudentRecordSetBindingModel model) => OperationResultModel.Success(null);
protected override void AdditionalDeleting(DbContext context, OrderStudentRecord entity, OrderStudentRecordGetBindingModel model) { }
protected override OrderStudentRecord GetUniqueEntity(OrderStudentRecordSetBindingModel model, DbContext context) => context.Set<OrderStudentRecord>().FirstOrDefault(x => x.StudentId == model.StudentId && x.OrderId == model.OrderId && x.Id != model.Id);
protected override IQueryable<OrderStudentRecord> IncludingWhenReading(IQueryable<OrderStudentRecord> query) => query.Include(x => x.Order).Include(x => x.Student).Include(x => x.StudentGroupFrom).Include(x => x.StudentGroupTo);
protected override IQueryable<OrderStudentRecord> OrderingWhenReading(IQueryable<OrderStudentRecord> query) => query.OrderBy(x => x.Order.OrderDate).ThenBy(x => x.Order.OrderNumber).ThenBy(x => x.OrderStudentMoveType).ThenBy(x => x.Student.LastName).ThenBy(x => x.Student.FirstName);
}
}

View File

@ -6,6 +6,7 @@ using DepartmentBusinessLogic.ViewModels;
using Microsoft.EntityFrameworkCore;
using ModuleTools.Enums;
using ModuleTools.Models;
using System;
using System.Linq;
namespace DepartmentDatabaseImplementation.Implementations
@ -43,7 +44,16 @@ namespace DepartmentDatabaseImplementation.Implementations
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, StudentGroupSetBindingModel model) => OperationResultModel.Success(null);
protected override void AdditionalDeleting(DbContext context, StudentGroup entity, StudentGroupGetBindingModel model) { }
protected override void AdditionalDeleting(DbContext context, StudentGroup entity, StudentGroupGetBindingModel model)
{
var orders = context.Set<OrderStudentRecord>().Where(x => x.StudentGroupFromId == model.Id || x.StudentGroupToId == model.Id);
foreach (var o in orders)
{
o.IsDeleted = true;
o.DateDelete = DateTime.Now;
}
context.SaveChanges();
}
protected override StudentGroup GetUniqueEntity(StudentGroupSetBindingModel model, DbContext context) => context.Set<StudentGroup>().FirstOrDefault(x => x.AcademicPlanId == model.AcademicPlanId && x.EnrollmentYear == model.EnrollmentYear && x.GroupNumber == model.GroupNumber && x.Id != model.Id);

View File

@ -5,6 +5,7 @@ using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels;
using Microsoft.EntityFrameworkCore;
using ModuleTools.Models;
using System;
using System.Linq;
namespace DepartmentDatabaseImplementation.Implementations
@ -39,7 +40,16 @@ namespace DepartmentDatabaseImplementation.Implementations
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, StudentSetBindingModel model) => OperationResultModel.Success(null);
protected override void AdditionalDeleting(DbContext context, Student entity, StudentGetBindingModel model) { }
protected override void AdditionalDeleting(DbContext context, Student entity, StudentGetBindingModel model)
{
var orders = context.Set<OrderStudentRecord>().Where(x => x.StudentId == model.Id);
foreach (var o in orders)
{
o.IsDeleted = true;
o.DateDelete = DateTime.Now;
}
context.SaveChanges();
}
protected override Student GetUniqueEntity(StudentSetBindingModel model, DbContext context) => context.Set<Student>().FirstOrDefault(x => x.NumberOfBook == model.NumberOfBook && x.Id != model.Id);

View File

@ -44,7 +44,8 @@ namespace DepartmentWindowsDesktop
new ControlTimeNormList(),
new ControlAcademicPlanList(),
new ControlStudentGroupList(),
new ControlStudentList()
new ControlStudentList(),
new ControlOrderList()
};
foreach (var cntrl in _controls)

View File

@ -12,6 +12,9 @@ using System.Linq;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка дисциплин
/// </summary>
public partial class ControlDisciplineList :
GenericControlEntityList<DisciplineGetBindingModel, DisciplineSetBindingModel, DisciplineListViewModel, DisciplineViewModel, DisciplineBusinessLogic>,
IGenericControlEntityList

View File

@ -0,0 +1,33 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlOrderElement
{
/// <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 DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.BusinessLogics;
using DepartmentBusinessLogic.ViewModels;
using DesktopTools.Controls;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using System;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для приказа
/// </summary>
public partial class ControlOrderElement :
GenericControlEntityElement<OrderGetBindingModel, OrderSetBindingModel, OrderListViewModel, OrderViewModel, OrderBusinessLogic>,
IGenericControlEntityElement
{
public ControlOrderElement()
{
InitializeComponent();
Title = "Приказ";
ControlId = new Guid("f4637ef8-b1f4-4980-b0ef-776496e2a5dc");
_genericControlViewEntityElement = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderElement() { 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 ControlOrderList
{
/// <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,36 @@
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.BusinessLogics;
using DepartmentBusinessLogic.ViewModels;
using DesktopTools.Controls;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using ModuleTools.Enums;
using System;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка приказов
/// </summary>
public partial class ControlOrderList :
GenericControlEntityList<OrderGetBindingModel, OrderSetBindingModel, OrderListViewModel, OrderViewModel, OrderBusinessLogic>,
IGenericControlEntityList
{
public ControlOrderList()
{
InitializeComponent();
Title = "Приказы";
ControlId = new Guid("a3ba1b6e-934b-4d91-aa9a-3bcd80a929ba");
AccessOperation = AccessOperation.Приказы;
ControlViewEntityElement = new ControlOrderElement();
_genericControlViewEntityList = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderList() { ControlId = Guid.NewGuid() };
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = false
};
}
}

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 ControlOrderStudentRecordElement
{
/// <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 DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.BusinessLogics;
using DepartmentBusinessLogic.ViewModels;
using DesktopTools.Controls;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using System;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для записи приказа по студентам
/// </summary>
public partial class ControlOrderStudentRecordElement :
GenericControlEntityElement<OrderStudentRecordGetBindingModel, OrderStudentRecordSetBindingModel, OrderStudentRecordListViewModel, OrderStudentRecordViewModel, OrderStudentRecordBusinessLogic>,
IGenericControlEntityElement
{
public ControlOrderStudentRecordElement()
{
InitializeComponent();
Title = "Запись приказа по студенту";
ControlId = new Guid("6c3ffd3d-2c3e-426b-81f6-235129eceb3b");
_genericControlViewEntityElement = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderStudentRecordElement() { 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,38 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlOrderStudentRecordList
{
/// <summary>
/// Обязательная переменная конструктора.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <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,36 @@
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.BusinessLogics;
using DepartmentBusinessLogic.ViewModels;
using DesktopTools.Controls;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using ModuleTools.Enums;
using System;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка записей приказов по студентам
/// </summary>
public partial class ControlOrderStudentRecordList :
GenericControlEntityList<OrderStudentRecordGetBindingModel, OrderStudentRecordSetBindingModel, OrderStudentRecordListViewModel, OrderStudentRecordViewModel, OrderStudentRecordBusinessLogic>,
IGenericControlEntityList
{
public ControlOrderStudentRecordList()
{
InitializeComponent();
Title = "Приказы";
ControlId = new Guid("1aa8cf1f-96b0-47aa-bd20-d1563d840534");
AccessOperation = AccessOperation.Приказы;
ControlViewEntityElement = new ControlOrderElement();
_genericControlViewEntityList = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderStudentRecordList() { ControlId = Guid.NewGuid() };
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = false
};
}
}

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

@ -21,7 +21,7 @@ namespace SecurityBusinessLogic.ViewModels
public Guid RoleId { get; set; }
[ViewModelControlListProperty("Роль", ColumnWidth = 100)]
[MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)]
[MapConfiguration("Role.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)]
public string RoleName { get; set; }
[ViewModelControlElementProperty("Операция", ControlType.ControlEnum, MustHaveValue = true)]
@ -43,7 +43,5 @@ namespace SecurityBusinessLogic.ViewModels
AccessType.View => "Просмотр",
_ => "Неопределено",
};
public override string ToString() => $"{RoleName}-{AccessOperationTitle}({AccessTypeTitle})";
}
}

View File

@ -29,7 +29,5 @@ namespace SecurityBusinessLogic.ViewModels
[ViewModelControlElementProperty("Описание", ControlType.ControlText, Height = 200)]
[MapConfiguration("Description", AllowCopyWithoutRigth = false)]
public string Description { get; set; }
public override string ToString() => Key;
}
}

View File

@ -28,7 +28,5 @@ namespace SecurityBusinessLogic.ViewModels
[ViewModelControlElementProperty("Приоритет", ControlType.ControlInt, MustHaveValue = true)]
[MapConfiguration("RolePriority")]
public int RolePriority { get; set; }
public override string ToString() => RoleName;
}
}

View File

@ -21,7 +21,7 @@ namespace SecurityBusinessLogic.ViewModels
public Guid UserId { get; set; }
[ViewModelControlListProperty("Пользователь")]
[MapConfiguration("User.UserName", IsDifficle = true, AllowCopyWithoutRigth = false)]
[MapConfiguration("User.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)]
public string UserName { get; set; }
[ViewModelControlElementProperty("Роль", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "SecurityWindowsDesktop.EntityControls.ControlRoleList, SecurityWindowsDesktop")]
@ -29,9 +29,7 @@ namespace SecurityBusinessLogic.ViewModels
public Guid RoleId { get; set; }
[ViewModelControlListProperty("Роль")]
[MapConfiguration("Role.RoleName", IsDifficle = true, AllowCopyWithoutRigth = false)]
[MapConfiguration("Role.ToString", IsDifficle = true, AllowCopyWithoutRigth = false)]
public string RoleName { get; set; }
public override string ToString() => $"{RoleName}-{UserName}";
}
}

View File

@ -51,8 +51,5 @@ namespace SecurityBusinessLogic.ViewModels
[ViewModelControlElementProperty("Попытки входа", ControlType.ControlInt, ReadOnly = true)]
[MapConfiguration("CountAttempt", AllowCopyWithoutRigth = false)]
public int CountAttempt { get; set; }
public override string ToString() => Login;
}
}