Синхронизация операций

This commit is contained in:
kotcheshir73 2021-04-27 15:14:35 +04:00
parent fcad2e9815
commit b8ba47f2b9
48 changed files with 3258 additions and 16 deletions

View File

@ -120,6 +120,8 @@ namespace DatabaseCore
public virtual DbSet<Student> Students { set; get; } public virtual DbSet<Student> Students { set; get; }
public virtual DbSet<Order> Orders { set; get; } public virtual DbSet<Order> Orders { set; get; }
public virtual DbSet<OrderStudentRecord> OrderStudentRecords { set; get; } public virtual DbSet<OrderStudentRecord> OrderStudentRecords { set; get; }
public virtual DbSet<OrderSyncHistory> OrderSyncHistories { set; get; }
public virtual DbSet<OrderSyncHistoryRecord> OrderSyncHistoryRecords { set; get; }
#endregion #endregion
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,102 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
namespace DatabaseCore.Migrations
{
public partial class AddOrderSyncHistories : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrderStudentRecords_StudentGroups_StudentGroupToId",
table: "OrderStudentRecords");
migrationBuilder.DropForeignKey(
name: "FK_OrderStudentRecords_Students_StudentId",
table: "OrderStudentRecords");
migrationBuilder.CreateTable(
name: "OrderSyncHistories",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
SyncDate = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderSyncHistories", x => x.Id);
});
migrationBuilder.CreateTable(
name: "OrderSyncHistoryRecords",
columns: table => new
{
Id = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
OrderSyncHistoryId = table.Column<Guid>(type: "uniqueidentifier", nullable: false),
Information = table.Column<string>(type: "nvarchar(max)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_OrderSyncHistoryRecords", x => x.Id);
table.ForeignKey(
name: "FK_OrderSyncHistoryRecords_OrderSyncHistories_OrderSyncHistoryId",
column: x => x.OrderSyncHistoryId,
principalTable: "OrderSyncHistories",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_OrderSyncHistoryRecords_OrderSyncHistoryId",
table: "OrderSyncHistoryRecords",
column: "OrderSyncHistoryId");
migrationBuilder.AddForeignKey(
name: "FK_OrderStudentRecords_StudentGroups_StudentGroupToId",
table: "OrderStudentRecords",
column: "StudentGroupToId",
principalTable: "StudentGroups",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_OrderStudentRecords_Students_StudentId",
table: "OrderStudentRecords",
column: "StudentId",
principalTable: "Students",
principalColumn: "Id");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_OrderStudentRecords_StudentGroups_StudentGroupToId",
table: "OrderStudentRecords");
migrationBuilder.DropForeignKey(
name: "FK_OrderStudentRecords_Students_StudentId",
table: "OrderStudentRecords");
migrationBuilder.DropTable(
name: "OrderSyncHistoryRecords");
migrationBuilder.DropTable(
name: "OrderSyncHistories");
migrationBuilder.AddForeignKey(
name: "FK_OrderStudentRecords_StudentGroups_StudentGroupToId",
table: "OrderStudentRecords",
column: "StudentGroupToId",
principalTable: "StudentGroups",
principalColumn: "Id",
onDelete: ReferentialAction.SetNull);
migrationBuilder.AddForeignKey(
name: "FK_OrderStudentRecords_Students_StudentId",
table: "OrderStudentRecords",
column: "StudentId",
principalTable: "Students",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
}
}

View File

