You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
39 lines
1.0 KiB
using Microsoft.Extensions.Configuration;
|
|
using Volo.Abp;
|
|
|
|
namespace Win_in.Sfs.Wms.DataExchange.Application.Iac.Qad;
|
|
|
|
public static class Validator
|
|
{
|
|
private static string VALID_SITES = ""; //T8
|
|
|
|
private static string VALID_COMPANY = ""; //T8
|
|
|
|
public static void CheckSite(IConfiguration configuration, string site)
|
|
{
|
|
if (string.IsNullOrEmpty(VALID_SITES))
|
|
{
|
|
var sites = configuration.GetValue<string>("Sites");
|
|
VALID_SITES = sites;
|
|
}
|
|
|
|
if (!VALID_SITES.Contains(site))
|
|
{
|
|
throw new UserFriendlyException($"Site must be in [{VALID_SITES}]");
|
|
}
|
|
}
|
|
|
|
public static void CheckCompany(IConfiguration configuration, string company)
|
|
{
|
|
if (string.IsNullOrEmpty(VALID_COMPANY))
|
|
{
|
|
var sites = configuration.GetValue<string>("Company");
|
|
VALID_COMPANY = sites;
|
|
}
|
|
|
|
if (!VALID_COMPANY.Contains(company))
|
|
{
|
|
throw new UserFriendlyException($"Company must be [{VALID_COMPANY}]");
|
|
}
|
|
}
|
|
}
|
|
|