feat: Из dal перенесены все модели в Domain. Из dal переименованы service в repository, вынесены в Core.

This commit is contained in:
Mikhail Trubnikov
2026-04-30 10:35:31 +10:00
parent f1ea69da1f
commit eb78dfd6a8
356 changed files with 1817 additions and 1985 deletions

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Contracts;
using PARR.DAL.Extensions;
using PARR.DAL.Models;
using PARR.DAL.Models.Job;
using PARR.DAL.Models.Schedule;
using PARR.DAL.Models.Unit;
using PARR.Domain.Common.Roles;
using PARR.Domain.Common.Template;
using PARR.Domain.Entities;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.Schedule;
using PARR.Domain.Entities.TaskEntities;
using PARR.Domain.Entities.Unit;
using PARR.Domain.Enums;
namespace PARR.DAL.Context
@@ -28,7 +28,7 @@ namespace PARR.DAL.Context
public DbSet<Template> Templates { get; set; }
public DbSet<TemplateHistory> TemplateHistories { get; set; }
public DbSet<TemplateStatusType> TemplateStatusTypes { get; set; }
public DbSet<Models.TaskStatus> TaskStatuses { get; set; }
public DbSet<Domain.Entities.TaskStatus> TaskStatuses { get; set; }
public DbSet<RobotStatus> RobotStatuses { get; set; }
public DbSet<Process> Processes { get; set; }
@@ -37,7 +37,7 @@ namespace PARR.DAL.Context
//public DbSet<ApplicationsInWork> ApplicationsInWorks { get; set; }
public DbSet<Models.Setting> Setting { get; set; }
public DbSet<Setting> Setting { get; set; }
public DbSet<RobotHistoryLevel> RobotHistoryLevels { get; set; }
@@ -62,11 +62,11 @@ namespace PARR.DAL.Context
public DbSet<AgentHistory> AgentHistories { get; set; }
public DbSet<AgentHistoryLevel> AgentHistoryLevels { get; set; }
public DbSet<Models.Order> Orders { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderStatus> OrderStatuses { get; set; }
public DbSet<User> Users { get; set; }
public DbSet<Models.Role> Roles { get; set; }
public DbSet<Role> Roles { get; set; }
public DbSet<UsersInRole> UsersInRoles { get; set; }
public DbSet<WeekendDay> WeekendDays { get; set; }
@@ -178,7 +178,7 @@ namespace PARR.DAL.Context
#endregion
#region TaskStatus
modelBuilder.Entity<Models.TaskStatus>(f =>
modelBuilder.Entity<Domain.Entities.TaskStatus>(f =>
{
f.HasData(
@@ -190,7 +190,7 @@ namespace PARR.DAL.Context
#endregion
#region Settings
modelBuilder.Entity<Models.Setting>(f =>
modelBuilder.Entity<Setting>(f =>
{
// При добавлении записей, добавлять тоже в PARR.DAL.Contracts.SettingsFromDb
f.HasData(
@@ -462,7 +462,7 @@ namespace PARR.DAL.Context
#endregion
#region Roles
modelBuilder.Entity<Models.Role>(f =>
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 },

View File

@@ -0,0 +1,193 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.Core.Repositories.Interfaces.TaskRepositories;
using PARR.Core.Repositories.Interfaces.Unit;
using PARR.DAL.Configurations.DbSettings;
using PARR.DAL.Context;
using PARR.DAL.Contracts;
using PARR.DAL.DomainServices.Implementations;
using PARR.DAL.DomainServices.Interfaces;
using PARR.DAL.DomainServices.Shortcodes;
using PARR.DAL.DomainServices.UnitFilterService;
using PARR.DAL.DomainServices.UnitFilterService.Models;
using PARR.DAL.NextRunServices;
using PARR.DAL.NextRunServices.Subservices;
using PARR.DAL.Repositories;
using PARR.DAL.Repositories.Job;
using PARR.DAL.Repositories.Schedule;
using PARR.DAL.Repositories.TaskRepositories;
using PARR.DAL.Repositories.Unit;
using PARR.Domain.Settings;
namespace PARR.DAL
{
public static class DependencyInjection
{
// TODO: Избавиться от лишнего
/// <summary>
/// Устанавливает Dal сервисы (1)
/// </summary>
/// <param name="services"></param>
/// <param name="configuration"></param>
public static void AddDalServices(this IServiceCollection services, IConfiguration configuration)
{
//.EnableSensitiveDataLogging() - вкл подробное логирование при применении миграций, на проде выключить
services.AddDbContext<DataContext>(opt =>
opt
.EnableSensitiveDataLogging()
.UseNpgsql(configuration.GetConnectionString("DefaultConnection"))
);
// -----------------
// TODO: Переделать все репозитории, которые работаютс с PG с AddTransient на AddScoped
// -----------------
// Entity services
//services.AddTransient<IHostService, HostService>();
//services.AddTransient<IWorkGroupService, WorkGroupService>();
//services.AddTransient<IApplicationService, ApplicationService>();
//services.AddTransient<IApplicationTypeService, ApplicationTypeService>();
//services.AddTransient<IApplicationInHostService, ApplicationInHostService>();
//services.AddTransient<IApplicationsInWorkService, ApplicationsInWorkService>();
//services.AddTransient<IApplicationService, ApplicationService>();
services.AddTransient<IProcessRepository, ProcessRepository>();
services.AddTransient<ISubprocessRepository, SubprocessRepository>();
services.AddTransient<ITnkRepository, TnkRepository>();
services.AddTransient<ITemplateRepository, TemplateRepository>();
services.AddTransient<IStatusTemplateRepository, StatusTemplateRepository>();
services.AddTransient<IRobotHistoryLevelRepository, RobotHistoryLevelRepository>();
services.AddTransient<IRobotStatusRepository, RobotStatusRepository>();
services.AddTransient<IRobotRepository, RobotRepository>();
services.AddTransient<IRobotConfigurationRepository, RobotConfigurationRepository>();
services.AddTransient<IRobotHistoryRepository, RobotHistoryRepository>();
services.AddTransient<IEsppSchTypeConfigRepository, EsppSchTypeConfigRepository>();
services.AddTransient<IAgentHistoryRepository, AgentHistoryRepository>();
services.AddTransient<IOrderRepository, OrderRepository>();
services.AddTransient<IOrderStatusRepository, OrderStatusRepository>();
services.AddTransient<IUserRepository, UserRepository>();
services.AddTransient<IRoleRepository, RoleRepository>();
services.AddTransient<ITaskStatusRepository, TaskStatusRepository>();
//services.AddTransient<IEkStatusService, EkStatusService>();
services.AddTransient<IEsppSchTypeScheduleRepository, EsppSchTypeScheduleRepository>();
services.AddTransient<IWeekendDayRepository, WeekendDayRepository>();
services.AddTransient<IDistributionPeriodRepository, DistributionPeriodRepository>();
services.AddTransient<IEsppSchTypeValueRepository, EsppSchTypeValueRepository>();
//services.AddTransient<IResponseAreaService, ResponseAreaService>();
services.AddTransient<ITemplateHistoryRepository, TemplateHistoryRepository>();
services.AddTransient<IParrComponentRepository, ParrComponentRepository>();
services.AddTransient<ITemplateStatusTypeRepository, TemplateStatusTypeRepository>();
#region Schedule
services.AddTransient<IScheduleExcludeTypeRepository, ScheduleExcludeTypeRepository>();
services.AddTransient<IScheduleExcludeTypeCalendarRepository, ScheduleExcludeTypeCalendarRepository>();
#endregion
#region Unit
services.AddTransient<IUnitRepository, UnitRepository>();
services.AddTransient<IUnitFieldValueRepository, UnitFieldValueRepository>();
services.AddTransient<IUnitFieldRepository, UnitFieldRepository>();
services.AddTransient<IUnitInUnitRepository, UnitInUnitRepository>();
services.AddTransient<IUnitInValueRepository, UnitInValueRepository>();
services.AddTransient<IUnitRegionalEkPtkGroupRepository, UnitRegionalEkPtkGroupRepository>();
services.AddTransient<IUnitKiiUnitRepository, UnitKiiUnitRepository>();
#endregion
#region Job
services.AddTransient<IJobRepository, JobRepository>();
services.AddTransient<IJobGroupRepository, JobGroupRepository>();
services.AddTransient<IJobGroupTypeRepository, JobGroupTypeRepository>();
services.AddTransient<IJobUnitFilterRepository, JobUnitFilterRepository>();
services.AddTransient<IFieldFilterRepository, FieldFilterRepository>();
services.AddTransient<IJobUnitFilterRepository, JobUnitFilterRepository>();
services.AddTransient<IJobAutoControlRepository, JobAutoControlRepository>();
#endregion
#region Task
services.AddScoped<ITaskErrorRepository, TaskErrorRepository>();
services.AddScoped<ITaskRepository, TaskRepository>();
services.AddScoped<ITaskTypeRepository, TaskTypeRepository>();
#endregion
//services.AddTransient<INextRunModifierService, NextRunModifierService>();
#region NextRun Services
services.AddTransient<IEsppScheduleTransformService, EsppScheduleTransformService>();
services.AddTransient<ITemplateDistributor, TemplateDistributor>();
services.AddTransient<INextRunService, NextRunService>();
#endregion
#region DomainServces
services.AddTransient<IShortcodesService, ShortcodesService>();
services.AddTransient<IUnitFilterService, UnitFilterService>();
services.AddTransient<IMatchingStatusService, MatchingStatusService>();
services.Configure<UnitFilterServiceOptions>(options =>
{
options.LoadBatchSize = 50;
});
#endregion
}
/// <summary>
/// Добавляет конфигурацию Dal (2)
/// </summary>
/// <param name="builder"></param>
/// <param name="services"></param>
/// <returns></returns>
public static IConfigurationBuilder AddDalConfigurations(this IConfigurationBuilder builder, IServiceCollection services)
{
builder.Add(new DBConfigurationSource(services));
return builder;
}
/// <summary>
/// Добавляет конфигурацию в сервисы (3)
/// </summary>
/// <param name="services"></param>
/// <param name="configuration"></param>
public static void AddDallSettings(this IServiceCollection services, IConfiguration configuration)
{
//SettingsFromDb configuration
var settingsFromDb = new SettingsFromDb();
configuration.GetSection(nameof(SettingsFromDb)).Bind(settingsFromDb);
services.AddSingleton(settingsFromDb);
PrefixSettings.PrefixWithoutVariable = settingsFromDb.TemplatePrefixWithoutVariable;
// Сервис - Расписание в ЕСПП. Смещение часового пояса относительно МСК для зоны ответственности рабочей группы
services.AddSingleton<IScheduleResponseAreaTimeOffsetRepository>(provider =>
{
using var scope = provider.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<DataContext>();
var settingsFromDb = scope.ServiceProvider.GetRequiredService<SettingsFromDb>();
var logger = scope.ServiceProvider.GetRequiredService<ILogger<ScheduleResponseAreaTimeOffsetRepository>>();
return new ScheduleResponseAreaTimeOffsetRepository(dbContext, settingsFromDb, logger);
});
}
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Models;
namespace PARR.DAL.DomainModels
{
/// <summary>
/// Расписание ЕСПП в нормальном виде
/// </summary>
public class EsppScheduleDto
{
public required EsppSchTypeSchedule TypeSchedule { get; set; }
public required List<EsppScheduleValDto> Values { get; set; }
}
public class EsppScheduleValDto
{
public int Order { get; set; }
public required EsppSchType Type { get; set; }
public required EsppSchTypeValue Value { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
using Microsoft.EntityFrameworkCore;
using PARR.Core.Common.Interfaces;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.DomainModels;
using PARR.DAL.DomainServices.Interfaces;
using PARR.DAL.Services.Interfaces.Job;
using PARR.Domain.Cache.Models;
using PARR.Domain.Enums;
@@ -11,13 +11,13 @@ namespace PARR.DAL.DomainServices.Implementations
internal class MatchingStatusService : IMatchingStatusService
{
private readonly IRedisCacheService redisCacheService;
private readonly IJobService jobService;
private readonly IJobGroupService jobGroupService;
private readonly IJobRepository jobService;
private readonly IJobGroupRepository jobGroupService;
public MatchingStatusService(
IRedisCacheService redisCacheService,
IJobService jobService,
IJobGroupService jobGroupService
IJobRepository jobService,
IJobGroupRepository jobGroupService
)
{
this.redisCacheService = redisCacheService;

View File

@@ -1,5 +1,5 @@
using PARR.DAL.DomainModels;
using PARR.DAL.Models;
using PARR.Domain.Entities;
using System.Runtime.CompilerServices;
namespace PARR.DAL.DomainServices.Shortcodes

View File

@@ -1,16 +1,16 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.Core.Common.Interfaces;
using PARR.Core.Repositories.Interfaces;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.Core.Repositories.Interfaces.Unit;
using PARR.DAL.Contracts;
using PARR.DAL.DomainModels;
using PARR.DAL.DomainServices.UnitFilterService;
using PARR.DAL.Models;
using PARR.DAL.Models.Job;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Unit;
using PARR.Domain.Cache.Models;
using PARR.Domain.Common.Template;
using PARR.Domain.Entities;
using PARR.Domain.Entities.Job;
using PARR.Domain.Enums;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
@@ -49,11 +49,11 @@ namespace PARR.DAL.DomainServices.Shortcodes
private readonly ILogger<ShortcodesService> logger;
private readonly SettingsFromDb settingsFromDb;
private readonly IJobService jobService;
private readonly IUnitService unitService;
private readonly IUnitInValueService unitInValueService;
private readonly IUnitFieldService unitFieldService;
private readonly ITemplateService templateService;
private readonly IJobRepository jobService;
private readonly IUnitRepository unitService;
private readonly IUnitInValueRepository unitInValueService;
private readonly IUnitFieldRepository unitFieldService;
private readonly ITemplateRepository templateService;
private readonly IRedisCacheService cacheService;
private readonly IUnitFilterService unitFilterService;
@@ -97,12 +97,12 @@ namespace PARR.DAL.DomainServices.Shortcodes
public ShortcodesService(
ILogger<ShortcodesService> logger,
SettingsFromDb settingsFromDb,
IJobService jobService,
IUnitService unitService,
IJobRepository jobService,
IUnitRepository unitService,
IUnitFilterService unitFilterService,
IUnitInValueService unitInValueService,
IUnitFieldService unitFieldService,
ITemplateService templateService,
IUnitInValueRepository unitInValueService,
IUnitFieldRepository unitFieldService,
ITemplateRepository templateService,
IRedisCacheService cacheService
)
{

View File

@@ -1,5 +1,5 @@
using PARR.DAL.DomainServices.UnitFilterService.Models;
using PARR.DAL.Models.Job;
using PARR.Domain.Entities.Job;
namespace PARR.DAL.DomainServices.UnitFilterService
{

View File

@@ -2,12 +2,12 @@
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using PARR.Core.Common.Interfaces;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.Core.Repositories.Interfaces.Unit;
using PARR.DAL.DomainServices.UnitFilterService.Models;
using PARR.DAL.Models.Job;
using PARR.DAL.Models.Unit;
using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Unit;
using PARR.Domain.Cache.Models;
using PARR.Domain.Entities.Job;
using PARR.Domain.Entities.Unit;
using PARR.Domain.Enums;
using System.Diagnostics;
@@ -25,22 +25,22 @@ internal class UnitFilterService : IUnitFilterService
private readonly int batchSize;
private readonly ILogger<UnitFilterService> logger;
private readonly IJobService jobService;
private readonly IUnitService unitService;
private readonly IUnitInUnitService unitInUnitService;
private readonly IJobRepository jobService;
private readonly IUnitRepository unitService;
private readonly IUnitInUnitRepository unitInUnitService;
private readonly IRedisCacheService cacheService;
private readonly IUnitFieldService unitFieldService;
private readonly IUnitInValueService unitInValueService;
private readonly IUnitFieldRepository unitFieldService;
private readonly IUnitInValueRepository unitInValueService;
public UnitFilterService(
ILogger<UnitFilterService> logger,
IJobService jobService,
IUnitService unitService,
IUnitInUnitService unitInUnitService,
IUnitInValueService unitInValueService,
IJobRepository jobService,
IUnitRepository unitService,
IUnitInUnitRepository unitInUnitService,
IUnitInValueRepository unitInValueService,
IRedisCacheService cacheService,
IOptions<UnitFilterServiceOptions> options,
IUnitFieldService unitFieldService
IUnitFieldRepository unitFieldService
)
{
this.logger = logger;

View File

@@ -51,7 +51,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TemplateId");
b.ToTable("AgentHistories");
b.ToTable("AgentHistories", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b =>
@@ -72,7 +72,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("AgentHistoryLevels");
b.ToTable("AgentHistoryLevels", (string)null);
b.HasData(
new
@@ -1598,7 +1598,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TemplateId");
b.ToTable("Orders");
b.ToTable("Orders", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b =>
@@ -1619,7 +1619,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Code");
b.ToTable("OrderStatuses");
b.ToTable("OrderStatuses", (string)null);
b.HasData(
new
@@ -1672,7 +1672,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("Name")
.IsUnique();
b.ToTable("ParrComponents");
b.ToTable("ParrComponents", (string)null);
b.HasData(
new
@@ -1785,7 +1785,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("EsppId")
.IsUnique();
b.ToTable("Processes");
b.ToTable("Processes", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.Robot", b =>
@@ -1809,7 +1809,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("Name")
.IsUnique();
b.ToTable("Robots");
b.ToTable("Robots", (string)null);
b.HasData(
new
@@ -1868,7 +1868,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("TemplateId", "TaskStatusCode");
b.ToTable("RobotConfigurations");
b.ToTable("RobotConfigurations", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b =>
@@ -1909,7 +1909,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("RobotConfigurationId", "DateCreated");
b.ToTable("RobotHistories");
b.ToTable("RobotHistories", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b =>
@@ -1930,7 +1930,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Level");
b.ToTable("RobotHistoryLevels");
b.ToTable("RobotHistoryLevels", (string)null);
b.HasData(
new
@@ -1977,7 +1977,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Code");
b.ToTable("RobotStatuses");
b.ToTable("RobotStatuses", (string)null);
b.HasData(
new
@@ -2025,7 +2025,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("Roles");
b.ToTable("Roles", (string)null);
b.HasData(
new
@@ -2194,7 +2194,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Name");
b.ToTable("Settings");
b.ToTable("Settings", (string)null);
b.HasData(
new
@@ -2318,7 +2318,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("ProcessId");
b.ToTable("Subprocesses");
b.ToTable("Subprocesses", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.TaskStatus", b =>
@@ -2339,7 +2339,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Code");
b.ToTable("TaskStatuses");
b.ToTable("TaskStatuses", (string)null);
b.HasData(
new
@@ -2425,7 +2425,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("Name", "Index")
.IsUnique();
b.ToTable("Templates");
b.ToTable("Templates", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b =>
@@ -2478,7 +2478,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("ParentId");
b.ToTable("TemplateHistories");
b.ToTable("TemplateHistories", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.TemplateStatusType", b =>
@@ -2496,7 +2496,7 @@ namespace PARR.DAL.Migrations
b.HasKey("Id");
b.ToTable("TemplateStatusTypes", t =>
b.ToTable("TemplateStatusTypes", null, t =>
{
t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
});
@@ -2557,7 +2557,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("SubprocessId");
b.ToTable("Tnks");
b.ToTable("Tnks", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b =>
@@ -2823,7 +2823,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("Ip")
.IsUnique();
b.ToTable("Users");
b.ToTable("Users", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b =>
@@ -2838,7 +2838,7 @@ namespace PARR.DAL.Migrations
b.HasIndex("UserId");
b.ToTable("UsersInRoles");
b.ToTable("UsersInRoles", (string)null);
});
modelBuilder.Entity("PARR.DAL.Models.WeekendDay", b =>

View File

@@ -1,37 +0,0 @@
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// История работы агентов
/// </summary>
[Table("AgentHistories")]
public class AgentHistory : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public string? Message { get; set; }
public int HistoryLevelId { get; set; }
public Guid TemplateId { get; set; }
public Guid? OrderId { get; set; }
[ForeignKey(nameof(TemplateId))]
public Template? Template { get; set; }
[ForeignKey(nameof(HistoryLevelId))]
public AgentHistoryLevel? AgentHistoryLevel { get; set; }
public Order? Order { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("AgentHistoryLevels")]
public class AgentHistoryLevel
{
[Key]
public int Id { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<AgentHistory> AgentHistories { get; set; } = new HashSet<AgentHistory>();
}
}

View File

@@ -1,69 +0,0 @@
using PARR.DAL.Models.Job;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Период автоматического распеделения РР
/// </summary>
[Table("DistributionPeriods", Schema = DatabaseSchemas.Schedule)]
public class DistributionPeriod : IBaseEntity
{
[Key]
public Guid Id { get; set; }
[NotMapped]
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public required string Duration { get; set; }
public required string Type { get; set; }
//public DateTimeOffset AddDate
//{
// get
// {
// var typeEnum = Enum.Parse(typeof(DistributionPeriodTypeEnum), Type);
// switch (typeEnum)
// {
// case (DistributionPeriodTypeEnum.Day):
// int.TryParse(Duration, out var intDays);
// return new DateTimeOffset().AddDays(intDays);
// case (DistributionPeriodTypeEnum.Month):
// int.TryParse(Duration, out var intMonth);
// return new DateTimeOffset().AddMonths(intMonth);
// case (DistributionPeriodTypeEnum.Year):
// int.TryParse(Duration, out var intYear);
// return new DateTimeOffset().AddYears(intYear);
// case (DistributionPeriodTypeEnum.TimeSpan):
// TimeSpan.TryParse(Duration, out var timeSpan);
// return new DateTimeOffset().Add(timeSpan);
// }
// return new DateTimeOffset();
// }
//}
[ForeignKey(nameof(Type))]
public DistributionPeriodType? DistributionPeriodType { get; set; }
public ICollection<JobGroupDistributionConfig> GroupDistributionConfig { get; set; } = new HashSet<JobGroupDistributionConfig>();
//public ICollection<EsppSchTypeValue> EsppSchTypeValues { get; set; } = new HashSet<EsppSchTypeValue>();
}
}

View File

@@ -1,18 +0,0 @@
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("DistributionPeriodTypes", Schema = DatabaseSchemas.Schedule)]
public class DistributionPeriodType
{
[Key]
public required string Type { get; set; }
public required string Description { get; set; }
public ICollection<DistributionPeriod> Periods { get; set; } = new HashSet<DistributionPeriod>();
}
}

View File

@@ -1,26 +0,0 @@
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: типы повторений
/// </summary>
[Table("EsppSchTypes", Schema = DatabaseSchemas.Schedule)]
public class EsppSchType
{
[Key]
public int Id { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<EsppSchTypeValue> EsppSchTypeValues { get; set; } = new HashSet<EsppSchTypeValue>();
public ICollection<EsppSchTypeConfig> EsppSchTypeConfigs { get; set; } = new HashSet<EsppSchTypeConfig>();
}
}

View File

@@ -1,39 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: Конфигурация типов
/// </summary>
[Table("EsppSchTypeConfigs", Schema = DatabaseSchemas.Schedule)]
[Index(nameof(TypeScheduleId), nameof(TypeId), IsUnique = true)]
public class EsppSchTypeConfig : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public int TypeScheduleId { get; set; }
public int TypeId { get; set; }
public int Order { get; set; }
[ForeignKey(nameof(TypeId))]
public EsppSchType? EsppSchType { get; set; }
[ForeignKey(nameof(TypeScheduleId))]
public EsppSchTypeSchedule? EsppSchTypeSchedule { get; set; }
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
}
}

View File

@@ -1,23 +0,0 @@
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: Повторять задачу
/// </summary>
[Table("EsppSchTypeSchedules", Schema = DatabaseSchemas.Schedule)]
public class EsppSchTypeSchedule
{
[Key]
public int Id { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<EsppSchTypeConfig> EsppSchTypeConfigs { get; set; } = new HashSet<EsppSchTypeConfig>();
}
}

View File

@@ -1,56 +0,0 @@
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: значения типов повторений
/// </summary>
[Table("EsppSchTypeValues", Schema = DatabaseSchemas.Schedule)]
public class EsppSchTypeValue : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Значение в ЕСПП, при создании/изменении расписания
/// </summary>
public required string Value { get; set; }
public int TypeId { get; set; }
/// <summary>
/// Значение ЕСПП при отображении представления, используется при экспорте
/// </summary>
public required string EsppExportValue { get; set; }
/// <summary>
/// Сортировка в интерфейсе ПАРР (для удобста должна совпадать с ЕСПП)
/// </summary>
public int Order { get; set; }
///// <summary>
///// Если есть связь с периодом, то есть функция автораспределения
///// </summary>
//public Guid? DistributionPeriodId { get; set; }
//[ForeignKey(nameof(DistributionPeriodId))]
//public DistributionPeriod? DistributionPeriod { get; set; }
[ForeignKey(nameof(TypeId))]
public EsppSchType? EsppSchType { get; set; }
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
}
}

View File

@@ -1,39 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Job;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Расписание ЕСПП: значения заданий для ApplicationsInWorks
/// </summary>
[Table("EsppSchValues", Schema = DatabaseSchemas.Schedule)]
//[Index(nameof(ApplicationsInWorkId), nameof(TypeValueId), nameof(TypeConfigId), IsUnique = true)]
//[PrimaryKey(nameof(ApplicationsInWorkId), nameof(TypeValueId), nameof(TypeConfigId))]
[PrimaryKey(nameof(JobGroupId), nameof(TypeValueId), nameof(TypeConfigId))]
public class EsppSchValue
{
//public Guid ApplicationsInWorkId { get; set; }
public Guid TypeValueId { get; set; }
public Guid TypeConfigId { get; set; }
public Guid JobGroupId { get; set; }
//[ForeignKey(nameof(ApplicationsInWorkId))]
//public ApplicationsInWork? ApplicationsInWork { get; set; }
[ForeignKey(nameof(TypeValueId))]
public EsppSchTypeValue? EsppSchTypeValue { get; set; }
[ForeignKey(nameof(TypeConfigId))]
public EsppSchTypeConfig? EsppSchTypeConfig { get; set; }
[ForeignKey(nameof(JobGroupId))]
public JobGroup? JobGroup { get; set; }
}
}

View File

@@ -1,84 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("Jobs", Schema = DatabaseSchemas.Job)]
[Comment("Таблица видов работ")]
public class Job : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Наименование работ для интерфеса в ПАРР
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Наименование работ для поля Работа в шаблоне АСУ ЕСПП, может быть динамическое
/// </summary>
public required string WorkName { get; set; }
/// <summary>
/// Минимальное значение дочерних или родительских связей группового ЭК
/// </summary>
public int? MinValueRelationships { get; set; }
/// <summary>
/// Максимальное значение дочерних или родительских связей группового ЭК
/// </summary>
public int? MaxValueRelationships { get; set; }
/// <summary>
/// Для подсчёта связей групового ЭК использовать родительсике или дочерние связи
/// </summary>
/// <value>
/// true - диапазон связей относится к родительским связям<br/>
/// false, null - диапазон относится к дочерним связям
/// </value>
public bool? IsParentRelationships { get; set; }
/// <summary>
/// Маска для динамического формирования имени шаблона
/// </summary>
public required string TemplateNameMask { get; set; }
/// <summary>
/// Маска для динамического формирования рабочей группы исполнителей шаблона
/// </summary
public required string WorkGroupMask { get; set; }
/// <summary>
/// Зона ответственности
/// </summary>
public required string ResponseAreaMask { get; set; }
public Guid TnkId { get; set; }
public Guid GroupId { get; set; }
[ForeignKey(nameof(GroupId))]
public JobGroup? Group { get; set; }
[ForeignKey(nameof(TnkId))]
public Tnk? Tnk { get; set; }
public ICollection<JobUnitFilter> UnitFilters { get; set; } = new HashSet<JobUnitFilter>();
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
public JobAutoControl? AutoControl { get; set; }
}
}

View File

@@ -1,35 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("AutoControls", Schema = DatabaseSchemas.Job)]
[Comment("Таблица управления автоконтролем для работ")]
public class JobAutoControl
{
[Key]
public Guid JobId { get; set; }
/// <summary>
/// Включен автоконтроль
/// </summary>
public bool IsEnable { get; set; } = false;
/// <summary>
/// Статус шаблона в момент привязки или создания нового шаблона к Job
/// </summary>
public bool InitUsedTemplateState { get; set; } = false;
/// <summary>
/// Статус расписания в момент привязки или создания нового шаблона к Job
/// </summary>
public bool InitUsedScheduleState { get; set; } = false;
[ForeignKey(nameof(JobId))]
public Job? Job { get; set; }
}
}

View File

@@ -1,40 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Unit;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("FieldFilters", Schema = DatabaseSchemas.Job)]
[Comment("Таблица описания критериев выборки аттрибутов ЭК")]
public class JobFieldFilter : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public Guid UnitFilterId { get; set; }
public Guid FieldId { get; set; }
public required string ValueMask { get; set; }
/// <summary>
/// Отсутствует
/// </summary>
public bool IsInverse { get; set; } = false;
[ForeignKey(nameof(FieldId))]
public UnitField? UnitField { get; set; }
[ForeignKey(nameof(UnitFilterId))]
public JobUnitFilter? UnitFilter { get; set; }
}
}

View File

@@ -1,196 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Schedule;
using PARR.DAL.Models.Unit;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Settings;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("Groups", Schema = DatabaseSchemas.Job)]
[Comment("Таблица описания групп работ, для реализации зонтиков")]
public class JobGroup : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Наименование работ для интерфеса в ПАРР
/// </summary>
public required string GroupName { get; set; }
///// <summary>
///// Связана ли работа с групповыми ЭК(зонтами)
///// </summary>
//public bool? IsUmbrella { get; set; }
/// <summary>
/// Поле Короткое описания шаблона АСУ ЕСПП
/// </summary>
public required string ShortDescription { get; set; }
/// <summary>
/// Поле Подробное описания шаблона АСУ ЕСПП
/// </summary>
private string _fullDescription = string.Empty;
public required string FullDescription
{
get
{
//В полное описание подставляем префикс, для дальнейшего поиска наряда
return $"{_fullDescription}\r\n{PrefixSettings.PrefixWithoutVariable}";
}
set
{
//удаляем префикс, если он есть
//_fullDescription = value.Replace($"\r\n{PrefixSettings.PrefixWithoutVariable}", string.Empty);
_fullDescription = value.Replace($"{PrefixSettings.PrefixWithoutVariable}", string.Empty).TrimEnd();
}
}
//public required string FullDescription { get; set; }
/// <summary>
/// Поле Решение описания шаблона АСУ ЕСПП
/// </summary>
public required string Solution { get; set; }
/// <summary>
/// Поле Длительность описания шаблона АСУ ЕСПП
/// </summary>
public required string TemplateDuration { get; set; }
/// <summary>
/// TemplateDuration в формате TimeSpan
/// </summary>
public TimeSpan? TemplateDurationTimeSpan
{
get
{
try
{
//ЕСПП кривоногие, они почему-то таймспан пишут так "7 00:00:00", а правильно так: "7:00:00:00"
var durationWithTimeSpanFormat = TemplateDuration.Replace(" ", ":");
return TimeSpan.Parse(durationWithTimeSpanFormat);
}
catch
{
return null;
}
}
}
/// <summary>
/// Дата начала работ или дата для отсчёта периода следующего выполнения
/// </summary>
public DateTimeOffset ReferenceDate { get; set; }
/// <summary>
/// Смещение часового пояса пользователя в минутах относительно UTC на момент ReferenceDate
/// </summary>
[Comment("Смещение часового пояса пользователя в минутах относительно UTC на момент ReferenceDate")]
public int? UserTimeZoneOffsetMinutes { get; set; }
/// <summary>
/// Смещение часового пояса пользователя относительно UTC на момент ReferenceDate, рассчитывается из поля UserTimeZoneOffsetMinutes
/// </summary>
[NotMapped]
public TimeSpan? UserTimeZoneOffset =>
UserTimeZoneOffsetMinutes.HasValue
? TimeSpan.FromMinutes(UserTimeZoneOffsetMinutes.Value)
: null;
/// <summary>
/// Использовать таймзону рабочей группы ответственного за ЭК шаблона
/// </summary>
public bool IsResponseAreaTimezone { get; set; } = false;
/// <summary>
/// Включить автораспределение
/// </summary>
public bool IsAutoDistributionEnabled { get; set; }
/// <summary>
/// Выполняет агент
/// </summary>
public bool IsAgent { get; set; }
/// <summary>
/// Какое-то имя которое мы передаем агенту, пока непонятно что это такое.
/// </summary>
public string? AgentName { get; set; }
/// <summary>
/// Сколько времени ожидать выполнение скрипта агентом (секунд)
/// </summary>
public int? AgentTimeOutSec { get; set; }
/// <summary>
/// Скрипт для автоматического выполнения
/// </summary>
public string? AgentScript { get; set; }
/// <summary>
/// Тип группы
/// </summary>
public Guid GroupTypeId { get; set; }
/// <summary>
/// Если тип группы - "Сгруппированный", то это поле обязательно, по нему будем группировать
/// TODO: !!!! Связь с иаблице UnitField не создавалась! Нужно это переделать и унести в отдельную таблицу
/// </summary>
public Guid? GroupingUnitFieldId { get; set; }
/// <summary>
/// Группировать по ответственному за ЭК.
/// Если тип группы - "Сгруппированный", то можно менять значение этого поля, в иных случаях - null
/// TODO: По хорошему вынести это в другую таблицу, так как это касается только групповых работ
/// </summary>
public bool? IsGroupByResponsible { get; set; }
/// <summary>
/// Расписание регламентной работы - Тип исключения
/// </summary>
public Guid ScheduleExcludeTypeId { get; set; }
/// <summary>
/// Расписание регламентной работы, исключение - Календарь
/// </summary>
public Guid? ScheduleExcludeTypeCalendarId { get; set; }
/// <summary>
/// Поле по которому группируется (!!!отключено каскадное удаление!!!)
/// </summary>
[ForeignKey(nameof(GroupingUnitFieldId))]
public UnitField? GroupingUnitField { get; set; }
[ForeignKey(nameof(GroupTypeId))]
public JobGroupType? GroupType { get; set; }
public ICollection<Job> Jobs { get; set; } = new HashSet<Job>();
public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
[ForeignKey(nameof(ScheduleExcludeTypeId))]
public ScheduleExcludeType? ScheduleExcludeType { get; set; }
[ForeignKey(nameof(ScheduleExcludeTypeCalendarId))]
public ScheduleExcludeTypeCalendar? ScheduleExcludeTypeCalendar { get; set; }
public JobGroupDistributionConfig? DistributionConfig { get; set; }
}
}

View File

@@ -1,37 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
/// <summary>
/// Настройки автораспределения для JobGroup
/// </summary>
[Table("GroupDistributionConfigs", Schema = DatabaseSchemas.Job)]
[Comment("Настройки автораспределения для группы работ")]
public class JobGroupDistributionConfig
{
[Key]
public Guid GroupId { get; set; }
public Guid DistributionPeriodId { get; set; }
/// <summary>
/// Исключать выходные и праздничные дни
/// </summary>
public bool IsExcludeWeekends { get; set; }
/// <summary>
/// Группировать по рабочей группе
/// </summary>
public bool IsGroupingByWorkGroup { get; set; }
[ForeignKey(nameof(GroupId))]
public JobGroup? Group { get; set; }
[ForeignKey(nameof(DistributionPeriodId))]
public DistributionPeriod? DistributionPeriod { get; set; }
}
}

View File

@@ -1,31 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using PARR.Domain.Enums;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("GroupTypes", Schema = DatabaseSchemas.Job)]
[Comment("Таблица типов групп работ")]
public class JobGroupType : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required JobGroupTypesEnum Code { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<JobGroup> JobGroups { get; set; } = new HashSet<JobGroup>();
}
}

View File

@@ -1,51 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Unit;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("RelationshipFilters", Schema = DatabaseSchemas.Job)]
[Comment("Таблица фильтров связей ЭК")]
[PrimaryKey(nameof(UnitFilterId), nameof(FieldId))]
public class JobRelationshipFilter //: IBase
{
//[Key]
//public Guid Id { get; set; }
//public DateTimeOffset DateCreated { get; set; }
//public DateTimeOffset? DateModified { get; set; }
public Guid UnitFilterId { get; set; }
/// <summary>
/// Родительская связь - true,
/// Дочерняя связь - false
/// </summary>
public bool IsParent { get; set; }
public Guid FieldId { get; set; }
public required string ValueMask { get; set; }
/// <summary>
/// Полное совпадение или хотябы одно
/// true - list.All()
/// false - list.Any()
/// </summary>
public bool IsFullMatch { get; set; }
/// <summary>
/// Обратный фильтр, что у связи нет таких значений
/// </summary>
public bool IsInverse { get; set; }
[ForeignKey(nameof(UnitFilterId))]
public JobUnitFilter? UnitFilter { get; set; }
[ForeignKey(nameof(FieldId))]
public UnitField? UnitField { get; set; }
}
}

View File

@@ -1,33 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Job
{
[Table("UnitFilters", Schema = DatabaseSchemas.Job)]
[Comment("Таблица описания критериев выборки ЭК, описание полей в АСУ ЕСПП")]
public class JobUnitFilter : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string UnitFilter { get; set; }
public Guid JobId { get; set; }
[ForeignKey(nameof(JobId))]
public Job? Job { get; set; }
public ICollection<JobFieldFilter> FieldFilters { get; set; } = new HashSet<JobFieldFilter>();
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
}
}

View File

@@ -1,58 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Наряды ЕСПП
/// </summary>
[Table("Orders")]
[Index(nameof(Number), IsUnique = true)]
public class Order : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Number { get; set; }
public required string ShortName { get; set; }
public string? WorkGroup { get; set; }
public Guid? TemplateId { get; set; }
/// <summary>
/// Статус в ЕСПП
/// </summary>
public int StatusCode { get; set; }
/// <summary>
/// Статус который должен быть в ЕСПП
/// </summary>
public int? NextStatusCode { get; set; }
/// <summary>
/// Дата генерации наряда в ЕСПП
/// </summary>
public DateTimeOffset? GenerateDate { get; set; }
public DateTimeOffset ExpirationDate { get; set; }
[ForeignKey(nameof(TemplateId))]
public Template? Template { get; set; }
[ForeignKey(nameof(StatusCode))]
public OrderStatus? OrderStatus { get; set; }
[ForeignKey(nameof(NextStatusCode))]
public OrderStatus? NextStatus { get; set; }
public ICollection<AgentHistory> AgentHistories { get; set; } = new HashSet<AgentHistory>();
}
}

View File

@@ -1,22 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("OrderStatuses")]
public class OrderStatus
{
[Key]
public int Code { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
[InverseProperty(nameof(Order.OrderStatus))]
public ICollection<Order> Orders { get; set; } = new HashSet<Order>();
[InverseProperty(nameof(Order.NextStatus))]
public ICollection<Order> OrdersNext { get; set; } = new HashSet<Order>();
}
}

View File

@@ -1,19 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Enums;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("ParrComponents")]
[Index(nameof(Name), IsUnique = true)]
public class ParrComponent
{
[Key]
public ParrComponentsEnum Id { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
}
}

View File

@@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Processes")]
[Index(nameof(EsppId), IsUnique = true)]
public class Process : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public int EsppId { get; set; }
public ICollection<Subprocess> Subprocesses { get; set; } = new HashSet<Subprocess>();
}
}

View File

@@ -1,17 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("AppInWorkInWorkGroups")]
//[PrimaryKey(nameof(ApplicationsInWorkId), nameof(WorkGroupId))]
//public class AppInWorkInWorkGroup
//{
// public Guid ApplicationsInWorkId { get; set; }
// public Guid WorkGroupId { get; set; }
// public ApplicationsInWork? ApplicationsInWork { get; set; }
// public WorkGroup? WorkGroup { get; set; }
//}
}

View File

@@ -1,31 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("Applications")]
//[Index(nameof(Name), nameof(ApplicationTypeId), IsUnique = true)]
//public class Application : IBaseEntity
//{
// [Key]
// public Guid Id { get; set; }
// public DateTimeOffset DateCreated { get; set; }
// public DateTimeOffset? DateModified { get; set; }
// public required string Name { get; set; }
// public Guid ApplicationTypeId { get; set; }
// [ForeignKey(nameof(ApplicationTypeId))]
// public ApplicationType? ApplicationType { get; set; }
// public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
// public ICollection<ApplicationsInWork> ApplicationsInWorks { get; set; } = new HashSet<ApplicationsInWork>();
//}
}

View File

@@ -1,23 +0,0 @@
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("ApplicationsInHost")]
//public class ApplicationInHost : IBaseEntity
//{
// public Guid Id { get; set; }
// public DateTimeOffset DateCreated { get; set; }
// public DateTimeOffset? DateModified { get; set; }
// public Guid ApplicationId { get; set; }
// [ForeignKey(nameof(ApplicationId))]
// public Application? Application { get; set; }
// public Guid HostId { get; set; }
// [ForeignKey(nameof(HostId))]
// public Host? Host { get; set; }
//}
}

View File

@@ -1,18 +0,0 @@
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("ApplicationTypes")]
//public class ApplicationType : IBaseEntity
//{
// public Guid Id { get; set; }
// public DateTimeOffset DateCreated { get; set; }
// public DateTimeOffset? DateModified { get; set; }
// public required string Name { get; set; }
// public string? Description { get; set; }
// public ICollection<Application> Applications { get; set; } = new HashSet<Application>();
//}
}

