Updated timestamp string format

This commit is contained in:
2025-06-03 09:39:46 -04:00
parent 1ddf18a400
commit 0ce0dc35e1
5 changed files with 12 additions and 10 deletions

View File

@@ -74,7 +74,7 @@ namespace PartSource.Automation.Jobs
dataTable.Columns.Add("Store", typeof(int));
dataTable.Columns.Add("SKU", typeof(string));
dataTable.Columns.Add("QTY", typeof(int));
dataTable.Columns.Add("Updated", typeof(DateTime));
dataTable.Columns.Add("Updated", typeof(string));
using StreamReader reader = new StreamReader(filename);
string line = reader.ReadLine(); // Burn the header row
@@ -90,10 +90,12 @@ namespace PartSource.Automation.Jobs
}
string sku = columns[1].Trim();
string updated = columns[3].Trim();
if (int.TryParse(columns[0], out int store)
&& !string.IsNullOrEmpty(sku)
&& int.TryParse(columns[2], out int quantity)
&& DateTime.TryParse(columns[3], out DateTime updated))
&& string.IsNullOrEmpty(updated))
{
dataTable.Rows.Add(new object[] { store, sku, quantity, updated });
}

View File

@@ -69,11 +69,13 @@ namespace PartSource.Automation.Jobs
{
columns[j] = columns[j].Replace("\"", string.Empty);
}
string sku = columns[1].Trim();
string updated = columns[3].Trim();
if (int.TryParse(columns[0], out int store)
&& int.TryParse(columns[1], out int sku)
&& !string.IsNullOrEmpty(sku)
&& int.TryParse(columns[2], out int quantity)
&& DateTime.TryParse(columns[3], out DateTime updated))
&& string.IsNullOrEmpty(updated))
{
command += $"UPDATE PartAvailability SET QTY = @qty_{i}, Updated = @updated_{i} WHERE SKU = @sku_{i} AND Store = @store_{i};";