This commit is contained in:
@@ -228,7 +228,7 @@ namespace AyaNova.Util
|
|||||||
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdmin | AuthorizationRoles.Service | AuthorizationRoles.Inventory | AuthorizationRoles.OpsAdmin, UserType.Service);
|
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdmin | AuthorizationRoles.Service | AuthorizationRoles.Inventory | AuthorizationRoles.OpsAdmin, UserType.Service);
|
||||||
//Generate one office person / secretary
|
//Generate one office person / secretary
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Service | AuthorizationRoles.Inventory | AuthorizationRoles.Accounting, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.Service | AuthorizationRoles.Inventory | AuthorizationRoles.Accounting, UserType.NotService);
|
||||||
// await SeedWidgetAsync(log, 3);//keeping this here for now but must remove later
|
// await SeedWidgetAsync(log, 3);//keeping this here for now but must remove later
|
||||||
await SeedCustomerAsync(log, 25);
|
await SeedCustomerAsync(log, 25);
|
||||||
await SeedHeadOfficeAsync(log, 10);
|
await SeedHeadOfficeAsync(log, 10);
|
||||||
await SeedVendorAsync(log, 10);
|
await SeedVendorAsync(log, 10);
|
||||||
@@ -564,8 +564,8 @@ namespace AyaNova.Util
|
|||||||
await SeedUserAsync(log, 1, AuthorizationRoles.InventoryRestricted, UserType.NotService, "InventoryRestricted", "InventoryRestricted", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.InventoryRestricted, UserType.NotService, "InventoryRestricted", "InventoryRestricted", KnownUserTags);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Inventory, UserType.NotService, "Inventory", "Inventory", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.Inventory, UserType.NotService, "Inventory", "Inventory", KnownUserTags);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Accounting, UserType.NotService, "Accounting", "Accounting", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.Accounting, UserType.NotService, "Accounting", "Accounting", KnownUserTags);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.TechRestricted, UserType.Service, "TechRestricted", "TechRestricted", KnownUserTags);
|
KnownUserTechRestrictedId = await SeedUserAsync(log, 1, AuthorizationRoles.TechRestricted, UserType.Service, "TechRestricted", "TechRestricted", KnownUserTags);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Tech, UserType.Service, "Tech", "Tech", KnownUserTags);
|
KnownUserTechId = await SeedUserAsync(log, 1, AuthorizationRoles.Tech, UserType.Service, "Tech", "Tech", KnownUserTags);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SalesRestricted, UserType.NotService, "SalesRestricted", "SalesRestricted", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.SalesRestricted, UserType.NotService, "SalesRestricted", "SalesRestricted", KnownUserTags);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Sales, UserType.NotService, "Sales", "Sales", KnownUserTags);
|
await SeedUserAsync(log, 1, AuthorizationRoles.Sales, UserType.NotService, "Sales", "Sales", KnownUserTags);
|
||||||
|
|
||||||
@@ -796,8 +796,8 @@ namespace AyaNova.Util
|
|||||||
throw new System.Exception(err);
|
throw new System.Exception(err);
|
||||||
}
|
}
|
||||||
//Known customer type users
|
//Known customer type users
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Customer, UserType.Customer, true, "Customer", "Customer", 0, KnownUserTags, null, NewObject.Id, null);
|
KnownUserCustomerId = await SeedUserAsync(log, 1, AuthorizationRoles.Customer, UserType.Customer, true, "Customer", "Customer", 0, KnownUserTags, null, NewObject.Id, null);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.Customer, UserType.Customer, true, "CustomerRestricted", "CustomerRestricted", 0, KnownUserTags, null, NewObject.Id, null);
|
KnownUserCustomerRestrictedId = await SeedUserAsync(log, 1, AuthorizationRoles.Customer, UserType.Customer, true, "CustomerRestricted", "CustomerRestricted", 0, KnownUserTags, null, NewObject.Id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -845,8 +845,8 @@ namespace AyaNova.Util
|
|||||||
VendorIdForSubContractorUser = NewObject.Id;
|
VendorIdForSubContractorUser = NewObject.Id;
|
||||||
|
|
||||||
}
|
}
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorRestricted, UserType.ServiceContractor, true, "SubContractorRestricted", "SubContractorRestricted", 0, KnownUserTags, VendorIdForSubContractorUser, null, null);
|
KnownUserSubContractorRestrictedId = await SeedUserAsync(log, 1, AuthorizationRoles.SubContractorRestricted, UserType.ServiceContractor, true, "SubContractorRestricted", "SubContractorRestricted", 0, KnownUserTags, VendorIdForSubContractorUser, null, null);
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.SubContractor, UserType.ServiceContractor, true, "SubContractor", "SubContractor", 0, KnownUserTags, VendorIdForSubContractorUser, null, null);
|
KnownUserSubContractorId = await SeedUserAsync(log, 1, AuthorizationRoles.SubContractor, UserType.ServiceContractor, true, "SubContractor", "SubContractor", 0, KnownUserTags, VendorIdForSubContractorUser, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1458,11 +1458,11 @@ namespace AyaNova.Util
|
|||||||
/// Generate seed user with active=true
|
/// Generate seed user with active=true
|
||||||
/// (override to save typing)
|
/// (override to save typing)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task SeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType, string login, string password, List<string> tags = null)
|
public async Task<long> SeedUserAsync(ILogger log, int count, AuthorizationRoles roles, UserType userType, string login, string password, List<string> tags = null)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await SeedUserAsync(log, count, roles, userType, true, login, password, 0, tags);
|
return await SeedUserAsync(log, count, roles, userType, true, login, password, 0, tags);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@@ -1475,6 +1475,13 @@ namespace AyaNova.Util
|
|||||||
public HashSet<string> HashUserNames = new HashSet<string>();
|
public HashSet<string> HashUserNames = new HashSet<string>();
|
||||||
public List<long> ServiceUserIds = new List<long>();
|
public List<long> ServiceUserIds = new List<long>();
|
||||||
private int TotalSeededUsers = 0;
|
private int TotalSeededUsers = 0;
|
||||||
|
public long KnownUserSubContractorId = 0;
|
||||||
|
public long KnownUserSubContractorRestrictedId = 0;
|
||||||
|
public long KnownUserTechId = 0;
|
||||||
|
public long KnownUserTechRestrictedId = 0;
|
||||||
|
public long KnownUserCustomerId = 0;
|
||||||
|
public long KnownUserCustomerRestrictedId = 0;
|
||||||
|
|
||||||
|
|
||||||
public async Task<long> SeedUserAsync(
|
public async Task<long> SeedUserAsync(
|
||||||
ILogger log, int count, AuthorizationRoles roles, UserType userType,
|
ILogger log, int count, AuthorizationRoles roles, UserType userType,
|
||||||
@@ -1545,10 +1552,9 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
UserBiz biz = UserBiz.GetBiz(ct);
|
UserBiz biz = UserBiz.GetBiz(ct);
|
||||||
var NewObject = await biz.CreateAsync(u);
|
var NewObject = await biz.CreateAsync(u);
|
||||||
if (u.UserType != UserType.NotService)
|
if (u.UserType == UserType.Service)
|
||||||
{
|
|
||||||
ServiceUserIds.Add(u.Id);
|
ServiceUserIds.Add(u.Id);
|
||||||
}
|
|
||||||
TotalSeededUsers++;
|
TotalSeededUsers++;
|
||||||
if (NewObject == null)
|
if (NewObject == null)
|
||||||
{
|
{
|
||||||
@@ -2141,17 +2147,17 @@ namespace AyaNova.Util
|
|||||||
o.Tags = RandomTags();
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
o.RateHour = Fake.Random.Decimal(1, 25);
|
o.RateHour = Fake.Random.Decimal(1, 25);
|
||||||
o.RateHourCost=o.RateHour/2;
|
o.RateHourCost = o.RateHour / 2;
|
||||||
o.RateHalfDay = o.RateHour * 4;
|
o.RateHalfDay = o.RateHour * 4;
|
||||||
o.RateHalfDayCost=o.RateHalfDay/2;
|
o.RateHalfDayCost = o.RateHalfDay / 2;
|
||||||
o.RateDay = o.RateHour * 8;
|
o.RateDay = o.RateHour * 8;
|
||||||
o.RateDayCost=o.RateDay/2;
|
o.RateDayCost = o.RateDay / 2;
|
||||||
o.RateWeek = o.RateHour * 36.8m;
|
o.RateWeek = o.RateHour * 36.8m;
|
||||||
o.RateWeekCost=o.RateWeek/2;
|
o.RateWeekCost = o.RateWeek / 2;
|
||||||
o.RateMonth = o.RateHour * 21 * 8;
|
o.RateMonth = o.RateHour * 21 * 8;
|
||||||
o.RateMonthCost=o.RateMonth/2;
|
o.RateMonthCost = o.RateMonth / 2;
|
||||||
o.RateYear = o.RateHour * 36.8m * 52;
|
o.RateYear = o.RateHour * 36.8m * 52;
|
||||||
o.RateYearCost=o.RateYear/2;
|
o.RateYearCost = o.RateYear / 2;
|
||||||
o.DefaultRate = Fake.Random.Enum<LoanUnitRateUnit>();
|
o.DefaultRate = Fake.Random.Enum<LoanUnitRateUnit>();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user