View File

@@ -1,122 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using PARR.Domain.Settings;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("ApplicationsInWorks")]
//[Index(nameof(WorkId), nameof(ApplicationId), IsUnique = true)]
//public class ApplicationsInWork : IBaseEntity
//{
// [Key]
// public Guid Id { get; set; }
// public DateTimeOffset DateCreated { get; set; }
// public DateTimeOffset? DateModified { get; set; }
// public Guid WorkId { get; set; }
// public Guid ApplicationId { get; set; }
// /// <summary>
// /// TemplateDuration в формате ЕСПП
// /// </summary>
// public required string TemplateDuration { get; set; }
// /// <summary>
// /// TemplateDuration в формате TimeSpan
// /// </summary>
// public TimeSpan? TemplateDurationTimeSpan
// {
// get
// {
// try
// {
// //ЕСПП кривоногие, они почему-то таймспан пишут так "7 00:00:00", а правильно так: "7:00:00:00"
// var durationWithTimeSpanFormat = TemplateDuration.Replace(" ", ":");
// return TimeSpan.Parse(durationWithTimeSpanFormat);
// }
// catch
// {
// return null;
// }
// }
// }
// /// <summary>
// /// Краткое описание
// /// </summary>
// public required string ShortDescription { get; set; }
// private string _fullDescription = string.Empty;
// public required string FullDescription
// {
// get
// {
// //В полное описание подставляем префикс, для дальнейшего поиска наряда
// return $"{_fullDescription}\r\n{PrefixSettings.PrefixWithoutVariable}";
// }
// set
// {
// //удаляем префикс, если он есть
// //_fullDescription = value.Replace($"\r\n{PrefixSettings.PrefixWithoutVariable}", string.Empty);
// _fullDescription = value.Replace($"{PrefixSettings.PrefixWithoutVariable}", string.Empty).TrimEnd();
// }
// }
// /// <summary>
// /// Решение
// /// </summary>
// public required string Solution { get; set; }
// /// <summary>
// /// Включить автораспределение
// /// </summary>
// public bool IsAutoDistributionEnabled { get; set; }
// /// <summary>
// /// Дата начала работ
// /// </summary>
// public DateTimeOffset ReferenceDate { get; set; }
// /// <summary>
// /// Выполняет агент
// /// </summary>
// public bool IsAgent { get; set; }
// /// <summary>
// /// Какое-то имя которое мы передаем агенту, пока непонятно что это такое.
// /// </summary>
// public string? AgentName { get; set; }
// /// <summary>
// /// Сколько времени ожидать выполнение скрипта агентом (секунд)
// /// </summary>
// public int? AgentTimeOutSec { get; set; }
// /// <summary>
// /// Скрипт для автоматического выполнения
// /// </summary>
// public string? AgentScript { get; set; }
// //[ForeignKey(nameof(WorkId))]
// //public Work? Work { get; set; }
// [ForeignKey(nameof(ApplicationId))]
// public Application? Application { get; set; }
// // public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
// //public ICollection<EsppSchValue> EsppSchValues { get; set; } = new HashSet<EsppSchValue>();
// public ICollection<AppInWorkInWorkGroup> WorkGroups { get; set; } = new HashSet<AppInWorkInWorkGroup>();
// //public JobAutoControl? JobAutoControl { get; set; }
//}
}