@ -16,7 +16,7 @@ namespace DatabaseCore.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.4") .HasAnnotation("ProductVersion", "5.0.5")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
modelBuilder.Entity("DatabaseCore.Models.Department.AcademicPlan", b => modelBuilder.Entity("DatabaseCore.Models.Department.AcademicPlan", b =>
@ -669,6 +669,38 @@ namespace DatabaseCore.Migrations
b.ToTable("OrderStudentRecords"); b.ToTable("OrderStudentRecords");
}); });
modelBuilder.Entity("DatabaseCore.Models.Department.OrderSyncHistory", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<DateTime>("SyncDate")
.HasColumnType("datetime2");
b.HasKey("Id");
b.ToTable("OrderSyncHistories");
});
modelBuilder.Entity("DatabaseCore.Models.Department.OrderSyncHistoryRecord", b =>
{
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<string>("Information")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<Guid>("OrderSyncHistoryId")
.HasColumnType("uniqueidentifier");
b.HasKey("Id");
b.HasIndex("OrderSyncHistoryId");
b.ToTable("OrderSyncHistoryRecords");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Post", b => modelBuilder.Entity("DatabaseCore.Models.Department.Post", b =>
{ {
b.Property<Guid>("Id") b.Property<Guid>("Id")
@ -743,7 +775,8 @@ namespace DatabaseCore.Migrations
b.Property<byte[]>("Photo") b.Property<byte[]>("Photo")
.HasColumnType("varbinary(max)"); .HasColumnType("varbinary(max)");
b.Property<Guid>("StudentGroupId") b.Property<Guid?>("StudentGroupId")
.IsRequired()
.HasColumnType("uniqueidentifier"); .HasColumnType("uniqueidentifier");
b.Property<int>("StudentState") b.Property<int>("StudentState")
@ -1196,12 +1229,12 @@ namespace DatabaseCore.Migrations
b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupTo") b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroupTo")
.WithMany("OrderStudentRecordTos") .WithMany("OrderStudentRecordTos")
.HasForeignKey("StudentGroupToId") .HasForeignKey("StudentGroupToId")
.OnDelete(DeleteBehavior.SetNull); .OnDelete(DeleteBehavior.NoAction);
b.HasOne("DatabaseCore.Models.Department.Student", "Student") b.HasOne("DatabaseCore.Models.Department.Student", "Student")
.WithMany("OrderStudentRecords") .WithMany("OrderStudentRecords")
.HasForeignKey("StudentId") .HasForeignKey("StudentId")
.OnDelete(DeleteBehavior.Cascade) .OnDelete(DeleteBehavior.NoAction)
.IsRequired(); .IsRequired();
b.Navigation("Order"); b.Navigation("Order");
@ -1213,6 +1246,17 @@ namespace DatabaseCore.Migrations
b.Navigation("StudentGroupTo"); b.Navigation("StudentGroupTo");
}); });
modelBuilder.Entity("DatabaseCore.Models.Department.OrderSyncHistoryRecord", b =>
{
b.HasOne("DatabaseCore.Models.Department.OrderSyncHistory", "OrderSyncHistory")
.WithMany("OrderSyncHistoryRecords")
.HasForeignKey("OrderSyncHistoryId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("OrderSyncHistory");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Student", b => modelBuilder.Entity("DatabaseCore.Models.Department.Student", b =>
{ {
b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroup") b.HasOne("DatabaseCore.Models.Department.StudentGroup", "StudentGroup")
@ -1350,6 +1394,11 @@ namespace DatabaseCore.Migrations
b.Navigation("OrderStudentRecords"); b.Navigation("OrderStudentRecords");
}); });
modelBuilder.Entity("DatabaseCore.Models.Department.OrderSyncHistory", b =>
{
b.Navigation("OrderSyncHistoryRecords");
});
modelBuilder.Entity("DatabaseCore.Models.Department.Post", b => modelBuilder.Entity("DatabaseCore.Models.Department.Post", b =>
{ {
b.Navigation("EmployeePosts"); b.Navigation("EmployeePosts");

View File

@ -0,0 +1,36 @@
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("OrderSyncHistory", "История синхронизации приказов")]
public class OrderSyncHistory : IdEntity, IEntitySecurityExtenstion<OrderSyncHistory>
{
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("SyncDate")]
public DateTime SyncDate { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
[ForeignKey("OrderSyncHistoryId")]
public virtual List<OrderSyncHistoryRecord> OrderSyncHistoryRecords { get; set; }
//-------------------------------------------------------------------------
public OrderSyncHistory SecurityCheck(OrderSyncHistory entity, bool allowFullData) => entity;
public override string ToString() => SyncDate.ToShortDateString();
}
}

View File

@ -0,0 +1,47 @@
using ModuleTools.Attributes;
using ModuleTools.Interfaces;
using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace DatabaseCore.Models.Department
{
/// <summary>
/// Класс, описывающий запись истории синхронизации приказов
/// </summary>
[DataContract]
[EntityDescription("OrderSyncHistoryRecord", "Дисципилна кафедры")]
[EntityDependency("OrderSyncHistory", "OrderSyncHistoryId", "История синхронизации прказов, к которой относитя запись")]
public class OrderSyncHistoryRecord : IdEntity, IEntitySecurityExtenstion<OrderSyncHistoryRecord>
{
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderSyncHistoryId")]
public Guid OrderSyncHistoryId { get; set; }
[DataMember]
[Required(ErrorMessage = "required")]
[MapConfiguration("Information")]
public string Information { get; set; }
//-------------------------------------------------------------------------
public virtual OrderSyncHistory OrderSyncHistory { get; set; }
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
public OrderSyncHistoryRecord SecurityCheck(OrderSyncHistoryRecord entity, bool allowFullData)
{
if (!allowFullData)
{
entity.Information = "скрыто";
}
return entity;
}
public override string ToString() => Information;
}
}

View File

@ -27,7 +27,7 @@ namespace DatabaseCore.Models.Department
[DataMember] [DataMember]
[Required] [Required]
[MapConfiguration("StudentGroupId")] [MapConfiguration("StudentGroupId")]
public Guid StudentGroupId { get; set; } public Guid? StudentGroupId { get; set; }
[DataMember] [DataMember]
[Required] [Required]

View File

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.Serialization; using System.Runtime.Serialization;
using System.Text;
namespace DatabaseCore.Models.Department namespace DatabaseCore.Models.Department
{ {
@ -57,6 +58,20 @@ namespace DatabaseCore.Models.Department
public StudentGroup SecurityCheck(StudentGroup entity, bool allowFullData) => entity; public StudentGroup SecurityCheck(StudentGroup entity, bool allowFullData) => entity;
public override string ToString() => $"{AcademicPlan.EducationDirection.ShortName}({EnrollmentYear})-{GroupNumber}"; public override string ToString()
{
var builder = new StringBuilder();
builder.Append(AcademicPlan?.EducationDirection?.ShortName);
builder.Append('-');
var year = DateTime.Now.Year - EnrollmentYear;
if (DateTime.Now.Month > 8)
{
year++;
}
builder.Append(year);
builder.Append(GroupNumber);
return builder.ToString();
}
} }
} }

View File

@ -132,7 +132,10 @@ namespace DatabaseCore
"Даты семестра", "Даты семестра",
"Дисциплины (модули)", "Дисциплины (модули)",
"Кафедра", "Кафедра",
"ГИА" "ГИА",
"SyncStudentOrderIpAddress",
"SyncStudentOrderUserName",
"SyncStudentOrderPassword"
}; };
foreach(var key in enviromentKeys) foreach(var key in enviromentKeys)
{ {

View File

@ -47,6 +47,8 @@
Студенты = 110, Студенты = 110,
Приказы = 111, Приказы = 111,
СинхронизацияПриказов = 150,
#endregion #endregion
// Меню Учебный процесс // Меню Учебный процесс

View File

@ -11,6 +11,9 @@ namespace DepartmentBusinessLogic.BindingModels
/// </summary> /// </summary>
public class OrderGetBindingModel : GetBindingModel public class OrderGetBindingModel : GetBindingModel
{ {
public string OrderNumber { get; set; }
public DateTime? OrderDate { get; set; }
} }
/// <summary> /// <summary>

View File

@ -0,0 +1,24 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение истории синхронизации приказов
/// </summary>
public class OrderSyncHistoryGetBindingModel : GetBindingModel
{
}
/// <summary>
/// Сохранение истории синхронизации приказов
/// </summary>
public class OrderSyncHistorySetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("SyncDate")]
public DateTime SyncDate { get; set; }
}
}

View File

