Корректировка имен колонок в АИХ ИТ

This commit is contained in:
Mikhail Kuznetsov
2023-08-10 16:43:01 +10:00
parent 39b1333969
commit 2cc8af6af5
10 changed files with 46 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
@@ -6,7 +6,6 @@
<add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
</packageSources>
<disabledPackageSources>
<add key="nuget.org" value="true" />
<add key="Microsoft Visual Studio Offline Packages" value="true" />
</disabledPackageSources>
</configuration>

View File

@@ -3,5 +3,6 @@
public interface ISyncher
{
Task InvokeAsync();
Task InvokeFromDatabase();
}
}

View File

@@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
</ItemGroup>

View File

@@ -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<V1_Application> 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(),

View File

@@ -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<ISyncher, Syncher>();
//services.AddDbContext <AIHContext> (options =>
//{
// options.UseSqlServer("server=(10.248.19.97);uid=awhit-ipp-parr;pwd=ET3h$9y1LH#D");
//});
}
}
}

View File

@@ -1,6 +1,6 @@
using Microsoft.EntityFrameworkCore;
using PARR.DAL.Contracts;
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
namespace PARR.DAL.Context
{

View File

@@ -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;

View File

@@ -1,4 +1,4 @@
using PARR.DAL.Models;
using PARR.DAL.Models.V1;
using PARR.DAL.Services.Interfaces.Base;
namespace PARR.DAL.Services.Interfaces

View File

@@ -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);

View File

@@ -29,14 +29,14 @@ namespace PARR.Worker
var services = scope.ServiceProvider;
var syncer = services.GetService<ISyncher>();
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("=== === === === Конец синхронизации === === === ===");