View File

@@ -1,19 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("EkStatuses")]
//public class EkStatus
//{
// [Key]
// public int Code { get; set; }
// [Required]
// public string Name { get; set; } = string.Empty;
// public ICollection<Host> Hosts { get; set; } = new HashSet<Host>();
// //public ICollection<JobAutoControlInEkStatus> JobAutoControlInEkStatuses { get; set; } = new HashSet<JobAutoControlInEkStatus>();
//}
}

View File

@@ -1,58 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("Hosts")]
//[Index(nameof(IP))]
//[Index(nameof(Ek), IsUnique = true)]
//public class Host : IBaseEntity
//{
// [Key]
// public Guid Id { get; set; }
// public DateTimeOffset DateCreated { get; set; }
// public DateTimeOffset? DateModified { get; set; }
// public required string Ek { get; set; }
// public int EkStatusCode { get; set; }
// public string? IP { get; set; }
// //public string? RegionalEK { get; set; }
// //public string? LinkEK { get; set; }
// //TODO: удалить поле Status, вместо него использовать EkStatusCode
// //public string? StatusStr { get; set; }
// //public string? WorkGroup { get; set; }
// public Guid? WorkGroupId { get; set; }
// //TODO: удалить поле ResponseAreaStr
// //public string? ResponseAreaStr { get; set; }
// public int ResponseAreaCode { get; set; }
// public DateTimeOffset? LastLogon { get; set; }
// public ICollection<ApplicationInHost> ApplicationsInHosts { get; set; } = new HashSet<ApplicationInHost>();
// //public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
// [ForeignKey(nameof(EkStatusCode))]
// public EkStatus? EkStatus { get; set; }
// [ForeignKey(nameof(ResponseAreaCode))]
// public ResponseArea? ResponseArea { get; set; }
// [ForeignKey(nameof(WorkGroupId))]
// public WorkGroup? WorkGroup { get; set; }
//}
}