@ -0,0 +1,29 @@
using ModuleTools.Attributes;
using ModuleTools.BindingModels;
using System;
using System.ComponentModel.DataAnnotations;
namespace DepartmentBusinessLogic.BindingModels
{
/// <summary>
/// Получение записи истории синхронизации приказов
/// </summary>
public class OrderSyncHistoryRecordGetBindingModel : GetBindingModel
{
public Guid? OrderSyncHistoryId { get; set; }
}
/// <summary>
/// Сохранение записи истории синхронизации приказов
/// </summary>
public class OrderSyncHistoryRecordSetBindingModel : SetBindingModel
{
[Required(ErrorMessage = "required")]
[MapConfiguration("OrderSyncHistoryId")]
public Guid OrderSyncHistoryId { get; set; }
[Required(ErrorMessage = "required")]
[MapConfiguration("Information")]
public string Information { get; set; }
}
}

View File

@ -0,0 +1,263 @@
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Enums;
using DepartmentBusinessLogic.HelperModels;
using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels;
using ModuleTools.BusinessLogics;
using ModuleTools.Enums;
using ModuleTools.Extensions;
using SecurityBusinessLogic.BindingModels;
using SecurityBusinessLogic.BusinessLogics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace DepartmentBusinessLogic.BusinessLogics
{
/// <summary>
/// Логика работы с историями синхронизации приказов
/// </summary>
public class OrderSyncHistoryBusinessLogic : GenericBusinessLogic<OrderSyncHistoryGetBindingModel, OrderSyncHistorySetBindingModel, OrderSyncHistoryListViewModel, OrderSyncHistoryViewModel>
{
public OrderSyncHistoryBusinessLogic(IOrderSyncHistoryService service) : base(service, "Синхронизация Приказов", AccessOperation.СинхронизацияПриказов) { }
public async Task<bool> SyncOrders()
{
var history = await CreateAsync(new OrderSyncHistorySetBindingModel { SyncDate = DateTime.Now });
if (history == null)
{
Errors.Add(("Ошибка создание истории", "Не удалось создать историю"));
return false;
}
var recordLogic = DependencyManager.Instance.Resolve<OrderSyncHistoryRecordBusinessLogic>();
var enviromentSettingLogic = DependencyManager.Instance.Resolve<EnviromentSettingBusinessLogic>();
var address = (await enviromentSettingLogic.GetListAsync(new EnviromentSettingGetBindingModel { Key = "SyncStudentOrderIpAddress" }))?.List?.FirstOrDefault();
if (address == null || address.Value.IsEmpty())
{
Errors = enviromentSettingLogic.Errors;
Errors.Add(("Ошибка получения данных", "Не удалось получить адрес серверая для получения приказов по студентам"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, Errors.Select(x => x.Message))
});
return false;
}
var username = (await enviromentSettingLogic.GetListAsync(new EnviromentSettingGetBindingModel { Key = "SyncStudentOrderUserName" }))?.List?.FirstOrDefault();
if (username == null || username.Value.IsEmpty())
{
Errors = enviromentSettingLogic.Errors;
Errors.Add(("Ошибка получения данных", "Не удалось получить имя пользователя для получения приказов по студентам"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, Errors.Select(x => x.Message))
});
return false;
}
var password = (await enviromentSettingLogic.GetListAsync(new EnviromentSettingGetBindingModel { Key = "SyncStudentOrderPassword" }))?.List?.FirstOrDefault();
if (password == null || password.Value.IsEmpty())
{
Errors = enviromentSettingLogic.Errors;
Errors.Add(("Ошибка получения данных", "Не удалось получить пароль для получения приказов по студентам"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, Errors.Select(x => x.Message))
});
return false;
}
var client = new HttpClient
{
BaseAddress = new Uri(address.Value)
};
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.UTF8.GetBytes($"{username.Value}:{password.Value}")));
// авторизация
// получение списка студентов
HttpResponseMessage response = await client.GetAsync($"{address.Value}/univer_Testing/hs/Ulstu_StudentsInfo/v1/GetCurrentStudentsOfDepartment");
if (!response.IsSuccessStatusCode)
{
Errors.Add(("Ошибка получения данных", "Не удалось получить список студентов с сервера"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, Errors.Select(x => x.Message))
});
return false;
}
var studentFromServer = JsonSerializer.Deserialize<StudentListSyncModel>(response.Content.ReadAsStringAsync().Result);
if (studentFromServer.CurrentStudentsList.Count == 0)
{
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = "Полученный список студентов пустой"
});
return true;
}
var groupsLogic = DependencyManager.Instance.Resolve<StudentGroupBusinessLogic>();
var groups = await groupsLogic.GetListAsync(new StudentGroupGetBindingModel());
if (groups == null || groups.List == null)
{
Errors = groupsLogic.Errors;
Errors.Add(("Ошибка получения данных", "Не удалось получить список групп"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, Errors.Select(x => x.Message))
});
return false;
}
var studentLogic = DependencyManager.Instance.Resolve<StudentBusinessLogic>();
var userLogic = DependencyManager.Instance.Resolve<UserBusinessLogic>();
foreach (var group in groups.List)
{
var students = await studentLogic.GetListAsync(new StudentGetBindingModel { StudentGroupId = group.Id });
foreach (var student in students.List)
{
var studentSync = studentFromServer.CurrentStudentsList.FirstOrDefault(x => x.recordBookName == student.NumberOfBook);
// студент не найден, значит он ушел с кафедры, выясняем почему
if (studentSync == null)
{
await SyncStudentOrders(history, student, client, address.Value, studentSync.iduniv);
}
// перевод в другую группу
else if (group.GroupName != studentSync.groupName)
{
await SyncStudentOrders(history, student, client, address.Value, studentSync.iduniv);
}
studentFromServer.CurrentStudentsList.Remove(studentSync);
}
// новые студенты в группе
var studentSyncs = studentFromServer.CurrentStudentsList.Where(x => x.groupName == group.GroupName);
foreach (var student in studentSyncs)
{
var userName = $"{student.lastName}{(student.firstName.IsNotEmpty() ? $" {student.firstName[0]}." : string.Empty)}{(student.patronymicName.IsNotEmpty() ? $"{student.patronymicName[0]}." : string.Empty)}";
var result = await userLogic.GetListAsync(new UserGetBindingModel { UserNameForSearch = userName });
var newuser = await userLogic.CreateAsync(new UserSetBindingModel
{
Login = userName,
Password = student.recordBookName
});
if (newuser == null)
{
var errors = userLogic.Errors;
errors.Add(("Ошибка создания пользователя под студента", $"Не удалось создать пользователя под студента {student.lastName} {student.firstName} {student.patronymicName}"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, errors.Select(x => x.Message))
});
continue;
}
var newStudent = await studentLogic.CreateAsync(new StudentSetBindingModel
{
UserId = newuser.Id,
FirstName = student.firstName,
LastName = student.lastName,
Patronymic = student.patronymicName,
NumberOfBook = student.recordBookName,
StudentGroupId = group.Id,
StudentState = GetStudentState(student.stateName),
Description = student.presenatationOfRecordBook
});
if (newStudent == null)
{
var errors = studentLogic.Errors;
errors.Add(("Ошибка добавления студента", $"Не удалось добавить студента {student.lastName} {student.firstName} {student.patronymicName}"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, errors.Select(x => x.Message))
});
continue;
}
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = $"Добавлен студент {newStudent}"
});
await SyncStudentOrders(history, newStudent, client, address.Value, student.iduniv);
studentFromServer.CurrentStudentsList.Remove(student);
}
}
return true;
}
private static StudentState GetStudentState(string state) => state switch
{
"Является студентом" => StudentState.Учится,
"Находится в академическом отпуске" => StudentState.Академ,
_ => StudentState.Неопределен,
};
/// <summary>
/// Синхронизация приказов по студенту
/// </summary>
/// <param name="history"></param>
/// <param name="student"></param>
/// <param name="client"></param>
/// <param name="address"></param>
/// <param name="iduniv"></param>
/// <returns></returns>
private async Task SyncStudentOrders(OrderSyncHistoryViewModel history, StudentViewModel student, HttpClient client, string address, string iduniv)
{
var recordLogic = DependencyManager.Instance.Resolve<OrderSyncHistoryRecordBusinessLogic>();
var orderLogic = DependencyManager.Instance.Resolve<OrderBusinessLogic>();
HttpResponseMessage response = await client.GetAsync($"{address}/univer_Testing/hs/Ulstu_StudentsInfo/v1/GetStudentOrdersByIdAndRecordBook?iduniv={iduniv}&recordBookName={student.NumberOfBook}&allOrders=sppd");
if (!response.IsSuccessStatusCode)
{
Errors.Add(("Ошибка получения данных", "Не удалось получить список приказов по студенту"));
await recordLogic.CreateAsync(new OrderSyncHistoryRecordSetBindingModel
{
OrderSyncHistoryId = history.Id,
Information = string.Join(Environment.NewLine, Errors.Select(x => x.Message))
});
return;
}
var syncOrders = JsonSerializer.Deserialize<StudentOrderListSyncModel>(response.Content.ReadAsStringAsync().Result);
foreach(var syncOrder in syncOrders.StudentOrders)
{
var orderType = GetOrderType(syncOrder.orderSubTypeName);
if (orderType != OrderType.Неопределено)
{
var order = await orderLogic.GetListAsync(new OrderGetBindingModel { OrderNumber = syncOrder.clericNumber, OrderDate = Convert.ToDateTime(syncOrder.clericDate) });
}
}
}
private static OrderType GetOrderType(string orderTitle) => orderTitle switch
{
"Зачисление в вуз" => OrderType.ЗачислениеСтудентов,
"Распределение по группам" => OrderType.РаспределениеСтудентов,
"Перевод на следующий курс" => OrderType.ДвижениеСтудентов,
_ => OrderType.Неопределено,
};
}
}

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 OrderSyncHistoryRecordBusinessLogic : GenericBusinessLogic<OrderSyncHistoryRecordGetBindingModel, OrderSyncHistoryRecordSetBindingModel, OrderSyncHistoryRecordListViewModel, OrderSyncHistoryRecordViewModel>
{
public OrderSyncHistoryRecordBusinessLogic(IOrderSyncHistoryRecordService service) : base(service, "Синхронизация Приказов", AccessOperation.СинхронизацияПриказов) { }
}
}

