Files
bnhtrade/src/bnhtrade.Core/Logic/Validate/Format.cs
Bobbie Hodgetts 91ef9acc78 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.
2024-05-07 08:24:00 +01:00

61 lines
1.6 KiB
C#

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; }
}
}
}