View File

@@ -1,19 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("ResponseAreas")]
//public class ResponseArea
//{
// [Key]
// public int Code { get; set; }
// [Required]
// public string Name { get; set; } = string.Empty;
// public ICollection<Host> Hosts { get; set; } = new HashSet<Host>();
// public ICollection<WorkGroup> WorkGroups { get; set; } = new HashSet<WorkGroup>();
//}
}

View File

@@ -1,29 +0,0 @@
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Removed
{
//[Table("WorkGroups")]
//public class WorkGroup : IBaseEntity
//{
// [Key]
// public Guid Id { get; set; }
// public DateTimeOffset DateCreated { get; set; }
// [NotMapped]
// public DateTimeOffset? DateModified { get; set; }
// public required string Name { get; set; }
// public int ResponseAreaCode { get; set; }
// public ICollection<Host> Hosts { get; set; } = new HashSet<Host>();
// public ICollection<AppInWorkInWorkGroup> AppInWorks { get; set; } = new HashSet<AppInWorkInWorkGroup>();
// [ForeignKey(nameof(ResponseAreaCode))]
// public ResponseArea? ResponseArea { get; set; }
//}
}

View File

@@ -1,21 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Robots")]
[Index(nameof(Name), IsUnique = true)]
public class Robot
{
[Key]
public int Code { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
}
}

