mirror of
https://github.com/stokebob/bnhtrade.git
synced 2026-05-18 19:48:23 +00:00
SP-API stock reconciliation
Amazon had depreciated a number of reports that were used for stock reconciliation. Application now uses the new fba ledger report to reconcile. It is currently untested, as this requires data from Amazon. Methods that require testing will return a 'NotImplementedException'. Also, removed the depreciated ILMerge and replaced with ILRepack. Plus much more tidying up, and improvements.
This commit is contained in:
@@ -12,7 +12,7 @@ namespace bnhtrade.Core.Logic.Validate
|
||||
|
||||
public new void Innit()
|
||||
{
|
||||
base.Innit();
|
||||
base.Init();
|
||||
stringCheck = new Logic.Utilities.StringCheck();
|
||||
}
|
||||
public bool IsValidAccountCodeId(int accountCode)
|
||||
|
||||
@@ -22,11 +22,11 @@ namespace bnhtrade.Core.Logic.Validate
|
||||
|
||||
public new void Innit()
|
||||
{
|
||||
base.Innit();
|
||||
timeCheck.Innit();
|
||||
stringCheck.Innit();
|
||||
base.Init();
|
||||
timeCheck.Init();
|
||||
stringCheck.Init();
|
||||
currencyCheck.Innit();
|
||||
decimalCheck.Innit();
|
||||
decimalCheck.Init();
|
||||
}
|
||||
|
||||
public bool IsValid(Model.Import.AmazonSettlement settlement)
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace bnhtrade.Core.Logic.Validate
|
||||
private Logic.Utilities.StringCheck stringCheck = new Logic.Utilities.StringCheck();
|
||||
public new void Innit()
|
||||
{
|
||||
base.Innit();
|
||||
base.Init();
|
||||
stringCheck = new Logic.Utilities.StringCheck();
|
||||
}
|
||||
public bool IsValidCurrencyCode(string currencyCode)
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace bnhtrade.Core.Logic.Validate
|
||||
{
|
||||
public static class Format
|
||||
{
|
||||
/// <summary>
|
||||
/// Validates that an sku number string is the correct format i.e. 000000-00
|
||||
/// </summary>
|
||||
/// <param name="skuNumber"></param>
|
||||
/// <returns></returns>
|
||||
public static bool SkuNumber(string skuNumber)
|
||||
{
|
||||
if (string.IsNullOrEmpty(skuNumber)) { return false;}
|
||||
|
||||
int count = 0;
|
||||
foreach (char c in skuNumber)
|
||||
{
|
||||
count++;
|
||||
if (count == 7)
|
||||
{
|
||||
string hyphen = "-";
|
||||
if (c != hyphen[0])
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (count > 9)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!char.IsNumber(c))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
count = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks the datetime is not default and is utc
|
||||
/// </summary>
|
||||
/// <param name="c"></param>
|
||||
/// <returns></returns>
|
||||
public static bool DateTime(DateTime dateTime)
|
||||
{
|
||||
if (dateTime == default(DateTime))
|
||||
{ return false; }
|
||||
else if (dateTime.Kind != DateTimeKind.Utc)
|
||||
{ return false; }
|
||||
else
|
||||
{ return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,12 +11,12 @@ namespace bnhtrade.Core.Logic.Validate
|
||||
{
|
||||
public SkuPriceInfo()
|
||||
{
|
||||
Innit();
|
||||
Init();
|
||||
}
|
||||
|
||||
public bool IsValidDatabaseCreate(List<Model.Sku.Price.PriceInfo> priceInfoList)
|
||||
{
|
||||
Innit();
|
||||
Init();
|
||||
|
||||
if (!IsValid(priceInfoList))
|
||||
{
|
||||
|
||||
@@ -19,24 +19,15 @@ namespace bnhtrade.Core.Logic.Validate
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < skuTransactionList.Count; i++)
|
||||
{
|
||||
if (!skuTransactionList[i].IsSetSkuTransactionId)
|
||||
{
|
||||
ValidationResultAdd("StockTransactionId is required");
|
||||
}
|
||||
}
|
||||
|
||||
return IsValidResult;
|
||||
}
|
||||
|
||||
public bool DatabaseInsert(Model.Stock.SkuTransaction skuTransaction)
|
||||
public bool DatabaseInsert(Model.Stock.SkuTransactionCreate skuTransaction)
|
||||
{
|
||||
return IsValid(new List<Model.Stock.SkuTransaction> { skuTransaction });
|
||||
return IsValid(new List<Model.Stock.SkuTransactionCreate> { skuTransaction });
|
||||
}
|
||||
|
||||
public bool DatabaseInsert(List<Model.Stock.SkuTransaction> skuTransactionList)
|
||||
public bool DatabaseInsert(List<Model.Stock.SkuTransactionCreate> skuTransactionList)
|
||||
{
|
||||
return IsValid(skuTransactionList);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace bnhtrade.Core.Logic.Validate
|
||||
}
|
||||
}
|
||||
|
||||
public void Innit()
|
||||
public void Init()
|
||||
{
|
||||
ValidationResult = new List<ValidationResult>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user