Finalize hourly inventory configuration
This commit is contained in:
@@ -14,19 +14,22 @@ using PartSource.Automation.Models.Ftp;
|
||||
using PartSource.Automation.Services;
|
||||
using Ratermania.Automation.Interfaces;
|
||||
|
||||
namespace PartSource.Automation.Jobs.POC
|
||||
namespace PartSource.Automation.Jobs
|
||||
{
|
||||
public class BulkUpdateInventory : IAutomationJob
|
||||
{
|
||||
private readonly FtpService _ftpService;
|
||||
private readonly ILogger<BulkUpdateInventory> _logger;
|
||||
private readonly string _connectionString;
|
||||
|
||||
public BulkUpdateInventory(IConfiguration configuration, ILogger<BulkUpdateInventory> logger)
|
||||
{
|
||||
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
|
||||
_ftpService = new FtpService(ftpConfiguration);
|
||||
|
||||
_logger = logger;
|
||||
_connectionString = configuration.GetConnectionString("PartSourceDatabase");
|
||||
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public async Task Run(CancellationToken token, params string[] arguments)
|
||||
@@ -46,7 +49,7 @@ namespace PartSource.Automation.Jobs.POC
|
||||
|
||||
DataTable dataTable = GetDataTable(file);
|
||||
|
||||
using SqlConnection connection = new SqlConnection("Server=tcp:ps-whi.database.windows.net,1433;Initial Catalog=ps-whi-test;Persist Security Info=False;User ID=ps-whi;Password=9-^*N5dw!6:|.5Q;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
|
||||
using SqlConnection connection = new SqlConnection(_connectionString);
|
||||
connection.Open();
|
||||
|
||||
using SqlCommand command = new SqlCommand("TRUNCATE TABLE PartAvailability", connection);
|
||||
@@ -17,7 +17,7 @@ namespace PartSource.Automation.Jobs
|
||||
private readonly ILogger<ExecuteSsisPackages> _logger;
|
||||
|
||||
// TODO: set from config
|
||||
private readonly string[] _ssisPackages = {"Parts Availability" };
|
||||
private readonly string[] _ssisPackages = {"Parts Price" };
|
||||
|
||||
public ExecuteSsisPackages(EmailService emailService, IConfiguration configuration, SsisService ssisService, ILogger<ExecuteSsisPackages> logger)
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace PartSource.Automation.Jobs
|
||||
{
|
||||
try
|
||||
{
|
||||
// _ftpService.Download($"{package}.txt");
|
||||
_ftpService.Download($"{package}.txt");
|
||||
_ssisService.Execute($"{package}.dtsx");
|
||||
|
||||
_logger.LogInformation($"Execution of SSIS package {package} completed successfully.");
|
||||
|
||||
@@ -14,18 +14,21 @@ using PartSource.Automation.Models.Ftp;
|
||||
using PartSource.Automation.Services;
|
||||
using Ratermania.Automation.Interfaces;
|
||||
|
||||
namespace PartSource.Automation.Jobs.POC
|
||||
namespace PartSource.Automation.Jobs
|
||||
{
|
||||
public class PartialInventoryUpdate : IAutomationJob
|
||||
{
|
||||
private readonly FtpService _ftpService;
|
||||
private readonly ILogger<PartialInventoryUpdate> _logger;
|
||||
private readonly string _connectionString;
|
||||
|
||||
public PartialInventoryUpdate(IConfiguration configuration, ILogger<PartialInventoryUpdate> logger)
|
||||
{
|
||||
FtpConfiguration ftpConfiguration = configuration.GetSection("FtpServers:AutomationConfiguration").Get<FtpConfiguration>();
|
||||
_ftpService = new FtpService(ftpConfiguration);
|
||||
|
||||
_connectionString = _connectionString = configuration.GetConnectionString("PartSourceDatabase");
|
||||
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -46,7 +49,7 @@ namespace PartSource.Automation.Jobs.POC
|
||||
|
||||
string file = _ftpService.Download($"{lastUploadedFile.Filename}");
|
||||
|
||||
using SqlConnection connection = new SqlConnection("Server=tcp:ps-whi.database.windows.net,1433;Initial Catalog=ps-whi-test;Persist Security Info=False;User ID=ps-whi;Password=9-^*N5dw!6:|.5Q;MultipleActiveResultSets=True;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;");
|
||||
using SqlConnection connection = new SqlConnection(_connectionString);
|
||||
connection.Open();
|
||||
|
||||
using StreamReader reader = new StreamReader(file);
|
||||
Reference in New Issue
Block a user