View File

@ -6,6 +6,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\..\Common\ModuleTools\ModuleTools.csproj" /> <ProjectReference Include="..\..\Common\ModuleTools\ModuleTools.csproj" />
<ProjectReference Include="..\..\Security\SecurityBusinessLogic\SecurityBusinessLogic.csproj" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">

View File

@ -5,6 +5,8 @@
/// </summary> /// </summary>
public enum OrderType public enum OrderType
{ {
Неопределено = -1,
ЗачислениеСтудентов = 0, ЗачислениеСтудентов = 0,
РаспределениеСтудентов = 1, РаспределениеСтудентов = 1,

View File

@ -11,6 +11,8 @@
Завершил = 2, Завершил = 2,
Отчислен = 3 Отчислен = 3,
Неопределен = -1
} }
} }

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace DepartmentBusinessLogic.HelperModels
{
/// <summary>
/// Класс-модель для списка студентов из 1С
/// </summary>
public class StudentListSyncModel
{
public List<StudentSyncModel> CurrentStudentsList { get; set; }
}
}

View File

@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace DepartmentBusinessLogic.HelperModels
{
/// <summary>
/// Класс-модель для списка приказов по студенту из 1С
/// </summary>
public class StudentOrderListSyncModel
{
public List<StudentOrderSyncModel> StudentOrders { get; set; }
}
}

View File

@ -0,0 +1,20 @@
namespace DepartmentBusinessLogic.HelperModels
{
/// <summary>
/// Класс-модель для приказа по студенту из 1С
/// </summary>
public class StudentOrderSyncModel
{
public string clericNumber { get; set; }
public string clericDate { get; set; }
public string orderTypeName { get; set; }
public string orderSubTypeName { get; set; }
public string groupNameBefore { get; set; }
public string groupNameAfter { get; set; }
}
}

View File

@ -0,0 +1,28 @@
namespace DepartmentBusinessLogic.HelperModels
{
/// <summary>
/// Класс-модель для студента из 1С
/// </summary>
public class StudentSyncModel
{
public string iduniv { get; set; }
public string recordBookName { get; set; }
public string lastName { get; set; }
public string firstName { get; set; }
public string patronymicName { get; set; }
public string groupName { get; set; }
public string studyFormName { get; set; }
public string stateName { get; set; }
public string payBasisName { get; set; }
public string presenatationOfRecordBook { get; set; }
}
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение записей историй синхронизации приказов
/// </summary>
public interface IOrderSyncHistoryRecordService : IGenerticEntityService<OrderSyncHistoryRecordGetBindingModel, OrderSyncHistoryRecordSetBindingModel> { }
}

View File

@ -0,0 +1,10 @@
using DepartmentBusinessLogic.BindingModels;
using ModuleTools.Interfaces;
namespace DepartmentBusinessLogic.Interfaces
{
/// <summary>
/// Хранение историй синхронизации приказов
/// </summary>
public interface IOrderSyncHistoryService : IGenerticEntityService<OrderSyncHistoryGetBindingModel, OrderSyncHistorySetBindingModel> { }
}

View File

@ -0,0 +1,32 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
using System;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список записей историй синхронизации приказов
/// </summary>
public class OrderSyncHistoryRecordListViewModel : ListViewModel<OrderSyncHistoryRecordViewModel> { }
/// <summary>
/// Элемент записи историй синхронизации приказов
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = false, Width = 800, Height = 500)]
public class OrderSyncHistoryRecordViewModel : ElementViewModel
{
[ViewModelControlElementProperty("История", ControlType.ControlGuid, MustHaveValue = true, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderSyncHistoryList, DepartmentWindowsDesktop")]
[MapConfiguration("OrderSyncHistoryId")]
public Guid OrderSyncHistoryId { get; set; }
[ViewModelControlListProperty("Дата", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")]
[MapConfiguration("OrderSyncHistory.SyncDate", IsDifficle = true)]
public DateTime SyncDate { get; set; }
[ViewModelControlListProperty("Описание")]
[ViewModelControlElementProperty("Описание", ControlType.ControlText, Height = 200, MustHaveValue = true)]
[MapConfiguration("Information")]
public string Information { get; set; }
}
}

View File

@ -0,0 +1,30 @@
using ModuleTools.Attributes;
using ModuleTools.Enums;
using ModuleTools.ViewModels;
namespace DepartmentBusinessLogic.ViewModels
{
/// <summary>
/// Список историй синхронизации приказов
/// </summary>
public class OrderSyncHistoryListViewModel : ListViewModel<OrderSyncHistoryViewModel> { }
/// <summary>
/// Элемент история синхронизации приказов
/// </summary>
[ViewModelControlElementClass(HaveDependenceEntities = true, Width = 800, Height = 500)]
[ViewModelControlElementDependenceEntity(Title = "Записи", Order = 1, ParentPropertyName = "OrderSyncHistoryId",
ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlOrderSyncHistoryRecordList, DepartmentWindowsDesktop")]
public class OrderSyncHistoryViewModel : ElementViewModel
{
[ViewModelControlListProperty("Дата", ColumnWidth = 100, DefaultCellStyleFormat = "dd.MM.yyyy")]
[ViewModelControlElementProperty("Дата", ControlType.ControlDateTime, MustHaveValue = true, ReadOnly = true)]
[MapConfiguration("SyncDate")]
public string SyncDate { get; set; }
[ViewModelControlListProperty("События")]
[ViewModelControlElementProperty("События", ControlType.ControlText, MustHaveValue = true, ReadOnly = true, Width = 300, Height = 500)]
[MapConfiguration("History")]
public string History { get; set; }
}
}

View File

@ -25,7 +25,7 @@ namespace DepartmentBusinessLogic.ViewModels
public string OrderNumber { get; set; } public string OrderNumber { get; set; }
[ViewModelControlListProperty("Дата приказа", ColumnWidth = 120, DefaultCellStyleFormat = "dd.MM.yyyy")] [ViewModelControlListProperty("Дата приказа", ColumnWidth = 120, DefaultCellStyleFormat = "dd.MM.yyyy")]
[ViewModelControlElementProperty("Дата приказа", ControlType.ControlInt, MustHaveValue = true)] [ViewModelControlElementProperty("Дата приказа", ControlType.ControlDateTime, MustHaveValue = true)]
[MapConfiguration("OrderDate")] [MapConfiguration("OrderDate")]
public DateTime OrderDate { get; set; } public DateTime OrderDate { get; set; }

View File

@ -2,6 +2,7 @@
using ModuleTools.Enums; using ModuleTools.Enums;
using ModuleTools.ViewModels; using ModuleTools.ViewModels;
using System; using System;
using System.Text;
namespace DepartmentBusinessLogic.ViewModels namespace DepartmentBusinessLogic.ViewModels
{ {
@ -36,7 +37,24 @@ namespace DepartmentBusinessLogic.ViewModels
public string AcademicPlanEducationDirectionShortName { get; set; } public string AcademicPlanEducationDirectionShortName { get; set; }
[ViewModelControlListProperty("Группа")] [ViewModelControlListProperty("Группа")]
public string GroupName => $"{AcademicPlanEducationDirectionShortName}({EnrollmentYear})-{GroupNumber}"; public string GroupName
{
get
{
var builder = new StringBuilder();
builder.Append(AcademicPlanEducationDirectionShortName);
builder.Append('-');
var year = DateTime.Now.Year - EnrollmentYear;
if (DateTime.Now.Month > 8)
{
year++;
}
builder.Append(year);
builder.Append(GroupNumber);
return builder.ToString();
}
}
[ViewModelControlListProperty("Номер группы")] [ViewModelControlListProperty("Номер группы")]
[ViewModelControlElementProperty("Номер группы", ControlType.ControlInt, MustHaveValue = true, MinValue = 1, MaxValue = 4)] [ViewModelControlElementProperty("Номер группы", ControlType.ControlInt, MustHaveValue = true, MinValue = 1, MaxValue = 4)]
@ -50,7 +68,7 @@ namespace DepartmentBusinessLogic.ViewModels
[ViewModelControlElementProperty("Куратор", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")] [ViewModelControlElementProperty("Куратор", ControlType.ControlGuid, MustHaveValue = false, ReadOnly = false, ControlTypeObject = "DepartmentWindowsDesktop.EntityControls.ControlLecturerList, DepartmentWindowsDesktop")]
[MapConfiguration("LecturerId")] [MapConfiguration("LecturerId")]
public Guid? CuratorId { get; set; } public Guid? LecturerId { get; set; }
[ViewModelControlListProperty("Куратор")] [ViewModelControlListProperty("Куратор")]
[MapConfiguration("Lecturer.ToString", IsDifficle = true)] [MapConfiguration("Lecturer.ToString", IsDifficle = true)]

View File

@ -38,6 +38,9 @@ namespace DepartmentDatabaseImplementation
DependencyManager.Instance.RegisterType<IOrderService, OrderService>(); DependencyManager.Instance.RegisterType<IOrderService, OrderService>();
DependencyManager.Instance.RegisterType<IOrderStudentRecordService, OrderStudentRecordService>(); DependencyManager.Instance.RegisterType<IOrderStudentRecordService, OrderStudentRecordService>();
DependencyManager.Instance.RegisterType<IOrderSyncHistoryService, OrderSyncHistoryService>();
DependencyManager.Instance.RegisterType<IOrderSyncHistoryRecordService, OrderSyncHistoryRecordService>();
} }
} }
} }

View File

@ -5,6 +5,7 @@ using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels; using DepartmentBusinessLogic.ViewModels;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ModuleTools.Enums; using ModuleTools.Enums;
using ModuleTools.Extensions;
using ModuleTools.Models; using ModuleTools.Models;
using System.Linq; using System.Linq;
@ -28,7 +29,15 @@ namespace DepartmentDatabaseImplementation.Implementations
return OperationResultModel.Success(null); return OperationResultModel.Success(null);
} }
protected override IQueryable<Order> AdditionalCheckingWhenReadingList(IQueryable<Order> query, OrderGetBindingModel model) => query; protected override IQueryable<Order> AdditionalCheckingWhenReadingList(IQueryable<Order> query, OrderGetBindingModel model)
{
if(model.OrderDate.HasValue && model.OrderNumber.IsNotEmpty())
{
query = query.Where(x => x.OrderNumber == model.OrderNumber && x.OrderDate == model.OrderDate);
}
return query;
}
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, OrderSetBindingModel model) => OperationResultModel.Success(null); protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, OrderSetBindingModel model) => OperationResultModel.Success(null);

View File

@ -0,0 +1,107 @@
using DatabaseCore;
using DatabaseCore.Models.Department;
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels;
using Microsoft.EntityFrameworkCore;
using ModuleTools.BusinessLogics;
using ModuleTools.Enums;
using ModuleTools.Models;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace DepartmentDatabaseImplementation.Implementations
{
/// <summary>
/// Реализация IOrderSyncHistoryRecordService
/// </summary>
public class OrderSyncHistoryRecordService : IOrderSyncHistoryRecordService
{
public async Task<OperationResultModel> CreateAsync(OrderSyncHistoryRecordSetBindingModel model)
{
using var context = DatabaseManager.GetContext;
var entity = Mapper.MapToClass<OrderSyncHistoryRecordSetBindingModel, OrderSyncHistoryRecord>(model, true);
await context.OrderSyncHistoryRecords.AddAsync(entity);
await context.SaveChangesAsync();
return OperationResultModel.Success(Mapper.MapToClass<OrderSyncHistoryRecord, OrderSyncHistoryRecordViewModel>(entity, true));
}
public async Task<OperationResultModel> DeleteAsync(OrderSyncHistoryRecordGetBindingModel model)
{
using var context = DatabaseManager.GetContext;
var entity = context.OrderSyncHistoryRecords.FirstOrDefault(x => x.Id == model.Id);
if (entity == null)
{
return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound);
}
context.OrderSyncHistoryRecords.Remove(entity);
await context.SaveChangesAsync();
return OperationResultModel.Success(true);
}
public async Task<OperationResultModel> ReadAsync(OrderSyncHistoryRecordGetBindingModel model)
{
int countPages = 0;
using var context = DatabaseManager.GetContext;
// для одной записи
if (model.Id.HasValue)
{
var entity = context.OrderSyncHistoryRecords.FirstOrDefault(x => x.Id == model.Id.Value);
if (entity == null)
{
return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound);
}
return OperationResultModel.Success(Mapper.MapToClass<OrderSyncHistoryRecord, OrderSyncHistoryRecordViewModel>(entity, model.HaveRight));
}
var query = context.OrderSyncHistoryRecords.AsQueryable();
if(model.OrderSyncHistoryId.HasValue)
{
query = query.Where(x => x.OrderSyncHistoryId == model.OrderSyncHistoryId.Value);
}
query = query.OrderByDescending(x => x.Information);
query = query.Include(x => x.OrderSyncHistory);
return await Task.Run(() =>
{
if (model.PageNumber.HasValue && model.PageSize.HasValue)
{
countPages = (int)Math.Ceiling((double)query.Count() / model.PageSize.Value);
query = query
.Skip(model.PageSize.Value * model.PageNumber.Value)
.Take(model.PageSize.Value);
}
var result = new OrderSyncHistoryRecordListViewModel
{
MaxCount = countPages,
List = query.Select(x => Mapper.MapToClass<OrderSyncHistoryRecord, OrderSyncHistoryRecordViewModel>(x, model.HaveRight)).ToList()
};
return OperationResultModel.Success(result);
});
}
public async Task<OperationResultModel> UpdateAsync(OrderSyncHistoryRecordSetBindingModel model)
{
using var context = DatabaseManager.GetContext;
var entity = context.OrderSyncHistoryRecords.FirstOrDefault(x => x.Id == model.Id);
if (entity == null)
{
return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound);
}
entity = Mapper.MapToClass(model, entity, true);
await context.SaveChangesAsync();
return OperationResultModel.Success(Mapper.MapToClass<OrderSyncHistoryRecord, OrderSyncHistoryRecordViewModel>(entity, true));
}
}
}

