jiargcnXPS
3 years ago
20 changed files with 102 additions and 12 deletions
@ -0,0 +1,28 @@ |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Linq.Dynamic.Core; |
|||
using Volo.Abp; |
|||
using Win_in.Sfs.Scp.v1.Domain; |
|||
|
|||
namespace Win_in.Sfs.Scp.WebApi; |
|||
|
|||
public static class Validator |
|||
{ |
|||
public const string VALID_SITES = "T8"; |
|||
|
|||
public static void CheckSite(string validSites,string site) |
|||
{ |
|||
if (!validSites.Contains(site) ) |
|||
{ |
|||
throw new UserFriendlyException($"Site must be in [{validSites}]"); |
|||
} |
|||
} |
|||
|
|||
public static void CheckSupplierCode(ITaVenderRepository taVenderRepository, string site, string supplierCode) |
|||
{ |
|||
if (!taVenderRepository.Any(p =>p.Site==site && p.VendId == supplierCode)) |
|||
{ |
|||
throw new UserFriendlyException($"Wrong supplier code: '{supplierCode}' of Site : '{site}'"); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue