681 lines
54 KiB
C#
681 lines
54 KiB
C#
using Microsoft.EntityFrameworkCore;
|
||
using PARR.Core.Extensions;
|
||
using PARR.Domain.Common.Roles;
|
||
using PARR.Domain.Common.Template;
|
||
using PARR.Domain.Entities;
|
||
using PARR.Domain.Entities.Job;
|
||
using PARR.Domain.Entities.JobGroupEntities;
|
||
using PARR.Domain.Entities.RobotEntities;
|
||
using PARR.Domain.Entities.Schedule;
|
||
using PARR.Domain.Entities.TaskEntities;
|
||
using PARR.Domain.Entities.Unit;
|
||
using PARR.Domain.Enums;
|
||
using PARR.Domain.Settings;
|
||
|
||
namespace PARR.DAL.Context
|
||
{
|
||
internal class DataContext : DbContext
|
||
{
|
||
public DataContext(DbContextOptions<DataContext> options) : base(options) { }
|
||
|
||
//public DbSet<Host> Hosts { get; set; }
|
||
//public DbSet<WorkGroup> WorkGroups { get; set; }
|
||
//public DbSet<AppInWorkInWorkGroup> AppInWorkInWorkGroups { get; set; }
|
||
//public DbSet<EkStatus> EkStatuses { get; set; }
|
||
//public DbSet<ResponseArea> ResponseAreas { get; set; }
|
||
//public DbSet<Application> Applications { get; set; }
|
||
//public DbSet<ApplicationType> ApplicationTypes { get; set; }
|
||
//public DbSet<ApplicationInHost> ApplicationsInHosts { get; set; }
|
||
|
||
public DbSet<Template> Templates { get; set; }
|
||
public DbSet<TemplateHistory> TemplateHistories { get; set; }
|
||
public DbSet<TemplateStatusType> TemplateStatusTypes { get; set; }
|
||
public DbSet<Domain.Entities.TaskStatus> TaskStatuses { get; set; }
|
||
public DbSet<RobotStatus> RobotStatuses { get; set; }
|
||
|
||
public DbSet<Process> Processes { get; set; }
|
||
public DbSet<Subprocess> Subprocesses { get; set; }
|
||
public DbSet<Tnk> Tnks { get; set; }
|
||
|
||
//public DbSet<ApplicationsInWork> ApplicationsInWorks { get; set; }
|
||
|
||
public DbSet<Setting> Setting { get; set; }
|
||
|
||
public DbSet<RobotHistoryLevel> RobotHistoryLevels { get; set; }
|
||
|
||
public DbSet<Robot> Robots { get; set; }
|
||
public DbSet<RobotConfiguration> RobotConfigurations { get; set; }
|
||
public DbSet<RobotHistory> RobotHistories { get; set; }
|
||
|
||
#region Schedule
|
||
|
||
public DbSet<EsppSchType> EsppSchTypes { get; set; }
|
||
public DbSet<EsppSchTypeValue> EsppSchTypeValues { get; set; }
|
||
public DbSet<EsppSchTypeConfig> EsppSchTypeConfigs { get; set; }
|
||
public DbSet<EsppSchTypeSchedule> EsppSchTypeSchedules { get; set; }
|
||
public DbSet<EsppSchValue> EsppSchValues { get; set; }
|
||
|
||
public DbSet<ScheduleExcludeTypeCalendar> ScheduleExcludeTypeCalendars { get; set; }
|
||
public DbSet<ScheduleExcludeType> ScheduleExcludeTypes { get; set; }
|
||
public DbSet<ScheduleResponseAreaTimeOffset> ScheduleResponseAreaTimeOffsets { get; set; }
|
||
|
||
#endregion
|
||
|
||
public DbSet<AgentHistory> AgentHistories { get; set; }
|
||
public DbSet<AgentHistoryLevel> AgentHistoryLevels { get; set; }
|
||
|
||
public DbSet<Order> Orders { get; set; }
|
||
public DbSet<OrderStatus> OrderStatuses { get; set; }
|
||
|
||
public DbSet<Domain.Entities.User> Users { get; set; }
|
||
public DbSet<Role> Roles { get; set; }
|
||
public DbSet<UsersInRole> UsersInRoles { get; set; }
|
||
|
||
public DbSet<WeekendDay> WeekendDays { get; set; }
|
||
|
||
public DbSet<DistributionPeriod> DistributionPeriods { get; set; }
|
||
|
||
public DbSet<ParrComponent> ParrComponents { get; set; }
|
||
|
||
#region Units
|
||
|
||
public DbSet<Unit> Units { get; set; }
|
||
|
||
public DbSet<UnitField> UnitFields { get; set; }
|
||
|
||
public DbSet<UnitFieldValue> UnitFieldValues { get; set; }
|
||
|
||
public DbSet<UnitInValue> UnitInValues { get; set; }
|
||
|
||
public DbSet<UnitFieldInUnitFieldValue> UnitFieldInUnitFieldValues { get; set; }
|
||
|
||
public DbSet<UnitInUnit> UnitInUnits { get; set; }
|
||
|
||
public DbSet<UnitsInTemplate> UnitsInTemplates { get; set; }
|
||
|
||
public DbSet<UnitRegionalEkPtkGroup> UnitRegionalEkPtkGroups { get; set; }
|
||
|
||
public DbSet<UnitKiiUnit> UnitKiiUnits { get; set; }
|
||
|
||
#endregion
|
||
|
||
#region Job
|
||
|
||
public DbSet<JobFieldFilter> FieldFilters { get; set; }
|
||
|
||
public DbSet<Job> Jobs { get; set; }
|
||
|
||
public DbSet<JobUnitFilter> JobUnitFilters { get; set; }
|
||
|
||
public DbSet<JobRelationshipFilter> JobRelationshipFilters { get; set; }
|
||
|
||
public DbSet<JobAutoControl> JobAutoControls { get; set; }
|
||
|
||
#endregion
|
||
|
||
#region JobGroup
|
||
|
||
public DbSet<JobGroup> JobGroups { get; set; }
|
||
|
||
public DbSet<JobGroupType> JobGroupTypes { get; set; }
|
||
|
||
public DbSet<JobGroupDistributionConfig> JobGroupDistributionConfigs { get; set; }
|
||
|
||
public DbSet<JobGroupAutoControl> JobGroupAutoControls { get; set; }
|
||
|
||
public DbSet<JobGroupUnitFilter> JobGroupUnitFilters { get; set; }
|
||
|
||
public DbSet<JobGroupFieldFilter> JobGroupFieldFilters { get; set; }
|
||
|
||
public DbSet<JobGroupRelationshipFilter> JobGroupRelationshipFilters { get; set; }
|
||
|
||
#endregion
|
||
|
||
#region Tasks
|
||
|
||
public DbSet<TaskItem> Tasks { get; set; }
|
||
public DbSet<Domain.Entities.TaskEntities.TaskStatus> TaskStatus { get; set; }
|
||
public DbSet<TaskType> TaskTypes { get; set; }
|
||
public DbSet<TaskError> TaskErrors { get; set; }
|
||
|
||
#endregion
|
||
|
||
#region Robot
|
||
|
||
public DbSet<RobotSnapshot> RobotSnapshots { get; set; }
|
||
|
||
#endregion
|
||
|
||
|
||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||
{
|
||
base.OnModelCreating(modelBuilder);
|
||
|
||
var dateCreated = new DateTimeOffset(2023, 05, 01, 0, 0, 0, new TimeSpan(0));
|
||
|
||
//Задать значение по умолчанию
|
||
//modelBuilder.Entity<UnitsInTemplate>()
|
||
// .Property(t => t.UnitFieldValueId)
|
||
// .HasDefaultValue(new Guid("d6485475-d4c5-47f0-a48f-b364a6321cc4"));
|
||
|
||
#region Unit
|
||
//Добавляем ограничение по имени ЭК. нельзя писать прописными!!!
|
||
modelBuilder.Entity<Unit>(f =>
|
||
{
|
||
f.ToTable(t => t.HasCheckConstraint(
|
||
"CK_Units_Name_Upper",
|
||
"\"Name\" = UPPER(\"Name\") AND \"Name\" IS NOT NULL AND LENGTH(\"Name\")>0"
|
||
));
|
||
});
|
||
#endregion
|
||
|
||
#region UnitsInTemplate
|
||
modelBuilder.Entity<UnitsInTemplate>()
|
||
.HasKey(t => new { t.TemplateId, t.UnitId, t.UnitFieldValueId });
|
||
|
||
#endregion
|
||
|
||
#region JobGroupType
|
||
modelBuilder.Entity<JobGroupType>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("4FA62E79-86BB-47C2-BE1A-72A716A170FA"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Simple.ToString(), Code = JobGroupTypesEnum.Simple, Description = "Обычный", IsAllowJobUnitFilter = true, IsJobGroupAutoControl = false, IsRelationshipsAllowed = false },
|
||
new() { Id = new Guid("6EC58B1A-5C40-47B9-B036-4FA490E8D503"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Umbrella.ToString(), Code = JobGroupTypesEnum.Umbrella, Description = "Зонтик", IsAllowJobUnitFilter = false, IsJobGroupAutoControl = true, IsRelationshipsAllowed = true },
|
||
new() { Id = new Guid("318625E5-F833-436A-99DF-2A382A1E71C7"), DateCreated = dateCreated, DateModified = null, Name = JobGroupTypesEnum.Group.ToString(), Code = JobGroupTypesEnum.Group, Description = "Сгруппированный", IsAllowJobUnitFilter = false, IsJobGroupAutoControl = true, IsRelationshipsAllowed = true }
|
||
);
|
||
});
|
||
#endregion
|
||
|
||
#region ApplicationType
|
||
//modelBuilder.Entity<ApplicationType>(f =>
|
||
//{
|
||
// f.HasData(
|
||
// new() { Id = new Guid("32c28386-6f13-4f7b-8508-be165b7fabdb"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.APP.ToString(), Description = "Сервер приложений" },
|
||
// new() { Id = new Guid("7848a96c-cdee-48c1-a786-de9cb889723a"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.OS.ToString(), Description = "ОС" },
|
||
// new() { Id = new Guid("aae2636f-b93a-42dc-873e-0764a90a0a40"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.DB.ToString(), Description = "СУБД" },
|
||
// new() { Id = new Guid("749f4c34-b883-4f28-90dd-c161dd3c4270"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.CKBS.ToString(), Description = "ЦК БС" },
|
||
// new() { Id = new Guid("0bd96f9b-d36b-4dfb-bd8a-9c356bc6912b"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.IB.ToString(), Description = "ИБ" },
|
||
// new() { Id = new Guid("4466148b-510d-4423-a58f-ce878152ff01"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.SI.ToString(), Description = "Инфраструктура" },
|
||
// new() { Id = new Guid("725a96db-358e-489b-a7c9-a84b06ec15df"), DateCreated = dateCreated, DateModified = null, Name = ApplicationTypesEnum.SM.ToString(), Description = "Мониторинг" }
|
||
// );
|
||
//});
|
||
#endregion
|
||
|
||
#region TaskStatus
|
||
modelBuilder.Entity<Domain.Entities.TaskStatus>(f =>
|
||
{
|
||
f.HasData(
|
||
|
||
new() { Code = (int)TaskStatusEnum.Creating, Name = TaskStatusEnum.Creating.ToString(), Description = "Требуется создание объекта в ЕСПП" },
|
||
new() { Code = (int)TaskStatusEnum.Updating, Name = TaskStatusEnum.Updating.ToString(), Description = "Требуется обновление объекта в ЕСПП" },
|
||
new() { Code = (int)TaskStatusEnum.Ok, Name = TaskStatusEnum.Ok.ToString(), Description = "Нормальное состояние объекта в ЕСПП и ПАРР. Объект в ПАРР соответствует объекту в ЕСПП" }
|
||
);
|
||
});
|
||
#endregion
|
||
|
||
#region Settings
|
||
modelBuilder.Entity<Setting>(f =>
|
||
{
|
||
// При добавлении записей, добавлять тоже в PARR.DAL.Contracts.SettingsFromDb
|
||
f.HasData(
|
||
new { Name = nameof(SettingsFromDb.Initiator), Description = "Инициатор регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "АКСЕНОВ АЛЕКСАНДР ЕВГЕНЬЕВИЧ (AKSENOVAE@GVC.OAO.RZD)" },
|
||
new { Name = nameof(SettingsFromDb.ClosingCode), Description = "Код закрытия регламентной работы, указывается при создании шаблона в ЕСПП.", Value = "выполнен" },
|
||
new { Name = nameof(SettingsFromDb.Category), Description = "Категория создаваемого объекта в ЕСПП", Value = "регламентная работа" },
|
||
new { Name = nameof(SettingsFromDb.TemplatePrefixName), Description = "Префикс имени шаблона в ЕСПП", Value = "%PREFIX%-ЭИТИ-ПТК-ПАРР" },
|
||
new { Name = nameof(SettingsFromDb.RobotAttemptsNumber), Description = "Количество попыток выполнения задания роботом", Value = "3" },
|
||
new { Name = nameof(SettingsFromDb.RobotWaitTime), Description = "Время ожидания выполнения роботом задания", Value = "00:10:00" },
|
||
new { Name = nameof(SettingsFromDb.EsppScheduleTimezone), Description = "Расписание регламентной работы - В каком часовом поясе", Value = "MSK" },
|
||
//new { Name = nameof(SettingsFromDb.ScheduleExcludeType), Description = "Расписание регламентной работы - Тип исключения", Value = "Выполнить ТОЛЬКО В указанном календаре" },
|
||
//new { Name = nameof(SettingsFromDb.ScheduleExcludeCalendar), Description = "Расписание регламентной работы - Календарь", Value = "8x5 (8.00-17.00)" },
|
||
new { Name = nameof(SettingsFromDb.ScheduleRepeatRange), Description = "Расписание регламентной работы - Диапазн повторов", Value = "Отсутствует дата завершения" },
|
||
new { Name = nameof(SettingsFromDb.OrderSearchDeltaDate), Description = "Промежуток времени для поиска нарядов в ЕСПП", Value = new TimeSpan(1, 30, 0).ToString() },
|
||
new { Name = nameof(SettingsFromDb.EsppRobotAccountTimeZoneHour), Description = "Таймзона УЗ роботов в ЕСПП, в часах (может быть положительная и отрицательная)", Value = "3" },
|
||
new { Name = nameof(SettingsFromDb.WeekendCacheTtl), Description = "Время хранения в кэше данных о выходных и рабочих днях", Value = new TimeSpan(1, 0, 0).ToString() },
|
||
new
|
||
{
|
||
Name = nameof(SettingsFromDb.TemplateNameConstantParts),
|
||
Description = "Список неизменных частей имени шаблона",
|
||
Value =
|
||
new List<TemplateNameConstantPart> {
|
||
new TemplateNameConstantPart { Name = "П-1", Value = "ЭИТИ-ПАРР" }
|
||
}.ToJson()
|
||
},
|
||
new { Name = nameof(SettingsFromDb.EsppUnitTag), Description = "Префикс тега в поле ЭК \"Дополнительная информация\"", Value = "ПАРР_" },
|
||
new { Name = nameof(SettingsFromDb.JobIdForUnusedTemplates), Description = "Job в который перемещаем ниспользованные шаблоны", Value = "8f85a91c-a223-4686-bb69-1f0ee73624f2" },
|
||
new { Name = nameof(SettingsFromDb.DefaultResponseAreaToTimeOffset), Description = "Зона ответственности для получения тайм зоны по умолчанию для расписаний", Value = "17-МСК" }
|
||
);
|
||
});
|
||
#endregion
|
||
|
||
#region EK
|
||
//modelBuilder.Entity<EkStatus>(f =>
|
||
//{
|
||
// f.HasData(
|
||
// new { Code = (int)EkStatusEnum.New, Name = "1-Новый" },
|
||
// new { Code = (int)EkStatusEnum.Preapre, Name = "2-Подготовка к эксплуатации" },
|
||
// new { Code = (int)EkStatusEnum.Exploitation, Name = "3-В эксплуатации" },
|
||
// new { Code = (int)EkStatusEnum.Repair, Name = "4-В ремонте" },
|
||
// new { Code = (int)EkStatusEnum.Reserve, Name = "5-В резерве" },
|
||
// new { Code = (int)EkStatusEnum.OutOfService, Name = "6-Выведен из эксплуатации" },
|
||
// new { Code = (int)EkStatusEnum.Test, Name = "7-Тестовый" },
|
||
// new { Code = (int)EkStatusEnum.Development, Name = "9-В разработке" }
|
||
// );
|
||
//});
|
||
#endregion
|
||
|
||
#region ResponseArea
|
||
//modelBuilder.Entity<ResponseArea>(f =>
|
||
//{
|
||
// f.HasData(
|
||
// new { Code = (int)ResponseAreaEnum.dvgd, Name = "96-ДВС" },
|
||
// new { Code = (int)ResponseAreaEnum.zrw, Name = "94-ЗАБ" },
|
||
// new { Code = (int)ResponseAreaEnum.esrr, Name = "92-ВСИБ" },
|
||
// new { Code = (int)ResponseAreaEnum.krw, Name = "88-КРАСН" },
|
||
// new { Code = (int)ResponseAreaEnum.wsr, Name = "83-ЗСИБ" },
|
||
// new { Code = (int)ResponseAreaEnum.surw, Name = "80-ЮУР" },
|
||
// new { Code = (int)ResponseAreaEnum.svrw, Name = "76-СВРД" },
|
||
// new { Code = (int)ResponseAreaEnum.kbsh, Name = "63-КБШ" },
|
||
// new { Code = (int)ResponseAreaEnum.pvrr, Name = "61-ПРИВ" },
|
||
// new { Code = (int)ResponseAreaEnum.serw, Name = "58-ЮВСТ" },
|
||
// new { Code = (int)ResponseAreaEnum.skzd, Name = "51-СКВ" },
|
||
// new { Code = (int)ResponseAreaEnum.nrr, Name = "28-СЕВ" },
|
||
// new { Code = (int)ResponseAreaEnum.grw, Name = "24-ГОР" },
|
||
// new { Code = (int)ResponseAreaEnum.msk, Name = "17-МСК" },
|
||
// new { Code = (int)ResponseAreaEnum.klgd, Name = "10-КЛГ" },
|
||
// new { Code = (int)ResponseAreaEnum.orw, Name = "01-ОКТ" },
|
||
// new { Code = (int)ResponseAreaEnum.gvc, Name = "00-ГВЦ" },
|
||
// new { Code = (int)ResponseAreaEnum.general, Name = "ОБЩЕЕ" },
|
||
// new { Code = (int)ResponseAreaEnum.vp, Name = "ВП" },
|
||
// new { Code = (int)ResponseAreaEnum.osk, Name = "ОСК" }
|
||
// );
|
||
//});
|
||
#endregion
|
||
|
||
#region Robots
|
||
|
||
modelBuilder.Entity<RobotStatus>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Code = (int)RobotStatusEnum.Wait, Name = RobotStatusEnum.Wait.ToString(), Description = "Ожидание, ждет пока робот возьмет в работу." },
|
||
new { Code = (int)RobotStatusEnum.InProgress, Name = RobotStatusEnum.InProgress.ToString(), Description = "Робот взял в работу." },
|
||
new { Code = (int)RobotStatusEnum.Error, Name = RobotStatusEnum.Error.ToString(), Description = "Ошибка отработки роботом. Требует ручного вмешательства." },
|
||
new { Code = (int)RobotStatusEnum.Complete, Name = RobotStatusEnum.Complete.ToString(), Description = "Робот успешно отработал." }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<RobotHistoryLevel>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Level = (int)RobotHistoryLevelEnum.Start, Name = RobotHistoryLevelEnum.Start.ToString(), Description = "Робот начал работу " },
|
||
new { Level = (int)RobotHistoryLevelEnum.Information, Name = RobotHistoryLevelEnum.Information.ToString(), Description = "Информация" },
|
||
new { Level = (int)RobotHistoryLevelEnum.Error, Name = RobotHistoryLevelEnum.Error.ToString(), Description = "Ошибка" },
|
||
new { Level = (int)RobotHistoryLevelEnum.Complete, Name = RobotHistoryLevelEnum.Complete.ToString(), Description = "Успешно завершил работу" }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<Robot>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Code = (int)RobotsEnum.TemplateOrder, Name = RobotsEnum.TemplateOrder.ToString(), Description = "Робот по созданию/изменению шаблона наряда ЕСПП" },
|
||
new { Code = (int)RobotsEnum.ScheduleOrder, Name = RobotsEnum.ScheduleOrder.ToString(), Description = "Робот по созданию/изменению расписания шаблона наряда в ЕСПП" }
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
#region EsppSchedules
|
||
|
||
modelBuilder.Entity<EsppSchType>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Id = (int)EsppSchTypeEnum.Interval, Name = EsppSchTypeEnum.Interval.ToString(), Description = "Через интервал" },
|
||
new { Id = (int)EsppSchTypeEnum.DayOfWeek, Name = EsppSchTypeEnum.DayOfWeek.ToString(), Description = "День недели: пнд, вт..." },
|
||
new { Id = (int)EsppSchTypeEnum.DayOfMonth, Name = EsppSchTypeEnum.DayOfMonth.ToString(), Description = "Число месяца: 1,2,3,4" },
|
||
new { Id = (int)EsppSchTypeEnum.Order, Name = EsppSchTypeEnum.Order.ToString(), Description = "Каждый: первый, второй, третий, четвертый, последний" },
|
||
new { Id = (int)EsppSchTypeEnum.Month, Name = EsppSchTypeEnum.Month.ToString(), Description = "Месяц: январь, февраль..." },
|
||
new { Id = (int)EsppSchTypeEnum.MonthGenitive, Name = EsppSchTypeEnum.MonthGenitive.ToString(), Description = "Месяц (родительный падеж): января, февраля..." }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<EsppSchTypeValue>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Id = new Guid("6E3B5DD2-B2F7-40BC-BACE-15BFA6BBD4FF"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждый час", EsppExportValue = "01:00:00", Order = 0 },
|
||
new { Id = new Guid("4DF04834-F14F-43D9-8984-334F080F4107"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 2 часа", EsppExportValue = "02:00:00", Order = 1 },
|
||
new { Id = new Guid("DAB6E3F9-2385-4966-B77C-133AD233C592"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 3 часа", EsppExportValue = "03:00:00", Order = 2 },
|
||
new { Id = new Guid("035F485D-8451-47DF-BFAA-BA4DD36CF146"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 4 часа", EsppExportValue = "04:00:00", Order = 3 },
|
||
new { Id = new Guid("D627DAA7-3EED-4571-ACAE-FFBB3C5BEDB9"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 6 часов", EsppExportValue = "06:00:00", Order = 4 },
|
||
new { Id = new Guid("AE0A0015-0F1E-4496-B71E-6244F7E321E7"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 12 часов", EsppExportValue = "12:00:00", Order = 5 },
|
||
new { Id = new Guid("8DF097AA-9860-4A62-9675-A8EECD3F2CE7"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Ежедневно", EsppExportValue = "1 00:00:00", Order = 6 },
|
||
new { Id = new Guid("DEE32E60-C1A1-4206-98BC-AA03DEABFDF6"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 72 часа", EsppExportValue = "3 00:00:00", Order = 7 },
|
||
new { Id = new Guid("E0465FBF-E3A5-4486-9F53-5BB85C6FEECA"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 96 часов", EsppExportValue = "4 00:00:00", Order = 8 },
|
||
new { Id = new Guid("4E3F73D1-A0F3-4DD1-BCA9-68ADA0DD5CE2"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 2 недели", EsppExportValue = "14 00:00:00", Order = 9 },
|
||
new { Id = new Guid("55833417-6A24-42F6-BCC2-5D032F883202"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 60 дней", EsppExportValue = "60 00:00:00", Order = 10 },
|
||
new { Id = new Guid("7FEFA052-29DB-4CE5-9C57-2FD9FF855F21"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 80 дней", EsppExportValue = "80 00:00:00", Order = 11 },
|
||
new { Id = new Guid("B0CA99F9-5EE0-45B3-BB80-948F82B1FCB1"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 90 дней", EsppExportValue = "90 00:00:00", Order = 12 },
|
||
new { Id = new Guid("086F7A37-9848-423A-A3CC-36DBB5AD43E3"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые полгода", EsppExportValue = "182 00:00:00", Order = 13 },
|
||
new { Id = new Guid("F2DA9E02-D619-4517-A598-374880A8C8E8"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 1,5 года", EsppExportValue = "540 00:00:00", Order = 14 },
|
||
new { Id = new Guid("F38D7D30-8923-4EA0-AA7C-5B251E19AB61"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, Value = "Каждые 3 года", EsppExportValue = "1095 00:00:00", Order = 15 },
|
||
new { Id = new Guid("B7303461-9A30-43FA-8E55-305AA13F186F"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, Value = "Понедельник", EsppExportValue = "1", Order = 0 },
|
||
new { Id = new Guid("E951135E-71F2-4262-9342-DF4D5315AB6C"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, Value = "Вторник", EsppExportValue = "2", Order = 1 },
|
||
new { Id = new Guid("C34D5375-70E7-4632-B3AF-30E279A0621A"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, Value = "Среда", EsppExportValue = "3", Order = 2 },
|
||
new { Id = new Guid("EC9540DF-C2DE-4BDA-A063-34D02D4B6E03"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, Value = "Четверг", EsppExportValue = "4", Order = 3 },
|
||
new { Id = new Guid("2ED85534-4684-4EB2-9CCB-E264D212C945"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, Value = "Пятница", EsppExportValue = "5", Order = 4 },
|
||
new { Id = new Guid("A6804315-96EF-484E-82EE-C5795694468B"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, Value = "Суббота", EsppExportValue = "6", Order = 5 },
|
||
new { Id = new Guid("EB71E699-937F-4894-9688-F7A7F95E5E58"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, Value = "Воскресенье", EsppExportValue = "7", Order = 6 },
|
||
new { Id = new Guid("E86ADBFB-3345-4E0C-AA3B-B4418F9CFE88"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "1", EsppExportValue = "1", Order = 0 },
|
||
new { Id = new Guid("5B4D7CA6-31E7-475B-B7C8-13C6680C3DC3"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "2", EsppExportValue = "2", Order = 1 },
|
||
new { Id = new Guid("0DA03DB0-9404-425D-BEA1-5DA0C9B60B59"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "3", EsppExportValue = "3", Order = 2 },
|
||
new { Id = new Guid("199474C8-0A77-47E5-AAB8-BA33C216CC9E"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "4", EsppExportValue = "4", Order = 3 },
|
||
new { Id = new Guid("E6619DA1-F7E8-45B9-BBD3-9C17BEC2CCD3"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "5", EsppExportValue = "5", Order = 4 },
|
||
new { Id = new Guid("A8708763-C838-49A5-95FE-BF4F73518D71"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "6", EsppExportValue = "6", Order = 5 },
|
||
new { Id = new Guid("7EC056AA-820C-4900-96CB-4564D2EA6398"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "7", EsppExportValue = "7", Order = 6 },
|
||
new { Id = new Guid("554D7D0C-91B1-4B81-B94D-1EE864192962"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "8", EsppExportValue = "8", Order = 7 },
|
||
new { Id = new Guid("8B7847A4-23DE-4199-8AAD-3B5C0323B5A2"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "9", EsppExportValue = "9", Order = 8 },
|
||
new { Id = new Guid("FB7F41CA-950B-4DC1-A0A6-BD9A221AB2AD"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "10", EsppExportValue = "10", Order = 9 },
|
||
new { Id = new Guid("A28B530F-EA38-4A2C-A16B-0B7FA3770D3C"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "11", EsppExportValue = "11", Order = 10 },
|
||
new { Id = new Guid("7A004A11-32E1-40AE-AB35-0D3DC3A69785"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "12", EsppExportValue = "12", Order = 11 },
|
||
new { Id = new Guid("E0F2F4D1-4A5E-4997-8336-83C3C35F38DF"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "13", EsppExportValue = "13", Order = 12 },
|
||
new { Id = new Guid("9C5AAF48-88EC-4C67-B936-2BE45550F8BF"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "14", EsppExportValue = "14", Order = 13 },
|
||
new { Id = new Guid("8DBD680C-CE49-4D2E-8A1A-05619685E240"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "15", EsppExportValue = "15", Order = 14 },
|
||
new { Id = new Guid("2F476F70-B1EF-419D-AAD5-3911F1E3231F"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "16", EsppExportValue = "16", Order = 15 },
|
||
new { Id = new Guid("2C635CE2-FC18-47BE-B3E9-98C211ABF312"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "17", EsppExportValue = "17", Order = 16 },
|
||
new { Id = new Guid("F9D5B03B-624A-4F9F-8DA3-1490EA5D2914"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "18", EsppExportValue = "18", Order = 17 },
|
||
new { Id = new Guid("4F4B249C-DB60-4582-86ED-75CFEE4EDD0C"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "19", EsppExportValue = "19", Order = 18 },
|
||
new { Id = new Guid("220A1464-4D39-416C-B4B2-3093EB007298"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "20", EsppExportValue = "20", Order = 19 },
|
||
new { Id = new Guid("C887CA60-B05D-4D3C-AD1F-223C879B1A6D"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "21", EsppExportValue = "21", Order = 20 },
|
||
new { Id = new Guid("2905765D-63FB-41FE-A111-EE2F1D03D62E"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "22", EsppExportValue = "22", Order = 21 },
|
||
new { Id = new Guid("DBBE704A-8D6D-40E7-BD30-6974035B1FAB"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "23", EsppExportValue = "23", Order = 22 },
|
||
new { Id = new Guid("CF7B9645-52ED-43A2-8267-267E0AED19B1"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "24", EsppExportValue = "24", Order = 23 },
|
||
new { Id = new Guid("454788D6-D0AD-4C07-878C-DA3FD3CD05E1"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "25", EsppExportValue = "25", Order = 24 },
|
||
new { Id = new Guid("40D70D73-8582-4BE6-A9E6-503B96AE3D49"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "26", EsppExportValue = "26", Order = 25 },
|
||
new { Id = new Guid("8F6610DC-EF46-4842-A57E-18D7AAA75931"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "27", EsppExportValue = "27", Order = 26 },
|
||
new { Id = new Guid("03858472-D4CE-47FD-9497-8051728766E4"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "28", EsppExportValue = "28", Order = 27 },
|
||
new { Id = new Guid("B1018E07-E90E-42EE-B399-19F3D0C14DD6"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "29", EsppExportValue = "29", Order = 28 },
|
||
new { Id = new Guid("A1669207-AA31-40FE-98D0-D941008D1655"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "30", EsppExportValue = "30", Order = 29 },
|
||
new { Id = new Guid("0936AA99-73E0-43DE-B6DF-334C1228A226"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, Value = "31", EsppExportValue = "31", Order = 30 },
|
||
new { Id = new Guid("626CA076-F09E-4A7A-8610-B7DE6337B24A"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Order, Value = "Первый", EsppExportValue = "1", Order = 0 },
|
||
new { Id = new Guid("032FBD02-67D0-4B8C-BED0-42629AB7113B"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Order, Value = "Второй", EsppExportValue = "2", Order = 1 },
|
||
new { Id = new Guid("FA8A8F60-E41E-495E-AC86-35174D9976BF"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Order, Value = "Третий", EsppExportValue = "3", Order = 2 },
|
||
new { Id = new Guid("D2F90168-2B49-42F2-820B-79DB2C522ADF"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Order, Value = "Четвертый", EsppExportValue = "4", Order = 3 },
|
||
new { Id = new Guid("12BB8DB2-CF7F-4113-BAFF-6883770F1BA5"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Order, Value = "Последний", EsppExportValue = "5", Order = 4 },
|
||
new { Id = new Guid("18260E91-3FBE-4401-9EDC-78DBC419370E"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Январь", EsppExportValue = "1", Order = 0 },
|
||
new { Id = new Guid("361526AA-3E1C-452E-BB44-0ADE8521830D"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Февраль", EsppExportValue = "2", Order = 1 },
|
||
new { Id = new Guid("FAD4BDB0-6C51-4810-A30B-6D031A0D4C46"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Март", EsppExportValue = "3", Order = 2 },
|
||
new { Id = new Guid("06AB835D-3D3E-4057-8422-A553B6B40995"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Апрель", EsppExportValue = "4", Order = 3 },
|
||
new { Id = new Guid("83F56B5D-B16B-4AA5-89D7-A253FEE4E4AD"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Май", EsppExportValue = "5", Order = 4 },
|
||
new { Id = new Guid("E679EC84-A9EE-4BED-A051-2B14EDDDCB18"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Июнь", EsppExportValue = "6", Order = 5 },
|
||
new { Id = new Guid("D439808A-6A10-409B-8809-A755B7CCA60B"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Июль", EsppExportValue = "7", Order = 6 },
|
||
new { Id = new Guid("6E9972C4-6BF7-4FE4-B4EA-BBB333FB69C8"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Август", EsppExportValue = "8", Order = 7 },
|
||
new { Id = new Guid("0883AAC2-9D5B-4098-B672-C684D2A3A0C9"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Сентябрь", EsppExportValue = "9", Order = 8 },
|
||
new { Id = new Guid("5E6592BC-ACB2-45A4-979B-FDECF8457453"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Октябрь", EsppExportValue = "10", Order = 9 },
|
||
new { Id = new Guid("EDD7CB49-D6A0-4969-B2D6-1967DA69B336"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Ноябрь", EsppExportValue = "11", Order = 10 },
|
||
new { Id = new Guid("DD695FB2-4AD0-4CDA-A4DF-E15059C56B24"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, Value = "Декабрь", EsppExportValue = "12", Order = 11 },
|
||
new { Id = new Guid("2F473624-4EB3-49B4-A4B9-CC7FC08A50F5"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Января", EsppExportValue = "1", Order = 0 },
|
||
new { Id = new Guid("F0003490-A249-44BD-814F-4566999915D8"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Февраля", EsppExportValue = "2", Order = 1 },
|
||
new { Id = new Guid("F4C3FE38-AEAA-42F7-A9BA-190EA2DFE339"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Марта", EsppExportValue = "3", Order = 2 },
|
||
new { Id = new Guid("06A8BD2F-68E1-42F5-961C-AC3B98A2181E"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Апреля", EsppExportValue = "4", Order = 3 },
|
||
new { Id = new Guid("963B9C41-D607-444A-9FE0-FE429590E326"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Мая", EsppExportValue = "5", Order = 4 },
|
||
new { Id = new Guid("EC8554C8-DEE4-49A1-B1B7-474AD8EC1473"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Июня", EsppExportValue = "6", Order = 5 },
|
||
new { Id = new Guid("E15C7C63-E29F-41A3-9C82-F70EB6C24FDE"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Июля", EsppExportValue = "7", Order = 6 },
|
||
new { Id = new Guid("0B1F3CEA-301A-4D74-9CE1-2CD93B41897D"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Августа", EsppExportValue = "8", Order = 7 },
|
||
new { Id = new Guid("E2FA3769-F66F-4753-A161-35ADAD7717A5"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Сентября", EsppExportValue = "9", Order = 8 },
|
||
new { Id = new Guid("C1DE4ACA-9F49-48AE-9279-CF9EC4092112"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Октября", EsppExportValue = "10", Order = 9 },
|
||
new { Id = new Guid("A74B9EBD-BCD8-4537-B371-194DE2FE0A4D"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Ноября", EsppExportValue = "11", Order = 10 },
|
||
new { Id = new Guid("852A5EBD-4545-494B-BC69-C27409A41ADC"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, Value = "Декабря", EsppExportValue = "12", Order = 11 }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<EsppSchTypeSchedule>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Id = (int)EsppSchTypeScheduleEnum.Regularly, Name = EsppSchTypeScheduleEnum.Regularly.ToString(), Description = "Регулярно" },
|
||
new { Id = (int)EsppSchTypeScheduleEnum.Weekly, Name = EsppSchTypeScheduleEnum.Weekly.ToString(), Description = "Еженедельно" },
|
||
new { Id = (int)EsppSchTypeScheduleEnum.Monthly, Name = EsppSchTypeScheduleEnum.Monthly.ToString(), Description = "Ежемесячно" },
|
||
new { Id = (int)EsppSchTypeScheduleEnum.Monthly2, Name = EsppSchTypeScheduleEnum.Monthly2.ToString(), Description = "Ежемесячно-2" },
|
||
new { Id = (int)EsppSchTypeScheduleEnum.Annually, Name = EsppSchTypeScheduleEnum.Annually.ToString(), Description = "Ежегодно" },
|
||
new { Id = (int)EsppSchTypeScheduleEnum.Annually2, Name = EsppSchTypeScheduleEnum.Annually2.ToString(), Description = "Ежегодно-2" }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<EsppSchTypeConfig>(f =>
|
||
{
|
||
f.HasData(
|
||
// регулярно через интервал
|
||
new { Id = new Guid("D2693562-B3EB-41E9-97DB-C6B5D2EF1BEA"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Interval, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Regularly, Order = 0 },
|
||
// еженедельно
|
||
new { Id = new Guid("06B2E7AA-6927-4FBF-99FB-67C92A4FCE8A"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Weekly, Order = 0 },
|
||
// ежемесячно, число месяца
|
||
new { Id = new Guid("78079071-FF80-417E-9BB0-D928CEC853E7"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Monthly, Order = 0 },
|
||
// ежемесячно: первый вторник
|
||
new { Id = new Guid("ACCB1D46-E1C1-4396-9182-4C0766155921"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Order, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Monthly2, Order = 0 },
|
||
new { Id = new Guid("162FFE73-2428-4ABE-8F83-235C2593664C"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Monthly2, Order = 1 },
|
||
// ежегодно: январь, число
|
||
new { Id = new Guid("8470D1EF-165D-42FC-AB05-8203E4D263CF"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Month, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Annually, Order = 0 },
|
||
new { Id = new Guid("006900B5-F65C-413E-BC67-09E6DAE60B7C"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfMonth, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Annually, Order = 1 },
|
||
// ежегодно: первый понедельник января
|
||
new { Id = new Guid("85635BC8-F17A-46B8-9C15-8615761BE3D9"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.Order, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Annually2, Order = 0 },
|
||
new { Id = new Guid("439460C2-DECA-4B54-80E7-2F20806696EC"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.DayOfWeek, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Annually2, Order = 1 },
|
||
new { Id = new Guid("5C63AD8C-E9B4-43FD-9D24-5C2EED80DADD"), DateCreated = dateCreated, TypeId = (int)EsppSchTypeEnum.MonthGenitive, TypeScheduleId = (int)EsppSchTypeScheduleEnum.Annually2, Order = 2 }
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
#region AgentHistoryLevel
|
||
modelBuilder.Entity<AgentHistoryLevel>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Id = (int)AgentHistoryLevelEnum.Start, Name = AgentHistoryLevelEnum.Start.ToString(), Description = "Агент начал выполнять задание" },
|
||
new { Id = (int)AgentHistoryLevelEnum.End, Name = AgentHistoryLevelEnum.End.ToString(), Description = "Агент завершил выполнение задания" }
|
||
);
|
||
});
|
||
#endregion
|
||
|
||
#region OrderStatus
|
||
modelBuilder.Entity<OrderStatus>(f =>
|
||
{
|
||
f.HasData(
|
||
new { Code = (int)OrderStatusEnum.New, Name = OrderStatusEnum.New.ToString(), Description = "1-Направлен в группу" },
|
||
new { Code = (int)OrderStatusEnum.InWork, Name = OrderStatusEnum.InWork.ToString(), Description = "2-В работе" },
|
||
new { Code = (int)OrderStatusEnum.Stop, Name = OrderStatusEnum.Stop.ToString(), Description = "3-Приостановлен" },
|
||
new { Code = (int)OrderStatusEnum.Complete, Name = OrderStatusEnum.Complete.ToString(), Description = "4-Выполнен" },
|
||
new { Code = (int)OrderStatusEnum.Closed, Name = OrderStatusEnum.Closed.ToString(), Description = "5-Закрыт" }
|
||
);
|
||
});
|
||
#endregion
|
||
|
||
#region Roles
|
||
modelBuilder.Entity<Role>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("C8F2F144-E6C2-45D7-BA66-5E9BBD376376"), DateCreated = dateCreated, Name = ParrRoles.Administrator.Role, Description = ParrRoles.Administrator.Description },
|
||
new() { Id = new Guid("13BCA225-7FA4-42FA-9D80-D2D46DE261FE"), DateCreated = dateCreated, Name = ParrRoles.EsppRobot.Role, Description = ParrRoles.EsppRobot.Description }
|
||
);
|
||
});
|
||
#endregion
|
||
|
||
#region DistributionPeriods
|
||
modelBuilder.Entity<DistributionPeriod>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("9BD0BFA8-C316-480B-A001-E09FFE8C9340"), Name = "Еженедельно", Duration = "7", Type = DistributionPeriodTypeEnum.Day.ToString() },
|
||
new() { Id = new Guid("3A7341A8-085C-461C-BABC-6B78DD5D2C67"), Name = "Ежемесячно", Duration = "30", Type = DistributionPeriodTypeEnum.Day.ToString() },
|
||
new() { Id = new Guid("0AD2DFDB-3833-46D9-979A-C408B7EADC6C"), Name = "Каждые 90 дней", Duration = "90", Type = DistributionPeriodTypeEnum.Day.ToString() },
|
||
new() { Id = new Guid("31DD3947-8471-4F09-852C-A4F075F1BA7F"), Name = "Каждые пол года", Duration = "182", Type = DistributionPeriodTypeEnum.Day.ToString() }
|
||
);
|
||
});
|
||
|
||
modelBuilder.Entity<DistributionPeriodType>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Type = DistributionPeriodTypeEnum.Day.ToString(), Description = "День" },
|
||
new() { Type = DistributionPeriodTypeEnum.Month.ToString(), Description = "Месяц" },
|
||
new() { Type = DistributionPeriodTypeEnum.Year.ToString(), Description = "Год" }
|
||
//new() { Type = DistributionPeriodTypeEnum.TimeSpan.ToString(), Description = "TimeSpan" }
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
#region ParrComponents
|
||
|
||
modelBuilder.Entity<ParrComponent>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = ParrComponentsEnum.Api, Name = ParrComponentsEnum.Api.ToString(), Description = "API" },
|
||
new() { Id = ParrComponentsEnum.AihitLoader, Name = ParrComponentsEnum.AihitLoader.ToString(), Description = "Загрузчик из АИХИТ" },
|
||
new() { Id = ParrComponentsEnum.AihitSyncer, Name = ParrComponentsEnum.AihitSyncer.ToString(), Description = "Синхронизатор АИХИТ" },
|
||
new() { Id = ParrComponentsEnum.EsppOrderLoader, Name = ParrComponentsEnum.EsppOrderLoader.ToString(), Description = "Загрузчик нарядов из ЕСПП" },
|
||
new() { Id = ParrComponentsEnum.EsppOrderManager, Name = ParrComponentsEnum.EsppOrderManager.ToString(), Description = "Управление нарядами ЕСПП" },
|
||
new() { Id = ParrComponentsEnum.EsppScheduleSync, Name = ParrComponentsEnum.EsppScheduleSync.ToString(), Description = "Синхронизатор расписаний" },
|
||
new() { Id = ParrComponentsEnum.EsppTemplateSync, Name = ParrComponentsEnum.EsppTemplateSync.ToString(), Description = "Синхронизатор шаблонов" },
|
||
new() { Id = ParrComponentsEnum.GeneratorTemplates, Name = ParrComponentsEnum.GeneratorTemplates.ToString(), Description = "Генератор шаблонов" },
|
||
new() { Id = ParrComponentsEnum.JobAutoControl, Name = ParrComponentsEnum.JobAutoControl.ToString(), Description = "Авто-контроль РР" },
|
||
new() { Id = ParrComponentsEnum.Master, Name = ParrComponentsEnum.Master.ToString(), Description = "Связывание нарядов ЕСПП с ПАРР (шаблонами, агентами)" },
|
||
new() { Id = ParrComponentsEnum.NextRun, Name = ParrComponentsEnum.NextRun.ToString(), Description = "Рассчет даты следующего срабатывания" },
|
||
new() { Id = ParrComponentsEnum.TemplateActivator, Name = ParrComponentsEnum.TemplateActivator.ToString(), Description = "Активатор шаблонов / расписаний" },
|
||
new() { Id = ParrComponentsEnum.TemplateDistributor, Name = ParrComponentsEnum.TemplateDistributor.ToString(), Description = "Автораспределение РР" },
|
||
new() { Id = ParrComponentsEnum.TemplateTaskGenerator, Name = ParrComponentsEnum.TemplateTaskGenerator.ToString(), Description = "Генератор шаблонов" },
|
||
new() { Id = ParrComponentsEnum.WorkloadBuilder, Name = ParrComponentsEnum.WorkloadBuilder.ToString(), Description = "Генератор кэша отчетов workload" }
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
#region TemplateStatusType
|
||
|
||
modelBuilder.Entity<TemplateStatusType>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = TemplateStatusTypeEnum.Used, Name = TemplateStatusTypeEnum.Used.ToString(), Description = "В работе" },
|
||
new() { Id = TemplateStatusTypeEnum.Unused, Name = TemplateStatusTypeEnum.Unused.ToString(), Description = "Не используется" },
|
||
new() { Id = TemplateStatusTypeEnum.Updating, Name = TemplateStatusTypeEnum.Updating.ToString(), Description = "Обновляется" },
|
||
new() { Id = TemplateStatusTypeEnum.Error, Name = TemplateStatusTypeEnum.Error.ToString(), Description = "Ошибка" }
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
#region JobGroup - UnitField (откл каскадное удаление)
|
||
|
||
modelBuilder.Entity<JobGroup>()
|
||
.HasOne(t => t.GroupingUnitField)
|
||
.WithMany(t => t.JobGroupWithGrouping)
|
||
.OnDelete(DeleteBehavior.Restrict);
|
||
|
||
#endregion
|
||
|
||
#region ScheduleExcludeType
|
||
|
||
modelBuilder.Entity<ScheduleExcludeType>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("0595B8E0-F322-4661-B5E3-064AF8FBE7CD"), DateCreated = dateCreated, Title = "Нет исключений", EsppName = "Нет исключений", EsppValue = "NONE", Code = ScheduleExcludeTypeEnum.None.ToString() },
|
||
new() { Id = new Guid("2B7A4356-9AAF-4E00-B444-42F0B5010E25"), DateCreated = dateCreated, Title = "Выполнить ТОЛЬКО В указанном календаре", EsppName = "Выполнить ТОЛЬКО В указанном календаре", EsppValue = "ONLY", Code = ScheduleExcludeTypeEnum.Only.ToString() },
|
||
new() { Id = new Guid("38CD9E64-27C1-4672-A805-2211952A48BD"), DateCreated = dateCreated, Title = "Выполнить везде, КРОМЕ указанного календаря", EsppName = "Выполнить везде, КРОМЕ указанного календаря", EsppValue = "EXCEPT", Code = ScheduleExcludeTypeEnum.Except.ToString() }
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
#region ScheduleExcludeTypeCalendar
|
||
|
||
modelBuilder.Entity<ScheduleExcludeTypeCalendar>(f =>
|
||
{
|
||
f.HasData(
|
||
new() { Id = new Guid("A26EDB88-0267-4FBF-B7EC-D172B0A86C9C"), DateCreated = dateCreated, Title = "24x5", EsppName = "24x5", EsppValue = "24x5", Code = "24x5" },
|
||
new() { Id = new Guid("6834F1D5-AC51-43D5-974E-4C759D7BBF9F"), DateCreated = dateCreated, Title = "24x7", EsppName = "24x7", EsppValue = "24x7", Code = "24x7" }
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
|
||
#region TaskType
|
||
|
||
modelBuilder.Entity<Domain.Entities.TaskEntities.TaskType>(f =>
|
||
{
|
||
f.HasData(new Domain.Entities.TaskEntities.TaskType[]
|
||
{
|
||
new() { Code = TaskTypeEnum.Workload, Name = TaskTypeEnum.Workload.ToString(), Description = "Формирование данных для отчетности - Загруженность", MaxRetries = 2, IsSingleton=true, MaxExecutionTimeMinutes=90, RetentionDays=90 }
|
||
}
|
||
);
|
||
});
|
||
|
||
#endregion
|
||
|
||
#region TaskStatus
|
||
|
||
modelBuilder.Entity<Domain.Entities.TaskEntities.TaskStatus>(f =>
|
||
{
|
||
f.HasData(new Domain.Entities.TaskEntities.TaskStatus[]
|
||
{
|
||
new(){Code=TaskItemStatusEnum.Pending, Name=TaskItemStatusEnum.Pending.ToString(), Description="Ожидание"},
|
||
new(){Code=TaskItemStatusEnum.Processing, Name=TaskItemStatusEnum.Processing.ToString(), Description="В работе"},
|
||
new(){Code=TaskItemStatusEnum.Success, Name=TaskItemStatusEnum.Success.ToString(), Description="Выполнено успешно"},
|
||
new(){Code=TaskItemStatusEnum.Failed, Name=TaskItemStatusEnum.Failed.ToString(), Description="Ошибка"}
|
||
});
|
||
});
|
||
|
||
#endregion
|
||
|
||
}
|
||
|
||
//protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||
//{
|
||
// base.OnConfiguring(optionsBuilder);
|
||
// optionsBuilder.UseLoggerFactory(LoggerFactory.Create(builder =>
|
||
// {
|
||
// builder.AddProvider(new MyLoggerProvider());
|
||
// }));
|
||
//}
|
||
|
||
|
||
|
||
}
|
||
|
||
#region MyLoggerProvider
|
||
|
||
//https://metanit.com/sharp/efcore/2.12.php
|
||
|
||
//internal class MyLoggerProvider : ILoggerProvider
|
||
//{
|
||
// public ILogger CreateLogger(string categoryName)
|
||
// {
|
||
// return new MyLogger();
|
||
// }
|
||
|
||
// public void Dispose()
|
||
// {
|
||
|
||
// }
|
||
|
||
|
||
// private class MyLogger : ILogger, IDisposable
|
||
// {
|
||
// public IDisposable? BeginScope<TState>(TState state) where TState : notnull
|
||
// {
|
||
// return this;
|
||
// }
|
||
|
||
// public void Dispose()
|
||
// {
|
||
|
||
// }
|
||
|
||
// public bool IsEnabled(LogLevel logLevel)
|
||
// {
|
||
// return true;
|
||
// }
|
||
|
||
// public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
|
||
// {
|
||
// Console.WriteLine("Привет, как дела? {0}", formatter(state, exception));
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
#endregion
|
||
}
|