.NET version updates, add database complete email
This commit is contained in:
@@ -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;
|
||||
@@ -20,111 +21,96 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace PartSource.Automation
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args){
|
||||
try
|
||||
{
|
||||
using IHost host = CreateHostBuilder().Build();
|
||||
class Program
|
||||
{
|
||||
static async Task Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
using IHost host = CreateHostBuilder().Build();
|
||||
|
||||
await host.StartAsync();
|
||||
}
|
||||
await host.StartAsync();
|
||||
}
|
||||
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
private static IHostBuilder CreateHostBuilder()
|
||||
{
|
||||
return Host.CreateDefaultBuilder()
|
||||
.ConfigureAppConfiguration(builder =>
|
||||
{
|
||||
string environment = Environment.GetEnvironmentVariable("AUTOMATION_ENVIRONMENT");
|
||||
private static IHostBuilder CreateHostBuilder()
|
||||
{
|
||||
return Host.CreateDefaultBuilder()
|
||||
.ConfigureAppConfiguration(builder =>
|
||||
{
|
||||
string environment = Environment.GetEnvironmentVariable("AUTOMATION_ENVIRONMENT");
|
||||
|
||||
builder.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true);
|
||||
})
|
||||
.ConfigureServices((builder, services) =>
|
||||
{
|
||||
services.AddDbContext<PartSourceContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("PartSourceDatabase"), opts => opts.EnableRetryOnFailure())
|
||||
)
|
||||
builder.SetBasePath(Directory.GetCurrentDirectory())
|
||||
.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true)
|
||||
.AddJsonFile($"appsettings.{environment}.json", optional: true, reloadOnChange: true);
|
||||
})
|
||||
.ConfigureServices((builder, services) =>
|
||||
{
|
||||
services.AddDbContext<PartSourceContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("PartSourceDatabase"), opts => opts.EnableRetryOnFailure())
|
||||
)
|
||||
|
||||
.AddDbContext<FitmentContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("FitmentDatabase"), opts =>
|
||||
{
|
||||
opts.EnableRetryOnFailure();
|
||||
opts.CommandTimeout(600);
|
||||
})
|
||||
)
|
||||
.AddDbContext<FitmentContext>(options =>
|
||||
options.UseSqlServer(builder.Configuration.GetConnectionString("FitmentDatabase"), opts =>
|
||||
{
|
||||
opts.EnableRetryOnFailure();
|
||||
opts.CommandTimeout(600);
|
||||
})
|
||||
)
|
||||
|
||||
.AddShopify(options =>
|
||||
{
|
||||
options.ApiKey = builder.Configuration["Shopify:ApiKey"];
|
||||
options.ApiSecret = builder.Configuration["Shopify:ApiSecret"];
|
||||
options.ApiVersion = "2020-01";
|
||||
options.ShopDomain = builder.Configuration["Shopify:ShopDomain"];
|
||||
.AddShopify(options =>
|
||||
{
|
||||
options.ApiKey = builder.Configuration["Shopify:ApiKey"];
|
||||
options.ApiSecret = builder.Configuration["Shopify:ApiSecret"];
|
||||
options.ApiVersion = "2021-01";
|
||||
options.ShopDomain = builder.Configuration["Shopify:ShopDomain"];
|
||||
|
||||
//options.ApiKey = "9a533dad460321c6ce8f30bf5b8691ed";
|
||||
//options.ApiSecret = "dc9e28365d9858e544d57ac7af43fee7";
|
||||
//options.ApiVersion = "2020-01";
|
||||
//options.ShopDomain = "dev-partsource.myshopify.com";
|
||||
})
|
||||
//options.ApiKey = "9a533dad460321c6ce8f30bf5b8691ed";
|
||||
//options.ApiSecret = "dc9e28365d9858e544d57ac7af43fee7";
|
||||
//options.ApiVersion = "2020-01";
|
||||
//options.ShopDomain = "dev-partsource.myshopify.com";
|
||||
})
|
||||
|
||||
.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)
|
||||
//)
|
||||
//);
|
||||
//.AddApiServer();
|
||||
})
|
||||
.AddAutomation(options =>
|
||||
{
|
||||
options.HasBaseInterval(new TimeSpan(0, 15, 0))
|
||||
.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<EmailService>()
|
||||
.AddSingleton<SsisService>()
|
||||
.AddSingleton<WhiSeoService>()
|
||||
.AddSingleton<VehicleService>()
|
||||
.AddSingleton<NexpartService>()
|
||||
.AddSingleton(builder.Configuration.GetSection("FtpServers:AzureConfiguration").Get<FtpConfiguration>())
|
||||
.AddSingleton<FtpService>()
|
||||
.AddSingleton<EmailService>()
|
||||
.AddSingleton<SsisService>()
|
||||
.AddSingleton<WhiSeoService>()
|
||||
.AddSingleton<VehicleService>()
|
||||
.AddSingleton<NexpartService>()
|
||||
|
||||
|
||||
.AddAutoMapper(typeof(PartSourceProfile));
|
||||
})
|
||||
.ConfigureLogging((builder, logging) =>
|
||||
{
|
||||
logging.AddEventLog();
|
||||
logging.AddConsole();
|
||||
.AddAutoMapper(typeof(PartSourceProfile));
|
||||
})
|
||||
.ConfigureLogging((builder, logging) =>
|
||||
{
|
||||
logging.AddEventLog();
|
||||
logging.AddConsole();
|
||||
|
||||
// logging.AddProvider(new AutomationLoggerProvider());
|
||||
});
|
||||
}
|
||||
}
|
||||
// logging.AddProvider(new AutomationLoggerProvider());
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user