View File

@@ -1,63 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("RobotConfigurations")]
[Index(nameof(TemplateId), nameof(RobotCode), IsUnique = true)]
[Index(nameof(TemplateId), nameof(TaskStatusCode))]
[Index(nameof(TemplateId), nameof(RobotStatusCode))]
public class RobotConfiguration : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public Guid TemplateId { get; set; }
/// <summary>
/// Идентификатор робота
/// </summary>
public int RobotCode { get; set; }
/// <summary>
/// Статус. Что нужно сделать роботу
/// </summary>
public int TaskStatusCode { get; set; }
/// <summary>
/// Статус работы робота
/// </summary>
public int RobotStatusCode { get; set; }
/// <summary>
/// Количество попыток выполнения задания роботом
/// </summary>
public int AttemptsNumber { get; set; }
/// <summary>
/// Последняя дата обновления статуса RobotStatusCode роботом
/// </summary>
public DateTimeOffset? LastRobotStatusUpdated { get; set; }
[ForeignKey(nameof(TemplateId))]
public Template? Template { get; set; }
[ForeignKey(nameof(RobotCode))]
public Robot? Robot { get; set; }
[ForeignKey(nameof(TaskStatusCode))]
public TaskStatus? TaskStatus { get; set; }
[ForeignKey(nameof(RobotStatusCode))]
public RobotStatus? RobotStatus { get; set; }
public ICollection<RobotHistory> RobotHistories { get; set; } = new HashSet<RobotHistory>();
}
}

View File

@@ -1,53 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("RobotHistories")]
[Index(nameof(HistoryLevel), nameof(DateCreated), IsDescending = new[] { false, true })]
[Index(nameof(RobotConfigurationId), nameof(DateCreated))]
[Index(nameof(DateCreated))]
public class RobotHistory : IBaseEntity
{
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public int HistoryLevel { get; set; }
public string? RobotMessage { get; set; }
public string? EsppMessage { get; set; }
/// <summary>
/// Статус. Что нужно было сделать роботу
/// </summary>
public int TaskStatusCode { get; set; }
public Guid RobotConfigurationId { get; set; }
/// <summary>
/// IP адрес робота
/// </summary>
public string? RobotIp { get; set; }
///// <summary>
///// Уникальный идентификатор серии выполнения, нужен для сопоставления истории
///// </summary>
//public Guid IdSeries { get; set; }
[ForeignKey(nameof(HistoryLevel))]
public RobotHistoryLevel? RobotHistoryLevel { get; set; }
[ForeignKey(nameof(RobotConfigurationId))]
public RobotConfiguration? RobotConfiguration { get; set; }
[ForeignKey(nameof(TaskStatusCode))]
public TaskStatus? StatusTask { get; set; }
}
}

View File

@@ -1,25 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Уровень логов работы робота
/// </summary>
[Table("RobotHistoryLevels")]
public class RobotHistoryLevel
{
[Key]
public int Level { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<RobotHistory> RobotHistories { get; set; } = new HashSet<RobotHistory>();
}
}

View File

@@ -1,23 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Статус работы робота
/// </summary>
[Table("RobotStatuses")]
public class RobotStatus
{
[Key]
public int Code { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
[Required]
public string Description { get; set; } = string.Empty;
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
}
}

View File

@@ -1,25 +0,0 @@
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Roles")]
public class Role : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<UsersInRole> Users { get; set; } = new HashSet<UsersInRole>();
}
}

View File

@@ -1,40 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Job;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Schedule
{
/// <summary>
/// Расписание регламентной работы - Тип исключения
/// </summary>
[Table("ExcludeTypes", Schema = DatabaseSchemas.Schedule)]
[Comment("Расписание регламентной работы - Тип исключения")]
public class ScheduleExcludeType : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Название в ПАРР
/// </summary>
public required string Title { get; set; }
public required string EsppName { get; set; }
public required string EsppValue { get; set; }
public required string Code { get; set; }
public ICollection<JobGroup> JobGroups { get; set; } = new HashSet<JobGroup>();
}
}

View File

@@ -1,40 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Job;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Schedule
{
/// <summary>
/// Расписание регламентной работы, исключение - Календарь
/// </summary>
[Table("ExcludeTypeCalendars", Schema = DatabaseSchemas.Schedule)]
[Comment("Расписание регламентной работы, исключение - Календарь")]
public class ScheduleExcludeTypeCalendar : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Название в ПАРР
/// </summary>
public required string Title { get; set; }
public required string EsppName { get; set; }
public required string EsppValue { get; set; }
public required string Code { get; set; }
public ICollection<JobGroup> JobGroups { get; set; } = new HashSet<JobGroup>();
}
}

View File

@@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Schedule
{
/// <summary>
/// Расписание в ЕСПП. Смещение часового пояса относительно МСК для зоны ответственности рабочей группы
/// </summary>
[Table("ResponseAreaTimeOffsets", Schema = DatabaseSchemas.Schedule)]
[Comment("Расписание в ЕСПП. Смещение часового пояса относительно МСК для зоны ответственности рабочей группы")]
public class ScheduleResponseAreaTimeOffset
{
[Key]
public required string ResponseArea { get; set; }
/// <summary>
/// ЕСПП значение
/// </summary>
public required string EsppValue { get; set; }
/// <summary>
/// Смещение относительно UTC
/// </summary>
public required TimeSpan UtcTimeOffset { get; set; }
}
}

View File

@@ -1,16 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Settings")]
public class Setting
{
[Key]
public required string Name { get; set; }
public required string Value { get; set; }
public required string Description { get; set; }
}
}

View File

@@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Subprocesses")]
[Index(nameof(EsppId), IsUnique = true)]
public class Subprocess : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public int EsppId { get; set; }
public Guid ProcessId { get; set; }
[ForeignKey(nameof(ProcessId))]
public Process? Process { get; set; }
public ICollection<Tnk> Tnks { get; set; } = new HashSet<Tnk>();
}
}

View File

@@ -1,25 +0,0 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
/// <summary>
/// Статус шаблона. Что нужно сделать роботу в ЕСПП
/// </summary>
[Table("TaskStatuses")]
public class TaskStatus
{
[Key]
public int Code { get; set; }
[Required]
public string Name { get; set; } = string.Empty;
[Required]
public string Description { get; set; } = string.Empty;
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
public ICollection<RobotHistory> RobotHistories { get; set; } = new HashSet<RobotHistory>();
}
}

View File

@@ -1,97 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Base.History;
using PARR.Domain.Entities.Base.History.Base;
using PARR.Domain.Enums;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Templates")]
[Index(nameof(Name), nameof(Index), IsUnique = true)]
public class Template : IBaseEntity, ITemplateGeneralProps, IHistoryInitiator, IMyHistory<TemplateHistory>
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
/// <summary>
/// Индекс, используется в групповых шаблонах
/// </summary>
public int? Index { get; set; }
public bool IsActiveTemplate { get; set; }
public bool IsActiveSchedule { get; set; }
/// <summary>
/// Номер расписания еспп
/// </summary>
public string? ScheduleEsppId { get; set; }
///// <summary>
///// Следующая дата срабатываения генерации наряда
///// </summary>
//public DateTimeOffset NextScheduleStart { get; set; }
///// <summary>
///// Следующа дата выполнения скрипта агентом. Может быть нулл если шаблон не автоматический (не выполняется скриптом)
///// </summary>
//public DateTimeOffset? NextScriptStart { get; set; }
public DateTimeOffset? LastRun { get; set; }
public DateTimeOffset NextRun { get; set; }
//public Guid ApplicationInWorkId { get; set; }
public Guid JobId { get; set; }
public Guid UnitId { get; set; }
public TemplateStatusTypeEnum StatusTypeId { get; set; } = TemplateStatusTypeEnum.Used;
//public Guid HostId { get; set; }
#region Initiator
public string? InitiatorIp { get; set; }
public ParrComponentsEnum? InitiatorParrComponentId { get; set; }
public string? InitiatorComment { get; set; }
#endregion
//[ForeignKey(nameof(ApplicationInWorkId))]
//public ApplicationsInWork? ApplicationsInWork { get; set; }
//[ForeignKey(nameof(HostId))]
//public Host? Host { get; set; }
[ForeignKey(nameof(JobId))]
public Job.Job? Job { get; set; }
[ForeignKey(nameof(UnitId))]
public Unit.Unit? Unit { get; set; }
public ICollection<RobotConfiguration> RobotConfigurations { get; set; } = new HashSet<RobotConfiguration>();
public ICollection<AgentHistory> AgentHistories { get; set; } = new HashSet<AgentHistory>();
public ICollection<Order> Orders { get; set; } = new HashSet<Order>();
public ICollection<TemplateHistory> TemplateHistories { get; set; } = new HashSet<TemplateHistory>();
public ICollection<UnitsInTemplate> UnitsInTemplate { get; set; } = new HashSet<UnitsInTemplate>();
public TemplateStatusType? StatusType { get; set; }
}
}

View File

@@ -1,53 +0,0 @@
using PARR.Domain.Entities.Base;
using PARR.Domain.Entities.Base.History;
using PARR.Domain.Entities.Base.History.Base;
using PARR.Domain.Enums;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("TemplateHistories")]
public class TemplateHistory : IBaseEntity, ITemplateGeneralProps, IHistoryInitiator, IHistoryTable
{
[Key]
public Guid Id { get; set; }
public Guid ParentId { get; set; }
public DateTimeOffset DateAddedToHistory { get; set; }
public string? InitiatorIp { get; set; }
public ParrComponentsEnum? InitiatorParrComponentId { get; set; }
public string? InitiatorComment { get; set; }
[NotMapped]
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
public bool IsActiveTemplate { get; set; }
public bool IsActiveSchedule { get; set; }
public DateTimeOffset? LastRun { get; set; }
public DateTimeOffset NextRun { get; set; }
public TemplateStatusTypeEnum StatusTypeId { get; set; } = TemplateStatusTypeEnum.Used;
public string? ScheduleEsppId { get; set; }
[ForeignKey(nameof(ParentId))]
public Template? Template { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Enums;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("TemplateStatusTypes")]
[Comment("Таблица описания критериев выборки аттрибутов ЭК")]
public class TemplateStatusType
{
[Key]
public TemplateStatusTypeEnum Id { get; set; }
public required string Name { get; set; }
public required string Description { get; set; }
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
}
}

View File

@@ -1,35 +0,0 @@
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Tnks")]
//[Index(nameof(EsppId), IsUnique = true)]
public class Tnk : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
public required string Name { get; set; }
/// <summary>
/// Краткое наименование, применяется в шорткоде "%ТНК-КРАТКО%"
/// </summary>
public string? ShortName { get; set; }
public int? EsppId { get; set; }
public Guid SubprocessId { get; set; }
[ForeignKey(nameof(SubprocessId))]
public Subprocess? Subprocess { get; set; }
public ICollection<Job.Job> Jobs { get; set; } = new HashSet<Job.Job>();
}
}

