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

View File

@@ -10,18 +10,18 @@ namespace PartSource.Automation.Jobs
{ {
public class ExecuteSsisPackages : IAutomationJob public class ExecuteSsisPackages : IAutomationJob
{ {
private readonly EmailService _emailService;
private readonly FtpService _ftpService; private readonly FtpService _ftpService;
private readonly SsisService _ssisService; private readonly SsisService _ssisService;
private readonly ILogger<ExecuteSsisPackages> _logger; private readonly ILogger<ExecuteSsisPackages> _logger;
// TODO: set from config // 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 = ftpService;
_emailService = emailService;
_ftpService = new FtpService(ftpConfiguration);
_ssisService = ssisService; _ssisService = ssisService;
_logger = logger; _logger = logger;
} }
@@ -37,16 +37,18 @@ namespace PartSource.Automation.Jobs
_ftpService.Download($"{package}.txt"); _ftpService.Download($"{package}.txt");
_ssisService.Execute($"{package}.dtsx"); _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) catch (Exception ex)
{ {
_logger.LogError($"Execution of SSIS package {package} failed.", ex); _logger.LogError(ex, "Execution of SSIS package {package} failed", package);
throw; throw;
} }
} }
_emailService.Send("Database Updates Complete", "Database updates to support pricing and availability have completed successfully.");
}); });
} }
} }

View File

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

View File

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

View File

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

View File

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