View File

@ -0,0 +1,115 @@
using DatabaseCore;
using DatabaseCore.Models.Department;
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.Interfaces;
using DepartmentBusinessLogic.ViewModels;
using ModuleTools.BusinessLogics;
using ModuleTools.Enums;
using ModuleTools.Models;
using System;
using System.Linq;
using System.Threading.Tasks;
namespace DepartmentDatabaseImplementation.Implementations
{
/// <summary>
/// Реализация IOrderSyncHistoryService
/// </summary>
public class OrderSyncHistoryService : IOrderSyncHistoryService
{
public async Task<OperationResultModel> CreateAsync(OrderSyncHistorySetBindingModel model)
{
using var context = DatabaseManager.GetContext;
var entity = Mapper.MapToClass<OrderSyncHistorySetBindingModel, OrderSyncHistory>(model, true);
await context.OrderSyncHistories.AddAsync(entity);
await context.SaveChangesAsync();
return OperationResultModel.Success(Mapper.MapToClass<OrderSyncHistory, OrderSyncHistoryViewModel>(entity, true));
}
public async Task<OperationResultModel> DeleteAsync(OrderSyncHistoryGetBindingModel model)
{
using var context = DatabaseManager.GetContext;
using var transaction = context.Database.BeginTransaction();
try
{
var entity = context.OrderSyncHistories.FirstOrDefault(x => x.Id == model.Id);
if (entity == null)
{
return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound);
}
context.OrderSyncHistories.Remove(entity);
await context.SaveChangesAsync();
var records = context.OrderSyncHistoryRecords.Where(x => x.OrderSyncHistoryId == model.Id);
context.OrderSyncHistoryRecords.RemoveRange(records);
await context.SaveChangesAsync();
await transaction.CommitAsync();
}
catch (Exception)
{
await transaction.RollbackAsync();
throw;
}
return OperationResultModel.Success(true);
}
public async Task<OperationResultModel> ReadAsync(OrderSyncHistoryGetBindingModel model)
{
int countPages = 0;
using var context = DatabaseManager.GetContext;
// для одной записи
if (model.Id.HasValue)
{
var entity = context.OrderSyncHistories.FirstOrDefault(x => x.Id == model.Id.Value);
if (entity == null)
{
return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound);
}
return OperationResultModel.Success(Mapper.MapToClass<OrderSyncHistory, OrderSyncHistoryViewModel>(entity, model.HaveRight));
}
var query = context.OrderSyncHistories.AsQueryable();
query = query.OrderByDescending(x => x.SyncDate);
return await Task.Run(() =>
{
if (model.PageNumber.HasValue && model.PageSize.HasValue)
{
countPages = (int)Math.Ceiling((double)query.Count() / model.PageSize.Value);
query = query
.Skip(model.PageSize.Value * model.PageNumber.Value)
.Take(model.PageSize.Value);
}
var result = new OrderSyncHistoryListViewModel
{
MaxCount = countPages,
List = query.Select(x => Mapper.MapToClass<OrderSyncHistory, OrderSyncHistoryViewModel>(x, model.HaveRight)).ToList()
};
return OperationResultModel.Success(result);
});
}
public async Task<OperationResultModel> UpdateAsync(OrderSyncHistorySetBindingModel model)
{
using var context = DatabaseManager.GetContext;
var entity = context.OrderSyncHistories.FirstOrDefault(x => x.Id == model.Id);
if (entity == null)
{
return OperationResultModel.Error("Error:", "Элемент не найден", ResultServiceStatusCode.NotFound);
}
entity = Mapper.MapToClass(model, entity, true);
await context.SaveChangesAsync();
return OperationResultModel.Success(Mapper.MapToClass<OrderSyncHistory, OrderSyncHistoryViewModel>(entity, true));
}
}
}

View File

@ -59,6 +59,6 @@ namespace DepartmentDatabaseImplementation.Implementations
protected override IQueryable<StudentGroup> IncludingWhenReading(IQueryable<StudentGroup> query) => query.Include(x => x.AcademicPlan).Include(x => x.AcademicPlan.EducationDirection).Include(x => x.Lecturer); protected override IQueryable<StudentGroup> IncludingWhenReading(IQueryable<StudentGroup> query) => query.Include(x => x.AcademicPlan).Include(x => x.AcademicPlan.EducationDirection).Include(x => x.Lecturer);
protected override IQueryable<StudentGroup> OrderingWhenReading(IQueryable<StudentGroup> query) => query.OrderBy(x => x.EnrollmentYear).ThenBy(x => x.GroupNumber); protected override IQueryable<StudentGroup> OrderingWhenReading(IQueryable<StudentGroup> query) => query.OrderBy(x => x.AcademicPlan.EducationDirection.Cipher).ThenBy(x => x.EnrollmentYear).ThenBy(x => x.GroupNumber);
} }
} }

View File

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

View File

@ -0,0 +1,33 @@