View File

@@ -1,99 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
[Table("Units", Schema = DatabaseSchemas.Unit)]
[Comment("Таблица с ЭК")]
[Index(nameof(Name), IsUnique = true)]
public class Unit : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// ЭК
/// </summary>
public required string Name { get; set; }
public DateTimeOffset? LastLogon { get; set; }
[NotMapped]
public BaseFields? BaseFields
{
get
{
if (UnitValues.Any())
{
var result = new BaseFields();
result.IP = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "IP_АДРЕС")?.Value?.Value;
result.ResponseArea = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "ЗО_РГ")?.Value?.Value;
result.WorkGroup = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "РАБОЧАЯ_ГР_ОТВ_ЗАК")?.Value?.Value;
result.Status = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "СТАТУС")?.Value?.Value;
result.NotUnique = UnitValues.FirstOrDefault(t => t.Field?.AihitName == "НЕУНИКАЛЬНЫЙ_ЭК")?.Value?.Value;
return result;
}
return null;
}
}
public ICollection<UnitInField> UnitFields { get; set; } = new HashSet<UnitInField>();
public ICollection<UnitInValue> UnitValues { get; set; } = new HashSet<UnitInValue>();
/// <summary>
/// Получить всех родителей
/// </summary>
[InverseProperty(nameof(UnitInUnit.ChildUnit))]
public ICollection<UnitInUnit> ParentUnits { get; set; } = new HashSet<UnitInUnit>();
/// <summary>
/// Получить детей
/// </summary>
[InverseProperty(nameof(UnitInUnit.ParentUnit))]
public ICollection<UnitInUnit> ChildUnits { get; set; } = new HashSet<UnitInUnit>();
/// <summary>
/// Связь с шаблонами. Один ко многим
/// </summary>
public ICollection<Template> Templates { get; set; } = new HashSet<Template>();
/// <summary>
/// К одному шаблону привязано несколько ЭК(Груповой тип работы). Многие ко многим
/// </summary>
public ICollection<UnitsInTemplate> TemplatesInUnit { get; set; } = new HashSet<UnitsInTemplate>();
public UnitKiiUnit? UnitKii { get; set; }
}
public class BaseFields
{
public string? IP { get; set; }
public string? ResponseArea { get; set; }
public string? WorkGroup { get; set; }
public string? Status { get; set; }
public string? NotUnique { get; set; }
}
}

View File

@@ -1,71 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.DAL.Models.Job;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
/// <summary>
/// Справочник полей ЭК (компонентный состав, ответствтвенные, любые поля)
/// </summary>
[Table("Fields", Schema = DatabaseSchemas.Unit)]
[Comment("Справочник полей ЭК")]
[Index(nameof(AihitName))]
[Index(nameof(EsppName))]
public class UnitField : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
/// <summary>
/// Имя поля в АИХ ИТ, заполняется при синхронизации
/// </summary>
public required string AihitName { get; set; }
/// <summary>
/// Название поля в ЕСПП, возможно в дальнейшем для синхронизации
/// </summary>
public string? EsppName { get; set; }
/// <summary>
/// Название поля для отображения в ГУИ
/// </summary>
public string? DisplayName { get; set; }
/// <summary>
/// Код поля, используется в GUI
/// </summary>
public string? Code { get; set; }
/// <summary>
/// Могут ли принимать несколько значений. Из АИХ ИТ приходят значения разделённые запятой
/// </summary>
public bool? IsMultipleValue { get; set; }
public ICollection<UnitInField> Units { get; set; } = new HashSet<UnitInField>();
public ICollection<UnitInValue> UnitInValues { get; set; } = new HashSet<UnitInValue>();
public ICollection<UnitFieldInUnitFieldValue> UnitFieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
public ICollection<JobRelationshipFilter> RelationshipFilters { get; set; } = new HashSet<JobRelationshipFilter>();
/// <summary>
/// JobGroup которые группируются по этому полю (!!!отключено каскадное удаление!!!)
/// </summary>
public ICollection<JobGroup> JobGroupWithGrouping { get; set; } = new HashSet<JobGroup>();
}
}

View File

@@ -1,29 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
[Table("FieldInFieldValues", Schema = DatabaseSchemas.Unit)]
[Comment("Значения полей ЭК")]
[PrimaryKey(nameof(FieldId), nameof(FieldValueId))]
public class UnitFieldInUnitFieldValue : IBaseEntityDateCreated
{
public Guid FieldId { get; set; }
public Guid FieldValueId { get; set; }
public DateTimeOffset DateCreated { get; set; }
[ForeignKey(nameof(FieldId))]
public UnitField? Field { get; set; }
[ForeignKey(nameof(FieldValueId))]
public UnitFieldValue? FieldValue { get; set; }
}
}

View File

@@ -1,32 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
[Table("FieldValues", Schema = DatabaseSchemas.Unit)]
[Comment("Значения полей ЭК")]
[Index(nameof(Value), IsUnique = true)]
public class UnitFieldValue : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public string? Value { get; set; }
public ICollection<UnitInValue> UnitInValues { get; set; } = new HashSet<UnitInValue>();
public ICollection<UnitFieldInUnitFieldValue> FieldValues { get; set; } = new HashSet<UnitFieldInUnitFieldValue>();
public UnitRegionalEkPtkGroup? RegionalEkPtkGroup { get; set; }
}
}

View File

@@ -1,30 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
/// <summary>
/// Связь Unit in Field
/// </summary>
///
[Table("UnitInFields", Schema = DatabaseSchemas.Unit)]
[Comment("Справочник полей ЭК")]
[PrimaryKey(nameof(UnitId), nameof(FieldId))]
public class UnitInField
{
public Guid UnitId { get; set; }
public Guid FieldId { get; set; }
public DateTimeOffset DateCreated { get; set; }
[ForeignKey(nameof(UnitId))]
public Unit? Unit { get; set; }
[ForeignKey(nameof(FieldId))]
public UnitField? UnitField { get; set; }
}
}

View File

@@ -1,31 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
/// <summary>
/// Связи иерархии между ЭК
/// </summary>
[Table("UnitInUnits", Schema = DatabaseSchemas.Unit)]
[Comment("Таблица связей иерархии между ЭК")]
[PrimaryKey(nameof(ParentUnitId), nameof(ChildUnitId))]
public class UnitInUnit
{
public Guid ParentUnitId { get; set; }
public Guid ChildUnitId { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateSynced { get; set; }
[ForeignKey(nameof(ParentUnitId))]
public Unit? ParentUnit { get; set; }
[ForeignKey(nameof(ChildUnitId))]
public Unit? ChildUnit { get; set; }
}
}

View File

@@ -1,38 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
[Table("UnitInValues", Schema = DatabaseSchemas.Unit)]
[Comment("Таблица связи ЭК с полями и со значениями")]
[PrimaryKey(nameof(UnitId), nameof(FieldId), nameof(ValueId))]
[Index(nameof(FieldId), nameof(ValueId))]
[Index(nameof(UnitId), nameof(FieldId))]
[Index(nameof(FieldId), nameof(UnitId))]
public class UnitInValue : IBaseEntityDateModified, IBaseEntityDateCreated
{
public Guid UnitId { get; set; }
public Guid FieldId { get; set; }
public Guid ValueId { get; set; }
public DateTimeOffset DateCreated { get; set; }
public DateTimeOffset? DateModified { get; set; }
[ForeignKey(nameof(UnitId))]
public Unit? Unit { get; set; }
[ForeignKey(nameof(FieldId))]
public UnitField? Field { get; set; }
[ForeignKey(nameof(ValueId))]
public UnitFieldValue? Value { get; set; }
}
}

View File

@@ -1,24 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
/// <summary>
/// Список ЭК КИИ, которые учавствуют в групповых работах. Создавалась как временная
/// </summary>
[Table("KiiUnits", Schema = DatabaseSchemas.Unit)]
[Comment("Таблица - Список ЭК КИИ, которые учавствуют в групповых работах. Создавалась как временная")]
public class UnitKiiUnit
{
//TODO: создавалась как временная таблица
[Key]
public Guid UnitId { get; set; }
[ForeignKey(nameof(UnitId))]
public Unit? Unit { get; set; }
}
}

View File

@@ -1,19 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models.Unit
{
[Table("RegionalEkPtkGroups", Schema = DatabaseSchemas.Unit)]
[Comment("Таблица - региональные группы ПТК")]
public class UnitRegionalEkPtkGroup
{
[Key]
public Guid FieldValueId { get; set; }
[ForeignKey(nameof(FieldValueId))]
public UnitFieldValue? FieldValue { get; set; }
}
}

View File

@@ -1,22 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("UnitsInTemplates", Schema = DatabaseSchemas.Job)]
[Comment("Таблица связи ЭК в шаблонах")]
public class UnitsInTemplate
{
public Guid TemplateId { get; set; }
public Guid UnitId { get; set; }
public DateTimeOffset DateCreated { get; set; }
[ForeignKey(nameof(TemplateId))]
public Template? Template { get; set; }
[ForeignKey(nameof(UnitId))]
public Unit.Unit? Unit { get; set; }
}
}

View File

@@ -1,31 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("Users")]
[Index(nameof(Ip), IsUnique = true)]
public class User : IBaseEntity
{
[Key]
public Guid Id { get; set; }
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public required string Ip { get; set; }
public required string Name { get; set; }
public string? Description { get; set; }
public DateTimeOffset? LastLogon { get; set; }
public ICollection<UsersInRole> Roles { get; set; } = new HashSet<UsersInRole>();
}
}

View File

@@ -1,20 +0,0 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("UsersInRoles")]
[PrimaryKey(nameof(RoleId), nameof(UserId))]
public class UsersInRole
{
public Guid RoleId { get; set; }
public Guid UserId { get; set; }
[ForeignKey(nameof(RoleId))]
public Role? Role { get; set; }
[ForeignKey(nameof(UserId))]
public User? User { get; set; }
}
}

View File

@@ -1,25 +0,0 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Context;
using PARR.Domain.Constants;
using PARR.Domain.Entities.Base;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace PARR.DAL.Models
{
[Table("WeekendDays", Schema = DatabaseSchemas.Schedule)]
[Index(nameof(Date), IsUnique = true)]
public class WeekendDay : IBaseEntity
{
[Key]
public Guid Id { get; set; }
[NotMapped]
public DateTimeOffset DateCreated { get; set; }
[NotMapped]
public DateTimeOffset? DateModified { get; set; }
public DateOnly Date { get; set; }
}
}

View File

@@ -1,5 +1,5 @@
using PARR.DAL.Models.Job;
using PARR.DAL.NextRunServices.Models;
using PARR.DAL.NextRunServices.Models;
using PARR.Domain.Entities.Job;
using PARR.Domain.Enums;
namespace PARR.DAL.NextRunServices

View File

