feat: разделение на repository - services
This commit is contained in:
@@ -12,10 +12,10 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ using PARR.API.Contracts.V1.Responses.Base;
|
|||||||
using PARR.API.Controllers.V1.Base;
|
using PARR.API.Controllers.V1.Base;
|
||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ using PARR.BLL.Domain.Mq;
|
|||||||
using PARR.BLL.Helpers;
|
using PARR.BLL.Helpers;
|
||||||
using PARR.BLL.Services.Interfaces;
|
using PARR.BLL.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.DomainServices.Interfaces;
|
using PARR.DAL.DomainServices.Interfaces;
|
||||||
using PARR.DAL.DomainServices.UnitFilterService;
|
using PARR.DAL.DomainServices.UnitFilterService;
|
||||||
using PARR.DAL.Extensions;
|
using PARR.DAL.Extensions;
|
||||||
@@ -24,6 +23,7 @@ using PARR.DAL.Models.Job;
|
|||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,13 @@ using PARR.BLL.Domain.Mq;
|
|||||||
using PARR.BLL.Helpers;
|
using PARR.BLL.Helpers;
|
||||||
using PARR.BLL.Services.Interfaces;
|
using PARR.BLL.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.DomainServices.Interfaces;
|
using PARR.DAL.DomainServices.Interfaces;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Models.Job;
|
using PARR.DAL.Models.Job;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
using PARR.DAL.Services.Interfaces.Schedule;
|
using PARR.DAL.Services.Interfaces.Schedule;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ using PARR.API.Contracts.V1.Responses.Base;
|
|||||||
using PARR.API.Controllers.V1.Base;
|
using PARR.API.Controllers.V1.Base;
|
||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ using PARR.API.Services.Interfaces;
|
|||||||
using PARR.BLL.Helpers;
|
using PARR.BLL.Helpers;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.Contracts;
|
using PARR.DAL.Contracts;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.DomainServices.Shortcodes;
|
using PARR.DAL.DomainServices.Shortcodes;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.DAL.Services.Interfaces.Schedule;
|
using PARR.DAL.Services.Interfaces.Schedule;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
|
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ using PARR.API.Contracts.V1.Responses.Base;
|
|||||||
using PARR.API.Controllers.V1.Base;
|
using PARR.API.Controllers.V1.Base;
|
||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.BLL.Helpers;
|
using PARR.BLL.Helpers;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models.Unit;
|
using PARR.DAL.Models.Unit;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.BLL.Helpers;
|
using PARR.BLL.Helpers;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models.Unit;
|
using PARR.DAL.Models.Unit;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.API.Services.Interfaces;
|
using PARR.API.Services.Interfaces;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,9 +10,9 @@ using PARR.API.Controllers.V1.Base;
|
|||||||
using PARR.API.Extensions;
|
using PARR.API.Extensions;
|
||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.Contracts;
|
using PARR.DAL.Contracts;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
|
|
||||||
namespace PARR.API.Controllers.V1
|
namespace PARR.API.Controllers.V1
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using PARR.API.Contracts.V1.Responses.Base;
|
using PARR.API.Contracts.V1.Responses.Base;
|
||||||
using PARR.DAL.DomainModels;
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.Extensions
|
namespace PARR.API.Extensions
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
using AutoMapper;
|
using AutoMapper;
|
||||||
using PARR.API.Contracts.V1.Requests;
|
using PARR.API.Contracts.V1.Requests;
|
||||||
using PARR.API.Contracts.V1.Requests.Queries;
|
using PARR.API.Contracts.V1.Requests.Queries;
|
||||||
using PARR.DAL.DomainModels;
|
|
||||||
using PARR.DAL.Models.Job;
|
using PARR.DAL.Models.Job;
|
||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
|
||||||
namespace PARR.API.MappingProfiles
|
namespace PARR.API.MappingProfiles
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
<Folder Include="Infrastructure\" />
|
<Folder Include="Infrastructure\" />
|
||||||
<Folder Include="Common\" />
|
<Folder Include="Common\" />
|
||||||
<Folder Include="Services\" />
|
<Folder Include="Services\" />
|
||||||
<Folder Include="Repositories\" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
26
PARR.Core/Repositories/Base/IBaseRepository.cs
Normal file
26
PARR.Core/Repositories/Base/IBaseRepository.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using PARR.Domain.Common.Pagination;
|
||||||
|
using PARR.Domain.Entities.Base;
|
||||||
|
using PARR.Domain.Entities.Base.History;
|
||||||
|
|
||||||
|
namespace PARR.Core.Repositories.Base
|
||||||
|
{
|
||||||
|
public interface IBaseRepository<T> where T : class, IBaseEntity
|
||||||
|
{
|
||||||
|
Task<T?> GetAsync(Guid id);
|
||||||
|
|
||||||
|
IQueryable<T> Get();
|
||||||
|
|
||||||
|
IQueryable<T> GetPage(IQueryable<T> query, PaginationFilter paginationFilter);
|
||||||
|
|
||||||
|
Task<bool> CreateAsync(T obj);
|
||||||
|
|
||||||
|
Task<bool> AddRangeAsync(List<T> objs);
|
||||||
|
|
||||||
|
Task<bool> DeleteAsync(Guid id);
|
||||||
|
|
||||||
|
bool Delete(T obj);
|
||||||
|
|
||||||
|
//Task<bool> CommitAsync();
|
||||||
|
Task<bool> CommitAsync(IHistoryInitiator? initiator = null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using PARR.Core.Repositories.Base;
|
||||||
|
using PARR.Domain.Entities.TaskEntities;
|
||||||
|
|
||||||
|
namespace PARR.Core.Repositories.Interfaces.TaskRepositories
|
||||||
|
{
|
||||||
|
public interface ITaskErrorRepository : IBaseRepository<TaskError>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using PARR.Core.Repositories.Base;
|
||||||
|
using PARR.Domain.Entities.TaskEntities;
|
||||||
|
|
||||||
|
namespace PARR.Core.Repositories.Interfaces.TaskRepositories
|
||||||
|
{
|
||||||
|
public interface ITaskRepository : IBaseRepository<TaskItem>
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using PARR.Domain.Entities.TaskEntities;
|
||||||
|
|
||||||
|
namespace PARR.Core.Repositories.Interfaces.TaskRepositories
|
||||||
|
{
|
||||||
|
public interface ITaskTypeRepository
|
||||||
|
{
|
||||||
|
IQueryable<TaskType> Get();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
namespace PARR.DAL.DomainModels
|
|
||||||
{
|
|
||||||
public class PaginationFilter
|
|
||||||
{
|
|
||||||
public int PageNumber { get; set; }
|
|
||||||
public int PageSize { get; set; }
|
|
||||||
|
|
||||||
//public bool IsDisabledPagination { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -51,7 +51,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("TemplateId");
|
b.HasIndex("TemplateId");
|
||||||
|
|
||||||
b.ToTable("AgentHistories");
|
b.ToTable("AgentHistories", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b =>
|
modelBuilder.Entity("PARR.DAL.Models.AgentHistoryLevel", b =>
|
||||||
@@ -72,7 +72,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("AgentHistoryLevels");
|
b.ToTable("AgentHistoryLevels", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -101,7 +101,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("WorkGroupId");
|
b.HasIndex("WorkGroupId");
|
||||||
|
|
||||||
b.ToTable("AppInWorkInWorkGroups");
|
b.ToTable("AppInWorkInWorkGroups", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
modelBuilder.Entity("PARR.DAL.Models.Application", b =>
|
||||||
@@ -130,7 +130,7 @@ namespace PARR.DAL.Migrations
|
|||||||
b.HasIndex("Name", "ApplicationTypeId")
|
b.HasIndex("Name", "ApplicationTypeId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Applications");
|
b.ToTable("Applications", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
|
modelBuilder.Entity("PARR.DAL.Models.ApplicationInHost", b =>
|
||||||
@@ -157,7 +157,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("HostId");
|
b.HasIndex("HostId");
|
||||||
|
|
||||||
b.ToTable("ApplicationsInHost");
|
b.ToTable("ApplicationsInHost", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
modelBuilder.Entity("PARR.DAL.Models.ApplicationType", b =>
|
||||||
@@ -181,7 +181,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("ApplicationTypes");
|
b.ToTable("ApplicationTypes", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -294,7 +294,7 @@ namespace PARR.DAL.Migrations
|
|||||||
b.HasIndex("WorkId", "ApplicationId")
|
b.HasIndex("WorkId", "ApplicationId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("ApplicationsInWorks");
|
b.ToTable("ApplicationsInWorks", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b =>
|
modelBuilder.Entity("PARR.DAL.Models.DistributionPeriod", b =>
|
||||||
@@ -397,7 +397,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Code");
|
b.HasKey("Code");
|
||||||
|
|
||||||
b.ToTable("EkStatuses");
|
b.ToTable("EkStatuses", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -1516,7 +1516,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("WorkGroupId");
|
b.HasIndex("WorkGroupId");
|
||||||
|
|
||||||
b.ToTable("Hosts");
|
b.ToTable("Hosts", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
|
modelBuilder.Entity("PARR.DAL.Models.Job.Job", b =>
|
||||||
@@ -1912,7 +1912,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("TemplateId");
|
b.HasIndex("TemplateId");
|
||||||
|
|
||||||
b.ToTable("Orders");
|
b.ToTable("Orders", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b =>
|
modelBuilder.Entity("PARR.DAL.Models.OrderStatus", b =>
|
||||||
@@ -1933,7 +1933,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Code");
|
b.HasKey("Code");
|
||||||
|
|
||||||
b.ToTable("OrderStatuses");
|
b.ToTable("OrderStatuses", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -1986,7 +1986,7 @@ namespace PARR.DAL.Migrations
|
|||||||
b.HasIndex("Name")
|
b.HasIndex("Name")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("ParrComponents");
|
b.ToTable("ParrComponents", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -2099,7 +2099,7 @@ namespace PARR.DAL.Migrations
|
|||||||
b.HasIndex("EsppId")
|
b.HasIndex("EsppId")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Processes");
|
b.ToTable("Processes", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b =>
|
modelBuilder.Entity("PARR.DAL.Models.ResponseArea", b =>
|
||||||
@@ -2116,7 +2116,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Code");
|
b.HasKey("Code");
|
||||||
|
|
||||||
b.ToTable("ResponseAreas");
|
b.ToTable("ResponseAreas", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -2242,7 +2242,7 @@ namespace PARR.DAL.Migrations
|
|||||||
b.HasIndex("Name")
|
b.HasIndex("Name")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Robots");
|
b.ToTable("Robots", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -2301,7 +2301,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("TemplateId", "TaskStatusCode");
|
b.HasIndex("TemplateId", "TaskStatusCode");
|
||||||
|
|
||||||
b.ToTable("RobotConfigurations");
|
b.ToTable("RobotConfigurations", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b =>
|
modelBuilder.Entity("PARR.DAL.Models.RobotHistory", b =>
|
||||||
@@ -2339,7 +2339,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("TaskStatusCode");
|
b.HasIndex("TaskStatusCode");
|
||||||
|
|
||||||
b.ToTable("RobotHistories");
|
b.ToTable("RobotHistories", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b =>
|
modelBuilder.Entity("PARR.DAL.Models.RobotHistoryLevel", b =>
|
||||||
@@ -2360,7 +2360,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Level");
|
b.HasKey("Level");
|
||||||
|
|
||||||
b.ToTable("RobotHistoryLevels");
|
b.ToTable("RobotHistoryLevels", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -2407,7 +2407,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Code");
|
b.HasKey("Code");
|
||||||
|
|
||||||
b.ToTable("RobotStatuses");
|
b.ToTable("RobotStatuses", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -2455,7 +2455,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("Roles");
|
b.ToTable("Roles", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -2624,7 +2624,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Name");
|
b.HasKey("Name");
|
||||||
|
|
||||||
b.ToTable("Settings");
|
b.ToTable("Settings", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -2748,7 +2748,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ProcessId");
|
b.HasIndex("ProcessId");
|
||||||
|
|
||||||
b.ToTable("Subprocesses");
|
b.ToTable("Subprocesses", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.TaskModels.TaskError", b =>
|
modelBuilder.Entity("PARR.DAL.Models.TaskModels.TaskError", b =>
|
||||||
@@ -2941,7 +2941,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Code");
|
b.HasKey("Code");
|
||||||
|
|
||||||
b.ToTable("TaskStatuses");
|
b.ToTable("TaskStatuses", (string)null);
|
||||||
|
|
||||||
b.HasData(
|
b.HasData(
|
||||||
new
|
new
|
||||||
@@ -3027,7 +3027,7 @@ namespace PARR.DAL.Migrations
|
|||||||
b.HasIndex("Name", "Index")
|
b.HasIndex("Name", "Index")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Templates");
|
b.ToTable("Templates", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b =>
|
modelBuilder.Entity("PARR.DAL.Models.TemplateHistory", b =>
|
||||||
@@ -3080,7 +3080,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ParentId");
|
b.HasIndex("ParentId");
|
||||||
|
|
||||||
b.ToTable("TemplateHistories");
|
b.ToTable("TemplateHistories", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.TemplateStatusType", b =>
|
modelBuilder.Entity("PARR.DAL.Models.TemplateStatusType", b =>
|
||||||
@@ -3098,7 +3098,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
b.ToTable("TemplateStatusTypes", t =>
|
b.ToTable("TemplateStatusTypes", null, t =>
|
||||||
{
|
{
|
||||||
t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
|
t.HasComment("Таблица описания критериев выборки аттрибутов ЭК");
|
||||||
});
|
});
|
||||||
@@ -3159,7 +3159,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("SubprocessId");
|
b.HasIndex("SubprocessId");
|
||||||
|
|
||||||
b.ToTable("Tnks");
|
b.ToTable("Tnks", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b =>
|
modelBuilder.Entity("PARR.DAL.Models.Unit.Unit", b =>
|
||||||
@@ -3425,7 +3425,7 @@ namespace PARR.DAL.Migrations
|
|||||||
b.HasIndex("Ip")
|
b.HasIndex("Ip")
|
||||||
.IsUnique();
|
.IsUnique();
|
||||||
|
|
||||||
b.ToTable("Users");
|
b.ToTable("Users", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b =>
|
modelBuilder.Entity("PARR.DAL.Models.UsersInRole", b =>
|
||||||
@@ -3440,7 +3440,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("UserId");
|
b.HasIndex("UserId");
|
||||||
|
|
||||||
b.ToTable("UsersInRoles");
|
b.ToTable("UsersInRoles", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.WeekendDay", b =>
|
modelBuilder.Entity("PARR.DAL.Models.WeekendDay", b =>
|
||||||
@@ -3480,7 +3480,7 @@ namespace PARR.DAL.Migrations
|
|||||||
|
|
||||||
b.HasIndex("ResponseAreaCode");
|
b.HasIndex("ResponseAreaCode");
|
||||||
|
|
||||||
b.ToTable("WorkGroups");
|
b.ToTable("WorkGroups", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b =>
|
modelBuilder.Entity("PARR.DAL.Models.AgentHistory", b =>
|
||||||
|
|||||||
@@ -26,8 +26,4 @@
|
|||||||
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
|
<ProjectReference Include="..\PARR.Core\PARR.Core.csproj" />
|
||||||
<ProjectReference Include="..\PARR.Domain\PARR.Domain.csproj" />
|
<ProjectReference Include="..\PARR.Domain\PARR.Domain.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="Repositories\Base\" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PARR.Core.Repositories.Interfaces.TaskRepositories;
|
||||||
using PARR.DAL.Cache.Services.Base;
|
using PARR.DAL.Cache.Services.Base;
|
||||||
using PARR.DAL.Configurations.DbSettings;
|
using PARR.DAL.Configurations.DbSettings;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
@@ -14,16 +15,15 @@ using PARR.DAL.DomainServices.UnitFilterService.Models;
|
|||||||
using PARR.DAL.InfluxDbServices;
|
using PARR.DAL.InfluxDbServices;
|
||||||
using PARR.DAL.NextRunServices;
|
using PARR.DAL.NextRunServices;
|
||||||
using PARR.DAL.NextRunServices.Subservices;
|
using PARR.DAL.NextRunServices.Subservices;
|
||||||
|
using PARR.DAL.Repositories.TaskRepositories;
|
||||||
using PARR.DAL.Services.Implementation;
|
using PARR.DAL.Services.Implementation;
|
||||||
using PARR.DAL.Services.Implementations;
|
using PARR.DAL.Services.Implementations;
|
||||||
using PARR.DAL.Services.Implementations.Job;
|
using PARR.DAL.Services.Implementations.Job;
|
||||||
using PARR.DAL.Services.Implementations.Schedule;
|
using PARR.DAL.Services.Implementations.Schedule;
|
||||||
using PARR.DAL.Services.Implementations.TaskServices;
|
|
||||||
using PARR.DAL.Services.Implementations.Unit;
|
using PARR.DAL.Services.Implementations.Unit;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
using PARR.DAL.Services.Interfaces.Schedule;
|
using PARR.DAL.Services.Interfaces.Schedule;
|
||||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
using PARR.DAL.Settings;
|
using PARR.DAL.Settings;
|
||||||
using PARR.DAL.TaskServices;
|
using PARR.DAL.TaskServices;
|
||||||
@@ -154,9 +154,9 @@ namespace PARR.DAL
|
|||||||
|
|
||||||
#region Task
|
#region Task
|
||||||
|
|
||||||
services.AddTransient<ITaskErrorService, TaskErrorService>();
|
services.AddScoped<ITaskErrorRepository, TaskErrorRepository>();
|
||||||
services.AddTransient<ITaskService, TaskService>();
|
services.AddScoped<ITaskRepository, TaskRepository>();
|
||||||
services.AddTransient<ITaskTypeService, TaskTypeService>();
|
services.AddScoped<ITaskTypeRepository, TaskTypeRepository>();
|
||||||
|
|
||||||
services.AddTransient<ITaskManagementService, TaskManagementService>();
|
services.AddTransient<ITaskManagementService, TaskManagementService>();
|
||||||
|
|
||||||
|
|||||||
@@ -1,28 +1,40 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PARR.Core.Repositories.Base;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.DomainModels;
|
using PARR.Domain.Common.Pagination;
|
||||||
using PARR.DAL.Services.Interfaces.Base;
|
|
||||||
using PARR.Domain.Entities.Base;
|
using PARR.Domain.Entities.Base;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
using PARR.Domain.Entities.Base.History.Base;
|
using PARR.Domain.Entities.Base.History.Base;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Abstracts
|
namespace PARR.DAL.Repositories.Base
|
||||||
{
|
{
|
||||||
internal abstract class BaseService<T> : IBaseService<T> where T : class, IBaseEntity
|
internal abstract class BaseRepository<T> : IBaseRepository<T> where T : class, IBaseEntity
|
||||||
{
|
{
|
||||||
private readonly ILogger<BaseService<T>> logger;
|
//private readonly ILogger<BaseRepository<T>> logger;
|
||||||
|
|
||||||
protected abstract DbSet<T> EntitySet { get; }
|
//protected abstract DbSet<T> EntitySet { get; }
|
||||||
protected abstract DataContext EntitiContext { get; }
|
//protected abstract DataContext EntitiContext { get; }
|
||||||
|
|
||||||
public BaseService(ILogger<BaseService<T>> logger)
|
//public BaseRepository(ILogger<BaseRepository<T>> logger)
|
||||||
|
//{
|
||||||
|
// this.logger = logger;
|
||||||
|
//}
|
||||||
|
|
||||||
|
protected readonly ILogger logger;
|
||||||
|
protected readonly DbSet<T> EntitySet;
|
||||||
|
protected readonly DataContext EntityContext;
|
||||||
|
|
||||||
|
protected BaseRepository(ILogger logger, DataContext dataContext)
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
this.EntityContext = dataContext;
|
||||||
|
this.EntitySet = dataContext.Set<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public virtual async Task<bool> AddRangeAsync(List<T> objs)
|
public virtual async Task<bool> AddRangeAsync(List<T> objs)
|
||||||
{
|
{
|
||||||
logger.LogDebug("Начинаю добавление диапазона объектов типа {EntityType}, количество: {Count}",
|
logger.LogDebug("Начинаю добавление диапазона объектов типа {EntityType}, количество: {Count}",
|
||||||
@@ -49,7 +61,7 @@ namespace PARR.DAL.Services.Abstracts
|
|||||||
logger.LogDebug("Начинаю сохранение изменений в БД для объектов типа {EntityType}", typeof(T).Name);
|
logger.LogDebug("Начинаю сохранение изменений в БД для объектов типа {EntityType}", typeof(T).Name);
|
||||||
|
|
||||||
#region Изменения
|
#region Изменения
|
||||||
var modifiedEntrities = EntitiContext.ChangeTracker.Entries()
|
var modifiedEntrities = EntityContext.ChangeTracker.Entries()
|
||||||
.Where(t => t.State == EntityState.Modified/* || t.State == EntityState.Deleted*/);
|
.Where(t => t.State == EntityState.Modified/* || t.State == EntityState.Deleted*/);
|
||||||
|
|
||||||
logger.LogDebug("Найдено {Count} измененных сущностей для обработки истории", modifiedEntrities.Count());
|
logger.LogDebug("Найдено {Count} измененных сущностей для обработки истории", modifiedEntrities.Count());
|
||||||
@@ -68,7 +80,7 @@ namespace PARR.DAL.Services.Abstracts
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var changedCount = await EntitiContext.SaveChangesAsync();
|
var changedCount = await EntityContext.SaveChangesAsync();
|
||||||
logger.LogDebug("Успешно сохранено {ChangedCount} изменений в БД для объектов типа {EntityType}",
|
logger.LogDebug("Успешно сохранено {ChangedCount} изменений в БД для объектов типа {EntityType}",
|
||||||
changedCount, typeof(T).Name);
|
changedCount, typeof(T).Name);
|
||||||
return true;
|
return true;
|
||||||
@@ -90,7 +102,7 @@ namespace PARR.DAL.Services.Abstracts
|
|||||||
logger.LogDebug("Устанавливаю инициатора для изменений");
|
logger.LogDebug("Устанавливаю инициатора для изменений");
|
||||||
|
|
||||||
// Задаем инициатора только для новых и измененных записей
|
// Задаем инициатора только для новых и измененных записей
|
||||||
var entrities = EntitiContext.ChangeTracker.Entries()
|
var entrities = EntityContext.ChangeTracker.Entries()
|
||||||
.Where(t => t.State == EntityState.Modified || t.State == EntityState.Added);
|
.Where(t => t.State == EntityState.Modified || t.State == EntityState.Added);
|
||||||
|
|
||||||
var entityCount = entrities.Count();
|
var entityCount = entrities.Count();
|
||||||
@@ -172,7 +184,7 @@ namespace PARR.DAL.Services.Abstracts
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EntitiContext.Add(historyInstance);
|
EntityContext.Add(historyInstance);
|
||||||
logger.LogDebug("История добавлена для сущности типа {EntityType}", obj.Entity.GetType().Name);
|
logger.LogDebug("История добавлена для сущности типа {EntityType}", obj.Entity.GetType().Name);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PARR.Core.Repositories.Interfaces.TaskRepositories;
|
||||||
|
using PARR.DAL.Context;
|
||||||
|
using PARR.DAL.Repositories.Base;
|
||||||
|
using PARR.Domain.Entities.TaskEntities;
|
||||||
|
|
||||||
|
namespace PARR.DAL.Repositories.TaskRepositories
|
||||||
|
{
|
||||||
|
internal class TaskErrorRepository : BaseRepository<TaskError>, ITaskErrorRepository
|
||||||
|
{
|
||||||
|
public TaskErrorRepository(DataContext dataContext, ILogger<TaskErrorRepository> logger) : base(logger, dataContext) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
16
PARR.DAL/Repositories/TaskRepositories/TaskRepository.cs
Normal file
16
PARR.DAL/Repositories/TaskRepositories/TaskRepository.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using PARR.Core.Repositories.Interfaces.TaskRepositories;
|
||||||
|
using PARR.DAL.Context;
|
||||||
|
using PARR.DAL.Repositories.Base;
|
||||||
|
using PARR.Domain.Entities.TaskEntities;
|
||||||
|
|
||||||
|
namespace PARR.DAL.Repositories.TaskRepositories
|
||||||
|
{
|
||||||
|
internal class TaskRepository : BaseRepository<TaskItem>, ITaskRepository
|
||||||
|
{
|
||||||
|
public TaskRepository(DataContext dataContext, ILogger<TaskRepository> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
|
|
||||||
|
// метод атомарного взятия в работу
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
using PARR.DAL.Context;
|
using PARR.Core.Repositories.Interfaces.TaskRepositories;
|
||||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
using PARR.DAL.Context;
|
||||||
using PARR.Domain.Entities.TaskEntities;
|
using PARR.Domain.Entities.TaskEntities;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.TaskServices
|
namespace PARR.DAL.Repositories.TaskRepositories
|
||||||
{
|
{
|
||||||
internal class TaskTypeService : ITaskTypeService
|
internal class TaskTypeRepository : ITaskTypeRepository
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
private readonly DataContext dataContext;
|
||||||
|
|
||||||
public TaskTypeService(DataContext dataContext)
|
public TaskTypeRepository(DataContext dataContext)
|
||||||
{
|
{
|
||||||
this.dataContext = dataContext;
|
this.dataContext = dataContext;
|
||||||
}
|
}
|
||||||
@@ -1,23 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class AgentHistoryService : BaseService<AgentHistory>, IAgentHistoryService
|
internal class AgentHistoryService : BaseRepository<AgentHistory>, IAgentHistoryService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public AgentHistoryService(DataContext dataContext, ILogger<AgentHistoryService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public AgentHistoryService(DataContext dataContext, ILogger<AgentHistoryService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<AgentHistory> EntitySet => dataContext.AgentHistories;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class ApplicationInHostService : BaseService<ApplicationInHost>, IApplicationInHostService
|
internal class ApplicationInHostService : BaseRepository<ApplicationInHost>, IApplicationInHostService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public ApplicationInHostService(DataContext dataContext, ILogger<ApplicationInHostService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<ApplicationInHostService> logger;
|
|
||||||
|
|
||||||
public ApplicationInHostService(DataContext dataContext, ILogger<ApplicationInHostService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<ApplicationInHost> EntitySet => dataContext.ApplicationsInHosts;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,25 +2,14 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class ApplicationService : BaseService<Application>, IApplicationService
|
internal class ApplicationService : BaseRepository<Application>, IApplicationService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public ApplicationService(DataContext dataContext, ILogger<ApplicationService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<ApplicationService> logger;
|
|
||||||
|
|
||||||
public ApplicationService(DataContext dataContext, ILogger<ApplicationService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<Application> EntitySet => dataContext.Applications;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public async Task<Application?> GetByNameAsync(string appName, Guid typeId)
|
public async Task<Application?> GetByNameAsync(string appName, Guid typeId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,25 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementation
|
namespace PARR.DAL.Services.Implementation
|
||||||
{
|
{
|
||||||
internal class ApplicationTypeService : BaseService<ApplicationType>, IApplicationTypeService
|
internal class ApplicationTypeService : BaseRepository<ApplicationType>, IApplicationTypeService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public ApplicationTypeService(DataContext dataContext, ILogger<ApplicationTypeService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<ApplicationTypeService> logger;
|
|
||||||
|
|
||||||
public ApplicationTypeService(DataContext dataContext, ILogger<ApplicationTypeService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<ApplicationType> EntitySet => dataContext.ApplicationTypes;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,26 +2,14 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class ApplicationsInWorkService : BaseService<ApplicationsInWork>, IApplicationsInWorkService
|
internal class ApplicationsInWorkService : BaseRepository<ApplicationsInWork>, IApplicationsInWorkService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public ApplicationsInWorkService(DataContext dataContext, ILogger<ApplicationsInWorkService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<ApplicationsInWorkService> logger;
|
|
||||||
|
|
||||||
public ApplicationsInWorkService(DataContext dataContext, ILogger<ApplicationsInWorkService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected override DbSet<ApplicationsInWork> EntitySet => dataContext.ApplicationsInWorks;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public async Task<ApplicationsInWork?> GetAsync(Guid applicationId, Guid workId)
|
public async Task<ApplicationsInWork?> GetAsync(Guid applicationId, Guid workId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class DistributionPeriodService : BaseService<DistributionPeriod>, IDistributionPeriodService
|
internal class DistributionPeriodService : BaseRepository<DistributionPeriod>, IDistributionPeriodService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public DistributionPeriodService(DataContext dataContext, ILogger<DistributionPeriodService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<DistributionPeriod> EntitySet => dataContext.DistributionPeriods;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public DistributionPeriodService(DataContext dataContext, ILogger<DistributionPeriodService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,23 +3,14 @@ using Microsoft.Extensions.Logging;
|
|||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.DomainModels;
|
using PARR.DAL.DomainModels;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class EsppSchTypeConfigService : BaseService<EsppSchTypeConfig>, IEsppSchTypeConfigService
|
internal class EsppSchTypeConfigService : BaseRepository<EsppSchTypeConfig>, IEsppSchTypeConfigService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public EsppSchTypeConfigService(DataContext dataContext, ILogger<EsppSchTypeConfigService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public EsppSchTypeConfigService(DataContext dataContext, ILogger<EsppSchTypeConfigService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<EsppSchTypeConfig> EntitySet => dataContext.EsppSchTypeConfigs;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public IQueryable<EsppSchTypeConfig> GetWithSchIncludes()
|
public IQueryable<EsppSchTypeConfig> GetWithSchIncludes()
|
||||||
{
|
{
|
||||||
@@ -36,7 +27,7 @@ namespace PARR.DAL.Services.Implementations
|
|||||||
{
|
{
|
||||||
//Формирует расписание в нормальном понятном виде из БД
|
//Формирует расписание в нормальном понятном виде из БД
|
||||||
|
|
||||||
var items = await dataContext.EsppSchValues.Where(t => t.JobGroupId == jobGroupId)
|
var items = await EntityContext.EsppSchValues.Where(t => t.JobGroupId == jobGroupId)
|
||||||
.Select(t => new
|
.Select(t => new
|
||||||
{
|
{
|
||||||
t.EsppSchTypeConfig!.Order,
|
t.EsppSchTypeConfig!.Order,
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class EsppSchTypeValueService : BaseService<EsppSchTypeValue>, IEsppSchTypeValueService
|
internal class EsppSchTypeValueService : BaseRepository<EsppSchTypeValue>, IEsppSchTypeValueService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public EsppSchTypeValueService(DataContext dataContext, ILogger<EsppSchTypeValueService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<EsppSchTypeValue> EntitySet => dataContext.EsppSchTypeValues;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public EsppSchTypeValueService(DataContext dataContext, ILogger<EsppSchTypeValueService> logger): base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,24 +2,14 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class HostService : BaseService<Host>, IHostService
|
internal class HostService : BaseRepository<Host>, IHostService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public HostService(DataContext dataContext, ILogger<HostService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<HostService> logger;
|
|
||||||
|
|
||||||
protected override DbSet<Host> EntitySet => dataContext.Hosts;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
public HostService(DataContext dataContext, ILogger<HostService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<Host?> GetHostWithAppsByIpAsync(string ip)
|
public async Task<Host?> GetHostWithAppsByIpAsync(string ip)
|
||||||
|
|||||||
@@ -1,21 +1,12 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Job
|
namespace PARR.DAL.Services.Implementations.Job
|
||||||
{
|
{
|
||||||
internal class FieldFilterService : BaseService<Models.Job.JobFieldFilter>, IFieldFilterService
|
internal class FieldFilterService : BaseRepository<Models.Job.JobFieldFilter>, IFieldFilterService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public FieldFilterService(DataContext dataContext, ILogger<FieldFilterService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<Models.Job.JobFieldFilter> EntitySet => dataContext.FieldFilters;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
public FieldFilterService(DataContext dataContext, ILogger<FieldFilterService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Job;
|
using PARR.DAL.Models.Job;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Job
|
namespace PARR.DAL.Services.Implementations.Job
|
||||||
{
|
{
|
||||||
internal class JobUnitFilterService : BaseService<JobUnitFilter>, IJobUnitFilterService
|
internal class JobUnitFilterService : BaseRepository<JobUnitFilter>, IJobUnitFilterService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public JobUnitFilterService(DataContext dataContext, ILogger<JobUnitFilterService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<JobUnitFilter> EntitySet => dataContext.JobUnitFilters;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public JobUnitFilterService(DataContext dataContext, ILogger<JobUnitFilterService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,19 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Job;
|
using PARR.DAL.Models.Job;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Job
|
namespace PARR.DAL.Services.Implementations.Job
|
||||||
{
|
{
|
||||||
internal class JobGroupService : BaseService<Models.Job.JobGroup>, IJobGroupService
|
internal class JobGroupService : BaseRepository<Models.Job.JobGroup>, IJobGroupService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public JobGroupService(DataContext dataContext, ILogger<JobGroupService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public JobGroupService(DataContext dataContext, ILogger<JobGroupService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
protected override DbSet<JobGroup> EntitySet => dataContext.JobGroups;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
|
|
||||||
public void DeleteDistributionConfig(JobGroupDistributionConfig distributionConfig)
|
public void DeleteDistributionConfig(JobGroupDistributionConfig distributionConfig)
|
||||||
{
|
{
|
||||||
EntitiContext.JobGroupDistributionConfigs.Remove(distributionConfig);
|
EntityContext.JobGroupDistributionConfigs.Remove(distributionConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Job;
|
using PARR.DAL.Models.Job;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Job
|
namespace PARR.DAL.Services.Implementations.Job
|
||||||
{
|
{
|
||||||
internal class JobGroupTypeService : BaseService<JobGroupType>, IJobGroupTypeService
|
internal class JobGroupTypeService : BaseRepository<JobGroupType>, IJobGroupTypeService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public JobGroupTypeService(DataContext dataContext, ILogger<JobGroupTypeService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<JobGroupTypeService> logger;
|
|
||||||
|
|
||||||
protected override DbSet<JobGroupType> EntitySet => dataContext.JobGroupTypes;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
public JobGroupTypeService(
|
|
||||||
DataContext dataContext,
|
|
||||||
ILogger<JobGroupTypeService> logger
|
|
||||||
) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Job;
|
using PARR.DAL.Services.Interfaces.Job;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Job
|
namespace PARR.DAL.Services.Implementations.Job
|
||||||
{
|
{
|
||||||
internal class JobService : BaseService<Models.Job.Job>, IJobService
|
internal class JobService : BaseRepository<Models.Job.Job>, IJobService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public JobService(DataContext dataContext, ILogger<JobService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public JobService(DataContext dataContext, ILogger<JobService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<Models.Job.Job> EntitySet => dataContext.Jobs;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public override Task<bool> CreateAsync(Models.Job.Job obj)
|
public override Task<bool> CreateAsync(Models.Job.Job obj)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class OrderService : BaseService<Order>, IOrderService
|
internal class OrderService : BaseRepository<Order>, IOrderService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public OrderService(DataContext dataContext, ILogger<OrderService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public OrderService(DataContext dataContext, ILogger<OrderService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<Order> EntitySet => dataContext.Orders;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class ProcessService : BaseService<Process>, IProcessService
|
internal class ProcessService : BaseRepository<Process>, IProcessService
|
||||||
{
|
{
|
||||||
private readonly ILogger<ProcessService> logger;
|
public ProcessService(ILogger<ProcessService> logger, DataContext dataContext) : base(logger, dataContext) { }
|
||||||
private readonly DataContext dataContext;
|
|
||||||
|
|
||||||
public ProcessService(ILogger<ProcessService> logger, DataContext dataContext) : base(logger)
|
|
||||||
{
|
|
||||||
this.logger = logger;
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
protected override DbSet<Process> EntitySet => dataContext.Processes;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,26 +3,15 @@ using Microsoft.Extensions.Logging;
|
|||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class RobotConfigurationService : BaseService<RobotConfiguration>, IRobotConfigurationService
|
internal class RobotConfigurationService : BaseRepository<RobotConfiguration>, IRobotConfigurationService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public RobotConfigurationService(DataContext dataContext, ILogger<RobotConfigurationService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<RobotConfigurationService> logger;
|
|
||||||
|
|
||||||
public RobotConfigurationService(DataContext dataContext, ILogger<RobotConfigurationService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<RobotConfiguration> EntitySet => dataContext.RobotConfigurations;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
|
|
||||||
public void ChangeTaskStatus(TaskStatusEnum taskStatus, RobotConfiguration configuration)
|
public void ChangeTaskStatus(TaskStatusEnum taskStatus, RobotConfiguration configuration)
|
||||||
|
|||||||
@@ -1,23 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class RobotHistoryService : BaseService<RobotHistory>, IRobotHistoryService
|
internal class RobotHistoryService : BaseRepository<RobotHistory>, IRobotHistoryService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public RobotHistoryService(DataContext dataContext, ILogger<RobotHistoryService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public RobotHistoryService(DataContext dataContext, ILogger<RobotHistoryService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<RobotHistory> EntitySet => dataContext.RobotHistories;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class RoleService : BaseService<Role>, IRoleService
|
internal class RoleService : BaseRepository<Role>, IRoleService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public RoleService(DataContext dataContext, ILogger<RoleService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public RoleService(DataContext dataContext, ILogger<RoleService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<Role> EntitySet => dataContext.Roles;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Schedule;
|
using PARR.DAL.Models.Schedule;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Schedule;
|
using PARR.DAL.Services.Interfaces.Schedule;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Schedule
|
namespace PARR.DAL.Services.Implementations.Schedule
|
||||||
{
|
{
|
||||||
internal class ScheduleExcludeTypeCalendarService : BaseService<ScheduleExcludeTypeCalendar>, IScheduleExcludeTypeCalendarService
|
internal class ScheduleExcludeTypeCalendarService : BaseRepository<ScheduleExcludeTypeCalendar>, IScheduleExcludeTypeCalendarService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public ScheduleExcludeTypeCalendarService(DataContext dataContext, ILogger<ScheduleExcludeTypeCalendarService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<ScheduleExcludeTypeCalendar> EntitySet => dataContext.ScheduleExcludeTypeCalendars;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public ScheduleExcludeTypeCalendarService(DataContext dataContext, ILogger<ScheduleExcludeTypeCalendarService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Schedule;
|
using PARR.DAL.Models.Schedule;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Schedule;
|
using PARR.DAL.Services.Interfaces.Schedule;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Schedule
|
namespace PARR.DAL.Services.Implementations.Schedule
|
||||||
{
|
{
|
||||||
internal class ScheduleExcludeTypeService : BaseService<ScheduleExcludeType>, IScheduleExcludeTypeService
|
internal class ScheduleExcludeTypeService : BaseRepository<ScheduleExcludeType>, IScheduleExcludeTypeService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public ScheduleExcludeTypeService(DataContext dataContext, ILogger<ScheduleExcludeTypeService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<ScheduleExcludeType> EntitySet => dataContext.ScheduleExcludeTypes;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public ScheduleExcludeTypeService(DataContext dataContext, ILogger<ScheduleExcludeTypeService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,12 @@ namespace PARR.DAL.Services.Implementations.Schedule
|
|||||||
internal sealed class ScheduleResponseAreaTimeOffsetService : IScheduleResponseAreaTimeOffsetService
|
internal sealed class ScheduleResponseAreaTimeOffsetService : IScheduleResponseAreaTimeOffsetService
|
||||||
{
|
{
|
||||||
private readonly IReadOnlyDictionary<string, ScheduleResponseAreaTimeOffset> offsetList;
|
private readonly IReadOnlyDictionary<string, ScheduleResponseAreaTimeOffset> offsetList;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ЗО по умолчанию
|
/// ЗО по умолчанию
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly string defaultResponseArea;
|
private readonly string defaultResponseArea;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Настройки, если не нашли в offsetList
|
/// Настройки, если не нашли в offsetList
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class SubprocessService : BaseService<Subprocess>, ISubprocessService
|
internal class SubprocessService : BaseRepository<Subprocess>, ISubprocessService
|
||||||
{
|
{
|
||||||
private readonly ILogger<SubprocessService> logger;
|
public SubprocessService(ILogger<SubprocessService> logger, DataContext dataContext) : base(logger, dataContext) { }
|
||||||
private readonly DataContext dataContext;
|
|
||||||
|
|
||||||
public SubprocessService(ILogger<SubprocessService> logger, DataContext dataContext) : base(logger)
|
|
||||||
{
|
|
||||||
this.logger = logger;
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
protected override DbSet<Subprocess> EntitySet => dataContext.Subprocesses;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
|
||||||
using PARR.DAL.Services.Abstracts;
|
|
||||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
|
||||||
using PARR.Domain.Entities.TaskEntities;
|
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.TaskServices
|
|
||||||
{
|
|
||||||
internal class TaskErrorService : BaseService<TaskError>, ITaskErrorService
|
|
||||||
{
|
|
||||||
private readonly DataContext dataContext;
|
|
||||||
|
|
||||||
protected override DbSet<TaskError> EntitySet => dataContext.TaskErrors;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public TaskErrorService(DataContext dataContext, ILogger<TaskErrorService> logger): base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
|
||||||
using PARR.DAL.Services.Abstracts;
|
|
||||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
|
||||||
using PARR.Domain.Entities.TaskEntities;
|
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.TaskServices
|
|
||||||
{
|
|
||||||
internal class TaskService : BaseService<TaskItem>, ITaskService
|
|
||||||
{
|
|
||||||
private readonly DataContext dataContext;
|
|
||||||
|
|
||||||
protected override DbSet<TaskItem> EntitySet => dataContext.Tasks;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public TaskService(DataContext dataContext, ILogger<TaskService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// метод атомарного взятия в работу
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +1,13 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class TemplateHistoryService : BaseService<TemplateHistory>, ITemplateHistoryService
|
internal class TemplateHistoryService : BaseRepository<TemplateHistory>, ITemplateHistoryService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public TemplateHistoryService(DataContext dataContext, ILogger<TemplateHistoryService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<TemplateHistory> EntitySet => dataContext.TemplateHistories;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public TemplateHistoryService(DataContext dataContext, ILogger<TemplateHistoryService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,27 +4,16 @@ using Npgsql;
|
|||||||
using PARR.Constants;
|
using PARR.Constants;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class TemplateService : BaseService<Template>, ITemplateService
|
internal class TemplateService : BaseRepository<Template>, ITemplateService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public TemplateService(DataContext dataContext, ILogger<TemplateService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<TemplateService> logger;
|
|
||||||
|
|
||||||
protected override DbSet<Template> EntitySet => dataContext.Templates;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public TemplateService(DataContext dataContext, ILogger<TemplateService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<Template?> GetTemplateByNameAsync(string name)
|
public async Task<Template?> GetTemplateByNameAsync(string name)
|
||||||
{
|
{
|
||||||
@@ -167,7 +156,7 @@ namespace PARR.DAL.Services.Implementations
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var result = await dataContext.Database
|
var result = await EntityContext.Database
|
||||||
.SqlQueryRaw<Guid>(sql, parameters)
|
.SqlQueryRaw<Guid>(sql, parameters)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
|
|||||||
@@ -1,24 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class TnkService : BaseService<Tnk>, ITnkService
|
internal class TnkService : BaseRepository<Tnk>, ITnkService
|
||||||
{
|
{
|
||||||
private readonly ILogger<TnkService> logger;
|
public TnkService(ILogger<TnkService> logger, DataContext dataContext) : base(logger, dataContext) { }
|
||||||
private readonly DataContext dataContext;
|
|
||||||
|
|
||||||
public TnkService(ILogger<TnkService> logger, DataContext dataContext) : base(logger)
|
|
||||||
{
|
|
||||||
this.logger = logger;
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
protected override DbSet<Tnk> EntitySet => dataContext.Tnks;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,23 +2,14 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Unit;
|
using PARR.DAL.Models.Unit;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Unit
|
namespace PARR.DAL.Services.Implementations.Unit
|
||||||
{
|
{
|
||||||
internal class UnitFieldService : BaseService<UnitField>, IUnitFieldService
|
internal class UnitFieldService : BaseRepository<UnitField>, IUnitFieldService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public UnitFieldService(DataContext dataContext, ILogger<UnitFieldService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<UnitField> EntitySet => dataContext.UnitFields;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public UnitFieldService(DataContext dataContext, ILogger<UnitFieldService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<UnitField?> GetByAihitNameAsync(string name)
|
public async Task<UnitField?> GetByAihitNameAsync(string name)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,23 +2,14 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models.Unit;
|
using PARR.DAL.Models.Unit;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Unit
|
namespace PARR.DAL.Services.Implementations.Unit
|
||||||
{
|
{
|
||||||
internal class UnitFieldValueService : BaseService<UnitFieldValue>, IUnitFieldValueService
|
internal class UnitFieldValueService : BaseRepository<UnitFieldValue>, IUnitFieldValueService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public UnitFieldValueService(DataContext dataContext, ILogger<UnitFieldValueService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<UnitFieldValue> EntitySet => dataContext.UnitFieldValues;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public UnitFieldValueService(DataContext dataContext, ILogger<UnitFieldValueService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async Task<UnitFieldValue?> GetByValueNameAsync(string? value)
|
public async Task<UnitFieldValue?> GetByValueNameAsync(string? value)
|
||||||
|
|||||||
@@ -1,23 +1,14 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces.Unit;
|
using PARR.DAL.Services.Interfaces.Unit;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations.Unit
|
namespace PARR.DAL.Services.Implementations.Unit
|
||||||
{
|
{
|
||||||
internal class UnitService : BaseService<Models.Unit.Unit>, IUnitService
|
internal class UnitService : BaseRepository<Models.Unit.Unit>, IUnitService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public UnitService(DataContext dataContext, ILogger<UnitService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
protected override DbSet<Models.Unit.Unit> EntitySet => dataContext.Units;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public UnitService(DataContext dataContext, ILogger<UnitService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public IQueryable<Models.Unit.Unit> GetWithIncludes()
|
public IQueryable<Models.Unit.Unit> GetWithIncludes()
|
||||||
|
|||||||
@@ -2,23 +2,14 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class UserService : BaseService<User>, IUserService
|
internal class UserService : BaseRepository<User>, IUserService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public UserService(DataContext dataContext, ILogger<UserService> logger) : base(logger, dataContext) { }
|
||||||
|
|
||||||
public UserService(DataContext dataContext, ILogger<UserService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override DbSet<User> EntitySet => dataContext.Users;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public async Task<User?> GetByIpWithRolesAsync(string ipAddress)
|
public async Task<User?> GetByIpWithRolesAsync(string ipAddress)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,31 +4,23 @@ using PARR.DAL.Cache.Services.Base;
|
|||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Contracts;
|
using PARR.DAL.Contracts;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class WeekendDayService : BaseService<WeekendDay>, IWeekendDayService
|
internal class WeekendDayService : BaseRepository<WeekendDay>, IWeekendDayService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
|
||||||
private readonly ILogger<WeekendDayService> logger;
|
|
||||||
private readonly IRedisCacheService redisCacheService;
|
private readonly IRedisCacheService redisCacheService;
|
||||||
private readonly SettingsFromDb settings;
|
private readonly SettingsFromDb settings;
|
||||||
|
|
||||||
protected override DbSet<WeekendDay> EntitySet => dataContext.WeekendDays;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
|
|
||||||
public WeekendDayService(
|
public WeekendDayService(
|
||||||
DataContext dataContext,
|
DataContext dataContext,
|
||||||
ILogger<WeekendDayService> logger,
|
ILogger<WeekendDayService> logger,
|
||||||
IRedisCacheService redisCacheService,
|
IRedisCacheService redisCacheService,
|
||||||
SettingsFromDb settings
|
SettingsFromDb settings
|
||||||
) : base(logger)
|
) : base(logger, dataContext)
|
||||||
{
|
{
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
this.redisCacheService = redisCacheService;
|
this.redisCacheService = redisCacheService;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
}
|
}
|
||||||
@@ -102,12 +94,14 @@ namespace PARR.DAL.Services.Implementations
|
|||||||
|
|
||||||
private string GetWeekendKey(DateOnly day)
|
private string GetWeekendKey(DateOnly day)
|
||||||
{
|
{
|
||||||
return $"weekend_{day.ToString("yyyy-MM-dd")}";
|
// return $"weekend_{day.ToString("yyyy-MM-dd")}";
|
||||||
|
return redisCacheService.GetKey(new[] { "weekend", day.ToString("yyyy-MM-dd") });
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetWorkDayKey(DateOnly day)
|
private string GetWorkDayKey(DateOnly day)
|
||||||
{
|
{
|
||||||
return $"workday_{day.ToString("yyyy-MM-dd")}";
|
//return $"workday_{day.ToString("yyyy-MM-dd")}";
|
||||||
|
return redisCacheService.GetKey(new[] { "workday", day.ToString("yyyy-MM-dd") });
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,24 +2,15 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.DAL.Context;
|
using PARR.DAL.Context;
|
||||||
using PARR.DAL.Models;
|
using PARR.DAL.Models;
|
||||||
using PARR.DAL.Services.Abstracts;
|
using PARR.DAL.Repositories.Base;
|
||||||
using PARR.DAL.Services.Interfaces;
|
using PARR.DAL.Services.Interfaces;
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Implementations
|
namespace PARR.DAL.Services.Implementations
|
||||||
{
|
{
|
||||||
internal class WorkGroupService : BaseService<WorkGroup>, IWorkGroupService
|
internal class WorkGroupService : BaseRepository<WorkGroup>, IWorkGroupService
|
||||||
{
|
{
|
||||||
private readonly DataContext dataContext;
|
public WorkGroupService(DataContext dataContext, ILogger<WorkGroupService> logger) : base(logger, dataContext) { }
|
||||||
private readonly ILogger<WorkGroupService> logger;
|
|
||||||
|
|
||||||
protected override DbSet<WorkGroup> EntitySet => dataContext.WorkGroups;
|
|
||||||
|
|
||||||
protected override DataContext EntitiContext => dataContext;
|
|
||||||
public WorkGroupService(DataContext dataContext, ILogger<WorkGroupService> logger) : base(logger)
|
|
||||||
{
|
|
||||||
this.dataContext = dataContext;
|
|
||||||
this.logger = logger;
|
|
||||||
}
|
|
||||||
public async Task<WorkGroup?> GetByNameAsync(string name)
|
public async Task<WorkGroup?> GetByNameAsync(string name)
|
||||||
{
|
{
|
||||||
return await Get().FirstOrDefaultAsync(t => t.Name == name);
|
return await Get().FirstOrDefaultAsync(t => t.Name == name);
|
||||||
|
|||||||
@@ -1,22 +1,41 @@
|
|||||||
using PARR.DAL.DomainModels;
|
using PARR.Core.Repositories.Base;
|
||||||
using PARR.Domain.Entities.Base;
|
using PARR.Domain.Entities.Base;
|
||||||
using PARR.Domain.Entities.Base.History;
|
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Interfaces.Base
|
namespace PARR.DAL.Services.Interfaces.Base
|
||||||
{
|
{
|
||||||
public interface IBaseService<T> where T : class, IBaseEntity
|
public interface IBaseService<T> : IBaseRepository<T> where T : class, IBaseEntity
|
||||||
{
|
{
|
||||||
Task<T?> GetAsync(Guid id);
|
// TODO: позже удалить этот интерфейс, когда изменим все сервисы на репозитории
|
||||||
IQueryable<T> Get();
|
|
||||||
IQueryable<T> GetPage(IQueryable<T> query, PaginationFilter paginationFilter);
|
|
||||||
|
|
||||||
Task<bool> CreateAsync(T obj);
|
//Task<T?> GetAsync(Guid id);
|
||||||
Task<bool> AddRangeAsync(List<T> objs);
|
//IQueryable<T> Get();
|
||||||
|
//IQueryable<T> GetPage(IQueryable<T> query, PaginationFilter paginationFilter);
|
||||||
|
|
||||||
Task<bool> DeleteAsync(Guid id);
|
//Task<bool> CreateAsync(T obj);
|
||||||
bool Delete(T obj);
|
//Task<bool> AddRangeAsync(List<T> objs);
|
||||||
|
|
||||||
//Task<bool> CommitAsync();
|
//Task<bool> DeleteAsync(Guid id);
|
||||||
Task<bool> CommitAsync(IHistoryInitiator? initiator = null);
|
//bool Delete(T obj);
|
||||||
|
|
||||||
|
////Task<bool> CommitAsync();
|
||||||
|
//Task<bool> CommitAsync(IHistoryInitiator? initiator = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//public interface IBaseService<T> where T : class, IBaseEntity
|
||||||
|
//{
|
||||||
|
// Task<T?> GetAsync(Guid id);
|
||||||
|
// IQueryable<T> Get();
|
||||||
|
// IQueryable<T> GetPage(IQueryable<T> query, PaginationFilter paginationFilter);
|
||||||
|
|
||||||
|
// Task<bool> CreateAsync(T obj);
|
||||||
|
// Task<bool> AddRangeAsync(List<T> objs);
|
||||||
|
|
||||||
|
// Task<bool> DeleteAsync(Guid id);
|
||||||
|
// bool Delete(T obj);
|
||||||
|
|
||||||
|
// //Task<bool> CommitAsync();
|
||||||
|
// Task<bool> CommitAsync(IHistoryInitiator? initiator = null);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
using PARR.DAL.Services.Interfaces.Base;
|
|
||||||
using PARR.Domain.Entities.TaskEntities;
|
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Interfaces.TaskServices
|
|
||||||
{
|
|
||||||
public interface ITaskErrorService : IBaseService<TaskError>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using PARR.DAL.Services.Interfaces.Base;
|
|
||||||
using PARR.Domain.Entities.TaskEntities;
|
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Interfaces.TaskServices
|
|
||||||
{
|
|
||||||
public interface ITaskService : IBaseService<TaskItem>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
using PARR.Domain.Entities.TaskEntities;
|
|
||||||
|
|
||||||
namespace PARR.DAL.Services.Interfaces.TaskServices
|
|
||||||
{
|
|
||||||
public interface ITaskTypeService
|
|
||||||
{
|
|
||||||
IQueryable<TaskType> Get();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using PARR.BLL.Contracts.Interfaces;
|
using PARR.BLL.Contracts.Interfaces;
|
||||||
using PARR.DAL.Services.Interfaces.TaskServices;
|
using PARR.Core.Repositories.Interfaces.TaskRepositories;
|
||||||
using PARR.Domain.Entities.Base.History;
|
using PARR.Domain.Entities.Base.History;
|
||||||
using PARR.Domain.Entities.TaskEntities;
|
using PARR.Domain.Entities.TaskEntities;
|
||||||
using PARR.Domain.Enums;
|
using PARR.Domain.Enums;
|
||||||
@@ -13,13 +13,13 @@ namespace PARR.DAL.TaskServices
|
|||||||
internal class TaskManagementService : ITaskManagementService
|
internal class TaskManagementService : ITaskManagementService
|
||||||
{
|
{
|
||||||
private readonly ILogger<TaskManagementService> logger;
|
private readonly ILogger<TaskManagementService> logger;
|
||||||
private readonly ITaskTypeService taskTypeService;
|
private readonly ITaskTypeRepository taskTypeService;
|
||||||
private readonly ITaskService taskService;
|
private readonly ITaskRepository taskService;
|
||||||
|
|
||||||
public TaskManagementService(
|
public TaskManagementService(
|
||||||
ILogger<TaskManagementService> logger,
|
ILogger<TaskManagementService> logger,
|
||||||
ITaskTypeService taskTypeService,
|
ITaskTypeRepository taskTypeService,
|
||||||
ITaskService taskService
|
ITaskRepository taskService
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
|
|||||||
11
PARR.Domain/Common/Pagination/PaginationFilter.cs
Normal file
11
PARR.Domain/Common/Pagination/PaginationFilter.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
namespace PARR.Domain.Common.Pagination
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Параметры пагинации
|
||||||
|
/// </summary>
|
||||||
|
public record PaginationFilter
|
||||||
|
{
|
||||||
|
public int PageNumber { get; init; }
|
||||||
|
public int PageSize { get; init; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user