namespace DepartmentWindowsDesktop.EntityControls
{
partial class ControlOrderSyncHistoryElement
{
/// <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 ControlOrderSyncHistoryElement :
GenericControlEntityElement<OrderSyncHistoryGetBindingModel, OrderSyncHistorySetBindingModel, OrderSyncHistoryListViewModel, OrderSyncHistoryViewModel, OrderSyncHistoryBusinessLogic>,
IGenericControlEntityElement
{
public ControlOrderSyncHistoryElement()
{
InitializeComponent();
Title = "История синхронизации приказа";
ControlId = new Guid("34368ebc-f657-45b3-93c8-4fba732a1457");
_genericControlViewEntityElement = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderSyncHistoryElement() { 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 ControlOrderSyncHistoryList
{
/// <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,64 @@
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.BusinessLogics;
using DepartmentBusinessLogic.ViewModels;
using DesktopTools.Controls;
using DesktopTools.Enums;
using DesktopTools.Helpers;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using ModuleTools.Enums;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка историй синхронизации приказов
/// </summary>
public partial class ControlOrderSyncHistoryList :
GenericControlEntityList<OrderSyncHistoryGetBindingModel, OrderSyncHistorySetBindingModel, OrderSyncHistoryListViewModel, OrderSyncHistoryViewModel, OrderSyncHistoryBusinessLogic>,
IGenericControlEntityList
{
public ControlOrderSyncHistoryList()
{
InitializeComponent();
Title = "Синхронизация Приказов";
ControlId = new Guid("7b857c17-405e-40fb-961f-7fe74fddf84e");
AccessOperation = AccessOperation.СинхронизацияПриказов;
ControlViewEntityElement = new ControlPostElement();
_genericControlViewEntityList = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderSyncHistoryList() { ControlId = Guid.NewGuid() };
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = false,
HideToolStripButton = new List<ToolStripButtonListNames>
{
ToolStripButtonListNames.toolStripButtonAdd,
ToolStripButtonListNames.toolStripButtonUpd,
ToolStripButtonListNames.toolStripButtonDel,
ToolStripButtonListNames.toolStripButtonSearch
},
ControlOnMoveElem = new()
{
{ "ToolStripMenuItemSyncOrders", ("Синхронизировать студентов", async (object sender, EventArgs e) => { await SyncOrders(); }) }
}
};
/// <summary>
/// Синхронизация приказов
/// </summary>
/// <returns></returns>
private async Task SyncOrders()
{
var flag = await _businessLogic.SyncOrders();
if (!flag)
{
DialogHelper.MessageException(_businessLogic.Errors, "Ошибки при синхронизации");
}
}
}
}

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 ControlOrderSyncHistoryRecordElement
{
/// <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 ControlOrderSyncHistoryRecordElement :
GenericControlEntityElement<OrderSyncHistoryRecordGetBindingModel, OrderSyncHistoryRecordSetBindingModel, OrderSyncHistoryRecordListViewModel, OrderSyncHistoryRecordViewModel, OrderSyncHistoryRecordBusinessLogic>,
IGenericControlEntityElement
{
public ControlOrderSyncHistoryRecordElement()
{
InitializeComponent();
Title = "Запись истории синхронизации приказа";
ControlId = new Guid("2a13536d-47cb-49f0-9d05-82f69c8f2007");
_genericControlViewEntityElement = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderSyncHistoryRecordElement() { 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 ControlOrderSyncHistoryRecordList
{
/// <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,45 @@
using DepartmentBusinessLogic.BindingModels;
using DepartmentBusinessLogic.BusinessLogics;
using DepartmentBusinessLogic.ViewModels;
using DesktopTools.Controls;
using DesktopTools.Enums;
using DesktopTools.Interfaces;
using DesktopTools.Models;
using ModuleTools.Enums;
using System;
using System.Collections.Generic;
namespace DepartmentWindowsDesktop.EntityControls
{
/// <summary>
/// Реализация контрола для списка записей истории синхронизации приказов
/// </summary>
public partial class ControlOrderSyncHistoryRecordList :
GenericControlEntityList<OrderSyncHistoryRecordGetBindingModel, OrderSyncHistoryRecordSetBindingModel, OrderSyncHistoryRecordListViewModel, OrderSyncHistoryRecordViewModel, OrderSyncHistoryRecordBusinessLogic>,
IGenericControlEntityList
{
public ControlOrderSyncHistoryRecordList()
{
InitializeComponent();
Title = "Записи Синхронизации Приказов";
ControlId = new Guid("8d18e9fa-f056-47c8-b83d-f06f6bf553c2");
AccessOperation = AccessOperation.СинхронизацияПриказов;
ControlViewEntityElement = new ControlPostElement();
_genericControlViewEntityList = this;
}
public IControl GetInstanceGenericControl() => new ControlOrderSyncHistoryRecordList() { ControlId = Guid.NewGuid() };
public ControlViewEntityListConfiguration GetConfigControl() => new()
{
PaginationOn = false,
HideToolStripButton = new List<ToolStripButtonListNames>
{
ToolStripButtonListNames.toolStripButtonAdd,
ToolStripButtonListNames.toolStripButtonUpd,
ToolStripButtonListNames.toolStripButtonDel,
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

@ -7,7 +7,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.4"> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.5">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

View File

@ -1,6 +1,7 @@
using DatabaseCore; using DatabaseCore;
using DatabaseCore.Models.Security; using DatabaseCore.Models.Security;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ModuleTools.Extensions;
using ModuleTools.Models; using ModuleTools.Models;
using SecurityBusinessLogic.BindingModels; using SecurityBusinessLogic.BindingModels;
using SecurityBusinessLogic.Interfaces; using SecurityBusinessLogic.Interfaces;
@ -20,7 +21,15 @@ namespace SecurityDatabaseImplementation.Implementations
protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, EnviromentSetting entity, EnviromentSettingGetBindingModel model) => OperationResultModel.Success(null); protected override OperationResultModel AdditionalCheckingWhenDeleting(DbContext context, EnviromentSetting entity, EnviromentSettingGetBindingModel model) => OperationResultModel.Success(null);
protected override IQueryable<EnviromentSetting> AdditionalCheckingWhenReadingList(IQueryable<EnviromentSetting> query, EnviromentSettingGetBindingModel model) => query; protected override IQueryable<EnviromentSetting> AdditionalCheckingWhenReadingList(IQueryable<EnviromentSetting> query, EnviromentSettingGetBindingModel model)
{
if(model.Key.IsNotEmpty())
{
query = query.Where(x => x.Key == model.Key);
}
return query;
}
protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, EnviromentSettingSetBindingModel model) => OperationResultModel.Success(null); protected override OperationResultModel AdditionalCheckingWhenUpdateing(DbContext context, EnviromentSettingSetBindingModel model) => OperationResultModel.Success(null);