@@ -1,14 +1,14 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.Contracts;
using PARR.DAL.DomainServices.Shortcodes;
using PARR.DAL.Models;
using PARR.DAL.Models.Job;
using PARR.DAL.NextRunServices.Models;
using PARR.DAL.NextRunServices.Subservices;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Schedule;
using PARR.Domain.Entities;
using PARR.Domain.Entities.Job;
using PARR.Domain.Enums;
namespace PARR.DAL.NextRunServices
@@ -16,22 +16,22 @@ namespace PARR.DAL.NextRunServices
internal class NextRunService : INextRunService
{
private readonly ILogger<NextRunService> logger;
private readonly ITemplateService templateService;
private readonly IJobGroupService jobGroupService;
private readonly ITemplateRepository templateService;
private readonly IJobGroupRepository jobGroupService;
private readonly IEsppScheduleTransformService esppScheduleTransformService;
private readonly ITemplateDistributor templateDistributor;
private readonly IShortcodesService shortcodesService;
private readonly IScheduleResponseAreaTimeOffsetService scheduleResponseAreaTimeOffsetService;
private readonly IScheduleResponseAreaTimeOffsetRepository scheduleResponseAreaTimeOffsetService;
private readonly SettingsFromDb settingsFromDb;
public NextRunService(
ILogger<NextRunService> logger,
ITemplateService templateService,
IJobGroupService jobGroupService,
ITemplateRepository templateService,
IJobGroupRepository jobGroupService,
IEsppScheduleTransformService esppScheduleTransformService,
ITemplateDistributor templateDistributor,
IShortcodesService shortcodesService,
IScheduleResponseAreaTimeOffsetService scheduleResponseAreaTimeOffsetService,
IScheduleResponseAreaTimeOffsetRepository scheduleResponseAreaTimeOffsetService,
SettingsFromDb settingsFromDb
)
{

View File

@@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.DomainModels;
using PARR.DAL.Services.Interfaces;
using PARR.Domain.Enums;
using System.Text.Json;
@@ -8,7 +8,7 @@ namespace PARR.DAL.NextRunServices.Subservices
{
internal class EsppScheduleTransformService : IEsppScheduleTransformService
{
private readonly IEsppSchTypeConfigService esppSchTypeConfigService;
private readonly IEsppSchTypeConfigRepository esppSchTypeConfigService;
private readonly ILogger<EsppScheduleTransformService> logger;
private static readonly Dictionary<string, int> monthDict = new Dictionary<string, int>()
@@ -50,7 +50,7 @@ namespace PARR.DAL.NextRunServices.Subservices
public EsppScheduleTransformService(
ILogger<EsppScheduleTransformService> logger,
IEsppSchTypeConfigService esppSchTypeConfigService
IEsppSchTypeConfigRepository esppSchTypeConfigService
)
{
this.esppSchTypeConfigService = esppSchTypeConfigService;

View File

@@ -1,7 +1,7 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.NextRunServices.Models;
using PARR.DAL.Services.Interfaces;
namespace PARR.DAL.NextRunServices.Subservices
{
@@ -13,7 +13,7 @@ namespace PARR.DAL.NextRunServices.Subservices
internal class TemplateDistributor : ITemplateDistributor
{
private readonly ILogger<TemplateDistributor> logger;
private readonly IWeekendDayService weekendDayService;
private readonly IWeekendDayRepository weekendDayService;
/// <summary>
/// Смещение nextRun на несколько лет вперед, если не смог его рассчитать
@@ -25,7 +25,7 @@ namespace PARR.DAL.NextRunServices.Subservices
/// </summary>
private const int maxPeriodExpansions = 2;
public TemplateDistributor(ILogger<TemplateDistributor> logger, IWeekendDayService weekendDayService)
public TemplateDistributor(ILogger<TemplateDistributor> logger, IWeekendDayRepository weekendDayService)
{
this.logger = logger;
this.weekendDayService = weekendDayService;

View File

@@ -1,222 +0,0 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.TaskRepositories;
using PARR.DAL.Configurations.DbSettings;
using PARR.DAL.Context;
using PARR.DAL.Contracts;
using PARR.DAL.DomainServices.Implementations;
using PARR.DAL.DomainServices.Interfaces;
using PARR.DAL.DomainServices.Shortcodes;
using PARR.DAL.DomainServices.UnitFilterService;
using PARR.DAL.DomainServices.UnitFilterService.Models;
using PARR.DAL.NextRunServices;
using PARR.DAL.NextRunServices.Subservices;
using PARR.DAL.Repositories.TaskRepositories;
using PARR.DAL.Services.Implementations;
using PARR.DAL.Services.Implementations.Job;
using PARR.DAL.Services.Implementations.Schedule;
using PARR.DAL.Services.Implementations.Unit;
using PARR.DAL.Services.Interfaces;
using PARR.DAL.Services.Interfaces.Job;
using PARR.DAL.Services.Interfaces.Schedule;
using PARR.DAL.Services.Interfaces.Unit;
using PARR.Domain.Settings;
namespace PARR.DAL
{
public static class ParrDalInstaller
{
// TODO: Переименовать InstallDalServices -> DependencyInjection
// TODO: Переименовать InstallDalServices -> AddDalServices
// TODO: Избавиться от лишнего
/// <summary>
/// Устанавливает Dal сервисы (1)
/// </summary>
/// <param name="services"></param>
/// <param name="configuration"></param>
public static void InstallDalServices(this IServiceCollection services, IConfiguration configuration)
{
//.EnableSensitiveDataLogging() - вкл подробное логирование при применении миграций, на проде выключить
services.AddDbContext<DataContext>(opt =>
opt
.EnableSensitiveDataLogging()
.UseNpgsql(configuration.GetConnectionString("DefaultConnection"))
);
#region Redis + cache services
//services.AddSingleton<IConnectionMultiplexer>(sp =>
//{
// // IConnectionMultiplexer - для нативных операций Redis
// var connectionString = configuration.GetConnectionString("RedisConnection");
// return ConnectionMultiplexer.Connect(connectionString);
//});
//services.AddStackExchangeRedisCache(opt =>
//{
// opt.Configuration = configuration.GetConnectionString("RedisConnection");
//});
//var groupedShortcodesCacheSettings = new GroupedShortcodesCacheSettings();
//configuration.GetSection(nameof(GroupedShortcodesCacheSettings)).Bind(groupedShortcodesCacheSettings);
//services.AddSingleton(groupedShortcodesCacheSettings);
//services.AddSingleton<IRedisCacheService, RedisCacheService>();
#endregion
//#region InfluxDb
//var influxDbSettings = new InfluxDbSettings();
//configuration.GetSection(nameof(InfluxDbSettings)).Bind(influxDbSettings);
//services.AddSingleton(influxDbSettings);
//services.AddTransient<IInfluxDbService, InfluxDbService>();
//#endregion
// Entity services
//services.AddTransient<IHostService, HostService>();
//services.AddTransient<IWorkGroupService, WorkGroupService>();
//services.AddTransient<IApplicationService, ApplicationService>();
//services.AddTransient<IApplicationTypeService, ApplicationTypeService>();
//services.AddTransient<IApplicationInHostService, ApplicationInHostService>();
//services.AddTransient<IApplicationsInWorkService, ApplicationsInWorkService>();
//services.AddTransient<IApplicationService, ApplicationService>();
services.AddTransient<IProcessService, ProcessService>();
services.AddTransient<ISubprocessService, SubprocessService>();
services.AddTransient<ITnkService, TnkService>();
services.AddTransient<ITemplateService, TemplateService>();
services.AddTransient<IStatusTemplateService, StatusTemplateService>();
services.AddTransient<IRobotHistoryLevelService, RobotHistoryLevelService>();
services.AddTransient<IRobotStatusService, RobotStatusService>();
services.AddTransient<IRobotService, RobotService>();
services.AddTransient<IRobotConfigurationService, RobotConfigurationService>();
services.AddTransient<IRobotHistoryService, RobotHistoryService>();
services.AddTransient<IEsppSchTypeConfigService, EsppSchTypeConfigService>();
services.AddTransient<IAgentHistoryService, AgentHistoryService>();
services.AddTransient<IOrderService, OrderService>();
services.AddTransient<IOrderStatusService, OrderStatusService>();
services.AddTransient<IUserService, UserService>();
services.AddTransient<IRoleService, RoleService>();
services.AddTransient<ITaskStatusService, TaskStatusService>();
//services.AddTransient<IEkStatusService, EkStatusService>();
services.AddTransient<IEsppSchTypeScheduleService, EsppSchTypeScheduleService>();
services.AddTransient<IWeekendDayService, WeekendDayService>();
services.AddTransient<IDistributionPeriodService, DistributionPeriodService>();
services.AddTransient<IEsppSchTypeValueService, EsppSchTypeValueService>();
//services.AddTransient<IResponseAreaService, ResponseAreaService>();
services.AddTransient<ITemplateHistoryService, TemplateHistoryService>();
services.AddTransient<IParrComponentService, ParrComponentService>();
services.AddTransient<ITemplateStatusTypeService, TemplateStatusTypeService>();
#region Schedule
services.AddTransient<IScheduleExcludeTypeService, ScheduleExcludeTypeService>();
services.AddTransient<IScheduleExcludeTypeCalendarService, ScheduleExcludeTypeCalendarService>();
#endregion
#region Unit
services.AddTransient<IUnitService, UnitService>();
services.AddTransient<IUnitFieldValueService, UnitFieldValueService>();
services.AddTransient<IUnitFieldService, UnitFieldService>();
services.AddTransient<IUnitInUnitService, UnitInUnitService>();
services.AddTransient<IUnitInValueService, UnitInValueService>();
services.AddTransient<IUnitRegionalEkPtkGroupService, UnitRegionalEkPtkGroupService>();
services.AddTransient<IUnitKiiUnitService, UnitKiiUnitService>();
#endregion
#region Job
services.AddTransient<IJobService, JobService>();
services.AddTransient<IJobGroupService, JobGroupService>();
services.AddTransient<IJobGroupTypeService, JobGroupTypeService>();
services.AddTransient<IJobUnitFilterService, JobUnitFilterService>();
services.AddTransient<IFieldFilterService, FieldFilterService>();
services.AddTransient<IJobUnitFilterService, JobUnitFilterService>();
services.AddTransient<IJobAutoControlService, JobAutoControlService>();
#endregion
#region Task
services.AddScoped<ITaskErrorRepository, TaskErrorRepository>();
services.AddScoped<ITaskRepository, TaskRepository>();
services.AddScoped<ITaskTypeRepository, TaskTypeRepository>();
#endregion
//services.AddTransient<INextRunModifierService, NextRunModifierService>();
#region NextRun Services
services.AddTransient<IEsppScheduleTransformService, EsppScheduleTransformService>();
services.AddTransient<ITemplateDistributor, TemplateDistributor>();
services.AddTransient<INextRunService, NextRunService>();
#endregion
#region DomainServces
services.AddTransient<IShortcodesService, ShortcodesService>();
services.AddTransient<IUnitFilterService, UnitFilterService>();
services.AddTransient<IMatchingStatusService, MatchingStatusService>();
services.Configure<UnitFilterServiceOptions>(options =>
{
options.LoadBatchSize = 50;
});
#endregion
}
/// <summary>
/// Добавляет конфигурацию Dal (2)
/// </summary>
/// <param name="builder"></param>
/// <param name="services"></param>
/// <returns></returns>
public static IConfigurationBuilder AddDalConfigurations(this IConfigurationBuilder builder, IServiceCollection services)
{
builder.Add(new DBConfigurationSource(services));
return builder;
}
/// <summary>
/// Добавляет конфигурацию в сервисы (3)
/// </summary>
/// <param name="services"></param>
/// <param name="configuration"></param>
public static void AddDallSettings(this IServiceCollection services, IConfiguration configuration)
{
//SettingsFromDb configuration
var settingsFromDb = new SettingsFromDb();
configuration.GetSection(nameof(SettingsFromDb)).Bind(settingsFromDb);
services.AddSingleton(settingsFromDb);
PrefixSettings.PrefixWithoutVariable = settingsFromDb.TemplatePrefixWithoutVariable;
// Сервис - Расписание в ЕСПП. Смещение часового пояса относительно МСК для зоны ответственности рабочей группы
services.AddSingleton<IScheduleResponseAreaTimeOffsetService>(provider =>
{
using var scope = provider.CreateScope();
var dbContext = scope.ServiceProvider.GetRequiredService<DataContext>();
var settingsFromDb = scope.ServiceProvider.GetRequiredService<SettingsFromDb>();
var logger = scope.ServiceProvider.GetRequiredService<ILogger<ScheduleResponseAreaTimeOffsetService>>();
return new ScheduleResponseAreaTimeOffsetService(dbContext, settingsFromDb, logger);
});
}
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class AgentHistoryRepository : BaseRepository<AgentHistory>, IAgentHistoryRepository
{
public AgentHistoryRepository(DataContext dataContext, ILogger<AgentHistoryRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class DistributionPeriodRepository : BaseRepository<DistributionPeriod>, IDistributionPeriodRepository
{
public DistributionPeriodRepository(DataContext dataContext, ILogger<DistributionPeriodRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -1,16 +1,16 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.Context;
using PARR.DAL.DomainModels;
using PARR.DAL.Models;
using PARR.DAL.Repositories.Base;
using PARR.DAL.Services.Interfaces;
using PARR.Domain.Entities.Schedule;
namespace PARR.DAL.Services.Implementations
namespace PARR.DAL.Repositories
{
internal class EsppSchTypeConfigService : BaseRepository<EsppSchTypeConfig>, IEsppSchTypeConfigService
internal class EsppSchTypeConfigRepository : BaseRepository<EsppSchTypeConfig>, IEsppSchTypeConfigRepository
{
public EsppSchTypeConfigService(DataContext dataContext, ILogger<EsppSchTypeConfigService> logger) : base(logger, dataContext) { }
public EsppSchTypeConfigRepository(DataContext dataContext, ILogger<EsppSchTypeConfigRepository> logger) : base(logger, dataContext) { }
public IQueryable<EsppSchTypeConfig> GetWithSchIncludes()
{

View File

@@ -1,15 +1,15 @@
using Microsoft.EntityFrameworkCore;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Services.Interfaces;
using PARR.Domain.Entities.Schedule;
namespace PARR.DAL.Services.Implementations
namespace PARR.DAL.Repositories
{
internal class EsppSchTypeScheduleService : IEsppSchTypeScheduleService
internal class EsppSchTypeScheduleRepository : IEsppSchTypeScheduleRepository
{
private readonly DataContext dataContext;
public EsppSchTypeScheduleService(DataContext dataContext)
public EsppSchTypeScheduleRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Schedule;
namespace PARR.DAL.Repositories
{
internal class EsppSchTypeValueRepository : BaseRepository<EsppSchTypeValue>, IEsppSchTypeValueRepository
{
public EsppSchTypeValueRepository(DataContext dataContext, ILogger<EsppSchTypeValueRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Job;
namespace PARR.DAL.Repositories.Job
{
internal class FieldFilterRepository : BaseRepository<JobFieldFilter>, IFieldFilterRepository
{
public FieldFilterRepository(DataContext dataContext, ILogger<FieldFilterRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,21 @@
using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context;
using PARR.Domain.Entities.Job;
namespace PARR.DAL.Repositories.Job
{
internal class JobAutoControlRepository : IJobAutoControlRepository
{
private readonly DataContext dataContext;
public JobAutoControlRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}
public IQueryable<JobAutoControl> Get()
{
return dataContext.JobAutoControls;
}
}
}

View File

@@ -0,0 +1,19 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Job;
namespace PARR.DAL.Repositories.Job
{
internal class JobGroupRepository : BaseRepository<JobGroup>, IJobGroupRepository
{
public JobGroupRepository(DataContext dataContext, ILogger<JobGroupRepository> logger) : base(logger, dataContext) { }
public void DeleteDistributionConfig(JobGroupDistributionConfig distributionConfig)
{
EntityContext.JobGroupDistributionConfigs.Remove(distributionConfig);
}
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Job;
namespace PARR.DAL.Repositories.Job
{
internal class JobGroupTypeRepository : BaseRepository<JobGroupType>, IJobGroupTypeRepository
{
public JobGroupTypeRepository(DataContext dataContext, ILogger<JobGroupTypeRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,39 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Job;
namespace PARR.DAL.Repositories.Job
{
internal class JobRepository : BaseRepository<Domain.Entities.Job.Job>, IJobRepository
{
public JobRepository(DataContext dataContext, ILogger<JobRepository> logger) : base(logger, dataContext) { }
public override Task<bool> CreateAsync(Domain.Entities.Job.Job obj)
{
if (obj.AutoControl == null)
obj.AutoControl = new JobAutoControl
{
JobId = obj.Id
};
return base.CreateAsync(obj);
}
public override Task<bool> AddRangeAsync(List<Domain.Entities.Job.Job> objs)
{
objs.ForEach(job =>
{
if (job.AutoControl == null)
job.AutoControl = new JobAutoControl
{
JobId = job.Id
};
});
return base.AddRangeAsync(objs);
}
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Job;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Job;
namespace PARR.DAL.Repositories.Job
{
internal class JobUnitFilterRepository : BaseRepository<JobUnitFilter>, IJobUnitFilterRepository
{
public JobUnitFilterRepository(DataContext dataContext, ILogger<JobUnitFilterRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class OrderRepository : BaseRepository<Order>, IOrderRepository
{
public OrderRepository(DataContext dataContext, ILogger<OrderRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -1,17 +1,17 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Services.Interfaces;
using PARR.Domain.Entities;
using PARR.Domain.Enums;
namespace PARR.DAL.Services.Implementations
namespace PARR.DAL.Repositories
{
internal class OrderStatusService : IOrderStatusService
internal class OrderStatusRepository : IOrderStatusRepository
{
private readonly DataContext dataContext;
private readonly ILogger<OrderStatusService> logger;
private readonly ILogger<OrderStatusRepository> logger;
public OrderStatusService(DataContext dataContext, ILogger<OrderStatusService> logger)
public OrderStatusRepository(DataContext dataContext, ILogger<OrderStatusRepository> logger)
{
this.dataContext = dataContext;
this.logger = logger;

View File

@@ -0,0 +1,21 @@
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class ParrComponentRepository : IParrComponentRepository
{
private readonly DataContext dataContext;
public ParrComponentRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}
public IQueryable<ParrComponent> Get()
{
return dataContext.ParrComponents;
}
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class ProcessRepository : BaseRepository<Process>, IProcessRepository
{
public ProcessRepository(ILogger<ProcessRepository> logger, DataContext dataContext) : base(logger, dataContext) { }
}
}

View File

@@ -1,16 +1,16 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Models;
using PARR.DAL.Repositories.Base;
using PARR.DAL.Services.Interfaces;
using PARR.Domain.Entities;
using PARR.Domain.Enums;
namespace PARR.DAL.Services.Implementations
namespace PARR.DAL.Repositories
{
internal class RobotConfigurationService : BaseRepository<RobotConfiguration>, IRobotConfigurationService
internal class RobotConfigurationRepository : BaseRepository<RobotConfiguration>, IRobotConfigurationRepository
{
public RobotConfigurationService(DataContext dataContext, ILogger<RobotConfigurationService> logger) : base(logger, dataContext) { }
public RobotConfigurationRepository(DataContext dataContext, ILogger<RobotConfigurationRepository> logger) : base(logger, dataContext) { }
public void ChangeTaskStatus(TaskStatusEnum taskStatus, RobotConfiguration configuration)

View File

@@ -0,0 +1,21 @@
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class RobotHistoryLevelRepository : IRobotHistoryLevelRepository
{
private readonly DataContext dataContext;
public RobotHistoryLevelRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}
public IQueryable<RobotHistoryLevel> Get()
{
return dataContext.RobotHistoryLevels;
}
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class RobotHistoryRepository : BaseRepository<RobotHistory>, IRobotHistoryRepository
{
public RobotHistoryRepository(DataContext dataContext, ILogger<RobotHistoryRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,21 @@
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class RobotRepository : IRobotRepository
{
private readonly DataContext dataContext;
public RobotRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}
public IQueryable<Robot> Get()
{
return dataContext.Robots;
}
}
}

View File

@@ -0,0 +1,21 @@
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class RobotStatusRepository : IRobotStatusRepository
{
private readonly DataContext dataContext;
public RobotStatusRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}
public IQueryable<RobotStatus> Get()
{
return dataContext.RobotStatuses;
}
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class RoleRepository : BaseRepository<Role>, IRoleRepository
{
public RoleRepository(DataContext dataContext, ILogger<RoleRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Schedule;
namespace PARR.DAL.Repositories.Schedule
{
internal class ScheduleExcludeTypeCalendarRepository : BaseRepository<ScheduleExcludeTypeCalendar>, IScheduleExcludeTypeCalendarRepository
{
public ScheduleExcludeTypeCalendarRepository(DataContext dataContext, ILogger<ScheduleExcludeTypeCalendarRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,13 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities.Schedule;
namespace PARR.DAL.Repositories.Schedule
{
internal class ScheduleExcludeTypeRepository : BaseRepository<ScheduleExcludeType>, IScheduleExcludeTypeRepository
{
public ScheduleExcludeTypeRepository(DataContext dataContext, ILogger<ScheduleExcludeTypeRepository> logger) : base(logger, dataContext) { }
}
}

View File

@@ -1,13 +1,13 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces.Schedule;
using PARR.DAL.Context;
using PARR.DAL.Contracts;
using PARR.DAL.Models.Schedule;
using PARR.DAL.Services.Interfaces.Schedule;
using PARR.Domain.Entities.Schedule;
namespace PARR.DAL.Services.Implementations.Schedule
namespace PARR.DAL.Repositories.Schedule
{
internal sealed class ScheduleResponseAreaTimeOffsetService : IScheduleResponseAreaTimeOffsetService
internal sealed class ScheduleResponseAreaTimeOffsetRepository : IScheduleResponseAreaTimeOffsetRepository
{
private readonly IReadOnlyDictionary<string, ScheduleResponseAreaTimeOffset> offsetList;
@@ -20,9 +20,9 @@ namespace PARR.DAL.Services.Implementations.Schedule
/// Настройки, если не нашли в offsetList
/// </summary>
private readonly ScheduleResponseAreaTimeOffset defaultOffset;
private readonly ILogger<ScheduleResponseAreaTimeOffsetService> logger;
private readonly ILogger<ScheduleResponseAreaTimeOffsetRepository> logger;
public ScheduleResponseAreaTimeOffsetService(DataContext dataContext, SettingsFromDb settingsFromDb, ILogger<ScheduleResponseAreaTimeOffsetService> logger)
public ScheduleResponseAreaTimeOffsetRepository(DataContext dataContext, SettingsFromDb settingsFromDb, ILogger<ScheduleResponseAreaTimeOffsetRepository> logger)
{
offsetList = dataContext.ScheduleResponseAreaTimeOffsets
.AsNoTracking()

View File

@@ -0,0 +1,20 @@
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
namespace PARR.DAL.Repositories
{
internal class StatusTemplateRepository : IStatusTemplateRepository
{
private readonly DataContext dataContext;
public StatusTemplateRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}
public IQueryable<Domain.Entities.TaskStatus> Get()
{
return dataContext.TaskStatuses;
}
}
}

View File

@@ -0,0 +1,14 @@
using Microsoft.Extensions.Logging;
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
using PARR.DAL.Repositories.Base;
using PARR.Domain.Entities;
namespace PARR.DAL.Repositories
{
internal class SubprocessRepository : BaseRepository<Subprocess>, ISubprocessRepository
{
public SubprocessRepository(ILogger<SubprocessRepository> logger, DataContext dataContext) : base(logger, dataContext) { }
}
}

View File

@@ -0,0 +1,20 @@
using PARR.Core.Repositories.Interfaces;
using PARR.DAL.Context;
namespace PARR.DAL.Repositories
{
internal class TaskStatusRepository : ITaskStatusRepository
{
private readonly DataContext dataContext;
public TaskStatusRepository(DataContext dataContext)
{
this.dataContext = dataContext;
}
public IQueryable<Domain.Entities.TaskStatus> Get()
{
return dataContext.TaskStatuses;
}
}
}

Some files were not shown because too many files have changed in this diff Show More