.NET version updates, add database complete email

This commit is contained in:
2022-05-31 12:00:22 -04:00
parent 98092543ab
commit 9924880b51
6 changed files with 133 additions and 140 deletions

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>f9e2fd37-0f2d-4e3a-955a-8e49a16fce1c</UserSecretsId>
<Configurations>Debug;Release;Also Debug</Configurations>
</PropertyGroup>
@@ -12,11 +12,14 @@
</PropertyGroup>
<ItemGroup>
<Content Remove="appsettings.development.json" />
<Compile Remove="wwwroot\**" />
<Content Remove="wwwroot\**" />
<EmbeddedResource Remove="wwwroot\**" />
<None Remove="wwwroot\**" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\" />
<Content Remove="appsettings.development.json" />
</ItemGroup>
<ItemGroup>

View File

@@ -10,18 +10,18 @@ namespace PartSource.Automation.Jobs
{
public class ExecuteSsisPackages : IAutomationJob
{
private readonly EmailService _emailService;
private readonly FtpService _ftpService;
private readonly SsisService _ssisService;
private readonly ILogger<ExecuteSsisPackages> _logger;
// TODO: set from config
private readonly string[] _ssisPackages = { "Parts Availability" };
private readonly string[] _ssisPackages = { "Parts Price", "Parts Availability" };
public ExecuteSsisPackages(IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
public ExecuteSsisPackages(EmailService emailService, FtpService ftpService, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
{
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>();
_ftpService = new FtpService(ftpConfiguration);
_ftpService = ftpService;
_emailService = emailService;
_ssisService = ssisService;
_logger = logger;
}
@@ -37,16 +37,18 @@ namespace PartSource.Automation.Jobs
_ftpService.Download($"{package}.txt");
_ssisService.Execute($"{package}.dtsx");
_logger.LogInformation($"Execution of SSIS package {package} completed successfully.");
_logger.LogInformation("Execution of SSIS package {package} completed successfully.", package);
}
catch (Exception ex)
{
_logger.LogError($"Execution of SSIS package {package} failed.", ex);
_logger.LogError(ex, "Execution of SSIS package {package} failed", package);
throw;
}
}
_emailService.Send("Database Updates Complete", "Database updates to support pricing and availability have completed successfully.");
});
}
}

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Configurations>Debug;Release;Also Debug</Configurations>
</PropertyGroup>

View File

@@ -6,6 +6,7 @@ using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using PartSource.Automation.Jobs;
using PartSource.Automation.Jobs.POC;
using PartSource.Automation.Models.Configuration;
using PartSource.Automation.Services;
using PartSource.Data;
using PartSource.Data.AutoMapper;
@@ -22,7 +23,8 @@ namespace PartSource.Automation
{
class Program
{
static async Task Main(string[] args){
static async Task Main(string[] args)
{
try
{
using IHost host = CreateHostBuilder().Build();
@@ -66,7 +68,7 @@ namespace PartSource.Automation
{
options.ApiKey = builder.Configuration["Shopify:ApiKey"];
options.ApiSecret = builder.Configuration["Shopify:ApiSecret"];
options.ApiVersion = "2020-01";
options.ApiVersion = "2021-01";
options.ShopDomain = builder.Configuration["Shopify:ShopDomain"];
//options.ApiKey = "9a533dad460321c6ce8f30bf5b8691ed";
@@ -78,37 +80,21 @@ namespace PartSource.Automation
.AddAutomation(options =>
{
options.HasBaseInterval(new TimeSpan(0, 15, 0))
.HasMaxFailures(1)
//.HasJob<TestJob>(options => options.HasInterval(new TimeSpan(7, 0, 0, 0)));
//
//.HasJob<SyncronizeProducts>(options => options.HasInterval(new TimeSpan(24, 0, 0)))
.HasJob<ProcessWhiFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0)));
//.HasJob<ProcessWhiVehicles>(options => options.HasInterval(new TimeSpan(24, 0, 0))
//.HasDependency<SyncronizeProducts>()
//.HasJob<UpdateFitment>(options => options.HasInterval(new TimeSpan(24, 0, 0)));
//.HasJob<UpdatePositioning>(options => options.HasInterval(new TimeSpan(24, 0, 0))
// .HasDependency<UpdateFitment>()
// .HasDependency<ProcessWhiFitment>()
// .HasDependency<SyncronizeProducts>()
// .StartsAt(DateTime.Today.AddHours(8))
//) ;
//.HasJob<StatusCheck>(options => options.HasInterval(new TimeSpan(24, 0, 0))
// .StartsAt(DateTime.Parse("2021-04-01 08:00:00"))
//)
//.HasJob<ExecuteSsisPackages>(options =>
//options.HasInterval(new TimeSpan(24, 0, 0))
// .StartsAt(DateTime.Today.AddHours(5))
// );
//.StartsAt(DateTime.Today.AddHours(26))
//)
//.HasJob<UpdatePricing>(options => options.HasInterval(new TimeSpan(24, 0, 0))
//.HasDependency<ExecuteSsisPackages>()
//.StartsAt(DateTime.Today.AddHours(27)
//)
//);
.HasMaxFailures(3)
.HasJob<ExecuteSsisPackages>(options =>
options.HasInterval(new TimeSpan(24, 0, 0))
.StartsAt(DateTime.Today.AddHours(26))
)
.HasJob<UpdatePricing>(options =>
options.HasInterval(new TimeSpan(24, 0, 0))
.StartsAt(DateTime.Today.AddHours(27))
.HasDependency<ExecuteSsisPackages>()
);
//.AddApiServer();
})
.AddSingleton(builder.Configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>())
.AddSingleton<FtpService>()
.AddSingleton<EmailService>()
.AddSingleton<SsisService>()
.AddSingleton<WhiSeoService>()

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Configurations>Debug;Release;Also Debug</Configurations>
</PropertyGroup>

View File

@@ -1,10 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<Configurations>Debug;Release;Also Debug</Configurations>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Integrations\**" />
<EmbeddedResource Remove="Integrations\**" />
<None Remove="Integrations\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="10.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
@@ -21,8 +27,4 @@
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="Integrations\" />
</ItemGroup>
</Project>