diff --git a/NuGet.config b/NuGet.config index e74aed57..91b18a24 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,4 +1,4 @@ - + @@ -6,7 +6,6 @@ - diff --git a/PARR.AIHIT/AIHIT/ISyncher.cs b/PARR.AIHIT/AIHIT/ISyncher.cs index 77496eb7..1ed16e0d 100644 --- a/PARR.AIHIT/AIHIT/ISyncher.cs +++ b/PARR.AIHIT/AIHIT/ISyncher.cs @@ -3,5 +3,6 @@ public interface ISyncher { Task InvokeAsync(); + Task InvokeFromDatabase(); } } diff --git a/PARR.AIHIT/AIHIT/PARR.AIHIT.csproj b/PARR.AIHIT/AIHIT/PARR.AIHIT.csproj index a745fd80..6593887e 100644 --- a/PARR.AIHIT/AIHIT/PARR.AIHIT.csproj +++ b/PARR.AIHIT/AIHIT/PARR.AIHIT.csproj @@ -8,6 +8,7 @@ + diff --git a/PARR.AIHIT/AIHIT/Syncher.cs b/PARR.AIHIT/AIHIT/Syncher.cs index ff290bb8..f76f288f 100644 --- a/PARR.AIHIT/AIHIT/Syncher.cs +++ b/PARR.AIHIT/AIHIT/Syncher.cs @@ -3,10 +3,11 @@ using MailKit.Search; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using MimeKit; +using PARR.AIHIT.Context; using PARR.AIHIT.Settings; using PARR.DAL.Contracts; using PARR.DAL.Extensions; -using PARR.DAL.Models; +using PARR.DAL.Models.V1; using PARR.DAL.Services.Interfaces; using PARR.Mail.Services; using System.Text; @@ -209,6 +210,31 @@ namespace PARR.AIHIT } } + public async Task InvokeFromDatabase() + { + //call procedure + using (AIHContext db = new AIHContext()) + { + var zo = new Microsoft.Data.SqlClient.SqlParameter + { + ParameterName = "@зо", + SqlDbType = System.Data.SqlDbType.NVarChar, + Direction = System.Data.ParameterDirection.Input, + Size = 60, + Value = "96-ДВС" + }; + //.EKs.FromSql("exec sp_IPP_PARR_PTK_get_EK '88-КРАСН'"); + //.ToList(); + //db.Database.ExecuteSqlRaw("mao2.dbo.sp_IPP_PARR_PTK_get_EK @userName", param); + //var isConExist = db.ex + //var result = await db.Database.ExecuteSqlRawAsync("mao2.dbo.sp_IPP_PARR_PTK_get_EK @зо", zo); + //WORK!!!!db.EKs.FromSql($"EXEC mao2.dbo.sp_IPP_PARR_PTK_get_EK '88-КРАСН'").ToList(); + var result = db.EKs.FromSqlRaw($"EXEC mao2.dbo.sp_IPP_PARR_PTK_get_EK @зо", zo).ToList(); + } + + //get raw data + //save data + } private async Task SyncApplicationAndHostAsync(V1_Host? host, List hostApplications, bool isUpdateDateModified = false) { var isUpdated = false; @@ -346,7 +372,7 @@ namespace PARR.AIHIT return null; } - var app = new DAL.Models.V1_Application + var app = new DAL.Models.V1.V1_Application { Id = Guid.NewGuid(), Name = appName.Trim(), diff --git a/PARR.AIHIT/AIHIT/SyncherInstaller.cs b/PARR.AIHIT/AIHIT/SyncherInstaller.cs index 24d8fb28..3b7a733a 100644 --- a/PARR.AIHIT/AIHIT/SyncherInstaller.cs +++ b/PARR.AIHIT/AIHIT/SyncherInstaller.cs @@ -1,5 +1,7 @@ -using Microsoft.Extensions.Configuration; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using PARR.AIHIT.Context; using PARR.AIHIT.Settings; namespace PARR.AIHIT @@ -15,6 +17,11 @@ namespace PARR.AIHIT services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); services.AddTransient(); + + //services.AddDbContext (options => + //{ + // options.UseSqlServer("server=(10.248.19.97);uid=awhit-ipp-parr;pwd=ET3h$9y1LH#D"); + //}); } } } diff --git a/PARR.DAL/Context/DataContext.cs b/PARR.DAL/Context/DataContext.cs index 9107382e..fac45d88 100644 --- a/PARR.DAL/Context/DataContext.cs +++ b/PARR.DAL/Context/DataContext.cs @@ -1,6 +1,6 @@ using Microsoft.EntityFrameworkCore; using PARR.DAL.Contracts; -using PARR.DAL.Models; +using PARR.DAL.Models.V1; namespace PARR.DAL.Context { diff --git a/PARR.DAL/Services/Implementations/JobCategoryService.cs b/PARR.DAL/Services/Implementations/JobCategoryService.cs index 4fa3fa39..f685d3a9 100644 --- a/PARR.DAL/Services/Implementations/JobCategoryService.cs +++ b/PARR.DAL/Services/Implementations/JobCategoryService.cs @@ -1,7 +1,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Logging; using PARR.DAL.Context; -using PARR.DAL.Models; +using PARR.DAL.Models.V1; using PARR.DAL.Services.Abstracts; using PARR.DAL.Services.Interfaces; diff --git a/PARR.DAL/Services/Interfaces/IJobCategoryService.cs b/PARR.DAL/Services/Interfaces/IJobCategoryService.cs index b73b0545..21125a99 100644 --- a/PARR.DAL/Services/Interfaces/IJobCategoryService.cs +++ b/PARR.DAL/Services/Interfaces/IJobCategoryService.cs @@ -1,4 +1,4 @@ -using PARR.DAL.Models; +using PARR.DAL.Models.V1; using PARR.DAL.Services.Interfaces.Base; namespace PARR.DAL.Services.Interfaces diff --git a/PARR.Worker/PARR.Worker/Program.cs b/PARR.Worker/PARR.Worker/Program.cs index 506146f8..5a7c906f 100644 --- a/PARR.Worker/PARR.Worker/Program.cs +++ b/PARR.Worker/PARR.Worker/Program.cs @@ -1,3 +1,4 @@ +using Microsoft.EntityFrameworkCore; using PARR.AIHIT; using PARR.DAL; using PARR.Mail; @@ -15,7 +16,6 @@ IHost host = Host.CreateDefaultBuilder(args) hostContext.Configuration.GetSection(nameof(WorkerSettings)).Bind(workerSettings); services.AddSingleton(workerSettings); - services.InstallMailServices(hostContext.Configuration); services.InstallDalServices(hostContext.Configuration); services.InstallerSyncerServices(hostContext.Configuration); diff --git a/PARR.Worker/PARR.Worker/Worker.cs b/PARR.Worker/PARR.Worker/Worker.cs index c2e11170..53b4cf95 100644 --- a/PARR.Worker/PARR.Worker/Worker.cs +++ b/PARR.Worker/PARR.Worker/Worker.cs @@ -29,14 +29,14 @@ namespace PARR.Worker var services = scope.ServiceProvider; var syncer = services.GetService(); - if (syncer != null) await syncer.InvokeAsync(); + if (syncer != null) await syncer.InvokeFromDatabase(); //var hosts = await hostService.Get().ToListAsync(); //foreach ( var host in hosts ) { logger.LogInformation($"{host.HostName}"); } - //await attachmentUploader.UploadAsync(); - //logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); + //await attachmentUploader.UploadAsync(); + //logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now); logger.LogInformation("=== === === === Конец синхронизации === === === ===");