This commit is contained in:
@@ -211,39 +211,21 @@ namespace AyaNova.Util
|
|||||||
await LogStatusAsync(JobId, LogJob, log, $"Seeding SMALL sample data....");
|
await LogStatusAsync(JobId, LogJob, log, $"Seeding SMALL sample data....");
|
||||||
var watch = new Stopwatch();
|
var watch = new Stopwatch();
|
||||||
watch.Start();
|
watch.Start();
|
||||||
|
|
||||||
//USERS
|
|
||||||
//Generate owner and lead tech
|
//Generate owner and lead tech
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Service);
|
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.OpsAdminFull, UserType.Service);
|
||||||
|
|
||||||
//Generate one office person / secretary
|
//Generate one office person / secretary
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryFull | AuthorizationRoles.AccountingFull, UserType.NotService);
|
||||||
|
|
||||||
//WIDGET
|
|
||||||
await SeedWidgetAsync(log, 100);
|
await SeedWidgetAsync(log, 100);
|
||||||
|
|
||||||
//CUSTOMERS
|
|
||||||
await SeedCustomerAsync(log, 100);
|
await SeedCustomerAsync(log, 100);
|
||||||
|
|
||||||
//HEAD-OFFICES
|
|
||||||
await SeedHeadOfficeAsync(log, 10);
|
await SeedHeadOfficeAsync(log, 10);
|
||||||
|
|
||||||
//VENDORS
|
|
||||||
await SeedVendorAsync(log, 25);
|
await SeedVendorAsync(log, 25);
|
||||||
|
|
||||||
//PROJECTS
|
|
||||||
await SeedProjectAsync(log, 25);
|
await SeedProjectAsync(log, 25);
|
||||||
|
|
||||||
//RATES
|
|
||||||
await SeedServiceRateAsync(log, 5);
|
await SeedServiceRateAsync(log, 5);
|
||||||
await SeedTravelRateAsync(log, 3);
|
await SeedTravelRateAsync(log, 3);
|
||||||
|
|
||||||
//UNITMODELS
|
|
||||||
await SeedUnitModelAsync(log, 10);
|
await SeedUnitModelAsync(log, 10);
|
||||||
|
|
||||||
//UNITS
|
|
||||||
await SeedUnitAsync(log, 500);//5 times the customers or 5 units per customer
|
await SeedUnitAsync(log, 500);//5 times the customers or 5 units per customer
|
||||||
|
await SeedLoanLoanUnitAsync(log,5);
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -262,63 +244,37 @@ namespace AyaNova.Util
|
|||||||
var watch = new Stopwatch();
|
var watch = new Stopwatch();
|
||||||
watch.Start();
|
watch.Start();
|
||||||
|
|
||||||
//USERS
|
|
||||||
//One IT administrator, can change ops but nothing else
|
//One IT administrator, can change ops but nothing else
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.OpsAdminFull, UserType.NotService);
|
||||||
|
|
||||||
//One business administrator, can view ops issues
|
//One business administrator, can view ops issues
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
//One owner who doesn't control anything but views stuff
|
//One owner who doesn't control anything but views stuff
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited | AuthorizationRoles.SalesLimited, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited | AuthorizationRoles.SalesLimited, UserType.NotService);
|
||||||
|
|
||||||
//20 techs
|
//20 techs
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service);
|
await SeedUserAsync(log, 20, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service);
|
||||||
|
|
||||||
//2 subcontractors
|
//2 subcontractors
|
||||||
await SeedUserAsync(log, 2, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor);
|
await SeedUserAsync(log, 2, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor);
|
||||||
|
|
||||||
//3 generic office people people
|
//3 generic office people people
|
||||||
await SeedUserAsync(log, 3, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 3, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//2 Full sales people
|
//2 Full sales people
|
||||||
await SeedUserAsync(log, 2, AuthorizationRoles.SalesFull, UserType.NotService);
|
await SeedUserAsync(log, 2, AuthorizationRoles.SalesFull, UserType.NotService);
|
||||||
|
|
||||||
//1 dispatch manager
|
//1 dispatch manager
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//1 Inventory manager
|
//1 Inventory manager
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NotService);
|
||||||
|
|
||||||
//1 accountant / bookkeeper
|
//1 accountant / bookkeeper
|
||||||
await SeedUserAsync(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 1, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
|
|
||||||
//WIDGETS
|
|
||||||
await SeedWidgetAsync(log, 100);
|
await SeedWidgetAsync(log, 100);
|
||||||
|
|
||||||
//CUSTOMERS
|
|
||||||
await SeedCustomerAsync(log, 500);
|
await SeedCustomerAsync(log, 500);
|
||||||
|
|
||||||
//HEAD-OFFICES
|
|
||||||
await SeedHeadOfficeAsync(log, 20);
|
await SeedHeadOfficeAsync(log, 20);
|
||||||
|
|
||||||
//VENDORS
|
|
||||||
await SeedVendorAsync(log, 50);
|
await SeedVendorAsync(log, 50);
|
||||||
|
|
||||||
//PROJECTS
|
|
||||||
await SeedProjectAsync(log, 50);
|
await SeedProjectAsync(log, 50);
|
||||||
|
|
||||||
//RATES
|
|
||||||
await SeedServiceRateAsync(log, 10);
|
await SeedServiceRateAsync(log, 10);
|
||||||
await SeedTravelRateAsync(log, 5);
|
await SeedTravelRateAsync(log, 5);
|
||||||
|
|
||||||
//UNITMODELS
|
|
||||||
await SeedUnitModelAsync(log, 25);
|
await SeedUnitModelAsync(log, 25);
|
||||||
|
await SeedUnitAsync(log, 2500);//5 times the customers or 5 units per customer
|
||||||
|
await SeedLoanLoanUnitAsync(log,10);
|
||||||
//UNITS
|
|
||||||
await SeedUnitAsync(log, 2500);//5 times the customers or 5 units per customer
|
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -338,75 +294,46 @@ namespace AyaNova.Util
|
|||||||
var watch = new Stopwatch();
|
var watch = new Stopwatch();
|
||||||
watch.Start();
|
watch.Start();
|
||||||
|
|
||||||
|
|
||||||
//USERS
|
//USERS
|
||||||
//IT administrator, can change ops but nothing else
|
//IT administrator, can change ops but nothing else
|
||||||
await SeedUserAsync(log, 2, AuthorizationRoles.OpsAdminFull, UserType.NotService);
|
await SeedUserAsync(log, 2, AuthorizationRoles.OpsAdminFull, UserType.NotService);
|
||||||
|
|
||||||
//business administrator, can view ops issues
|
//business administrator, can view ops issues
|
||||||
await SeedUserAsync(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 2, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
//owner / upper management who doesn't control anything but views stuff
|
//owner / upper management who doesn't control anything but views stuff
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
//100 techs
|
//100 techs
|
||||||
await SeedUserAsync(log, 100, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service);
|
await SeedUserAsync(log, 100, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service);
|
||||||
|
|
||||||
//limited techs
|
//limited techs
|
||||||
await SeedUserAsync(log, 50, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Service);
|
await SeedUserAsync(log, 50, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Service);
|
||||||
|
|
||||||
//20 subcontractors
|
//20 subcontractors
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor);
|
await SeedUserAsync(log, 20, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor);
|
||||||
|
|
||||||
//10 limited subcontractors
|
//10 limited subcontractors
|
||||||
await SeedUserAsync(log, 10, AuthorizationRoles.SubContractorLimited, UserType.ServiceContractor);
|
await SeedUserAsync(log, 10, AuthorizationRoles.SubContractorLimited, UserType.ServiceContractor);
|
||||||
|
|
||||||
//30 generic office people people
|
//30 generic office people people
|
||||||
await SeedUserAsync(log, 30, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 30, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//10 Full sales people
|
//10 Full sales people
|
||||||
await SeedUserAsync(log, 10, AuthorizationRoles.SalesFull, UserType.NotService);
|
await SeedUserAsync(log, 10, AuthorizationRoles.SalesFull, UserType.NotService);
|
||||||
|
|
||||||
//5 Limited sales people
|
//5 Limited sales people
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.SalesLimited, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.SalesLimited, UserType.NotService);
|
||||||
|
|
||||||
//5 dispatch manager
|
//5 dispatch manager
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//5 Inventory manager
|
//5 Inventory manager
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NotService);
|
||||||
|
|
||||||
//10 Inventory manager assistants
|
//10 Inventory manager assistants
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//5 accountant / bookkeeper
|
//5 accountant / bookkeeper
|
||||||
await SeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 5, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
//WIDGETS
|
|
||||||
await SeedWidgetAsync(log, 100);
|
await SeedWidgetAsync(log, 100);
|
||||||
|
|
||||||
//CUSTOMERS
|
|
||||||
await SeedCustomerAsync(log, 5000);
|
await SeedCustomerAsync(log, 5000);
|
||||||
|
|
||||||
//HEAD-OFFICES
|
|
||||||
await SeedHeadOfficeAsync(log, 30);
|
await SeedHeadOfficeAsync(log, 30);
|
||||||
|
|
||||||
//VENDORS
|
|
||||||
await SeedVendorAsync(log, 75);
|
await SeedVendorAsync(log, 75);
|
||||||
|
|
||||||
//PROJECTS
|
|
||||||
await SeedProjectAsync(log, 75);
|
await SeedProjectAsync(log, 75);
|
||||||
|
|
||||||
//RATES
|
|
||||||
await SeedServiceRateAsync(log, 20);
|
await SeedServiceRateAsync(log, 20);
|
||||||
await SeedTravelRateAsync(log, 10);
|
await SeedTravelRateAsync(log, 10);
|
||||||
|
|
||||||
//UNITMODELS
|
|
||||||
await SeedUnitModelAsync(log, 30);
|
await SeedUnitModelAsync(log, 30);
|
||||||
|
await SeedUnitAsync(log, 25000);//5 times the customers or 5 units per customer
|
||||||
|
await SeedLoanLoanUnitAsync(log,15);
|
||||||
//UNITS
|
|
||||||
await SeedUnitAsync(log, 25000);//5 times the customers or 5 units per customer
|
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -430,70 +357,43 @@ namespace AyaNova.Util
|
|||||||
//USERS
|
//USERS
|
||||||
//IT administrator, can change ops but nothing else
|
//IT administrator, can change ops but nothing else
|
||||||
await SeedUserAsync(log, 10, AuthorizationRoles.OpsAdminFull, UserType.NotService);
|
await SeedUserAsync(log, 10, AuthorizationRoles.OpsAdminFull, UserType.NotService);
|
||||||
|
|
||||||
//business administrator, can view ops issues
|
//business administrator, can view ops issues
|
||||||
await SeedUserAsync(log, 10, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 10, AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
//owner / upper management who doesn't control anything but views stuff
|
//owner / upper management who doesn't control anything but views stuff
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 20, AuthorizationRoles.BizAdminLimited | AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
//regular techs
|
//regular techs
|
||||||
await SeedUserAsync(log, 500, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service);
|
await SeedUserAsync(log, 500, AuthorizationRoles.TechFull | AuthorizationRoles.DispatchLimited, UserType.Service);
|
||||||
|
|
||||||
//limited techs
|
//limited techs
|
||||||
await SeedUserAsync(log, 200, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Service);
|
await SeedUserAsync(log, 200, AuthorizationRoles.TechLimited | AuthorizationRoles.DispatchLimited, UserType.Service);
|
||||||
|
|
||||||
//subcontractors
|
//subcontractors
|
||||||
await SeedUserAsync(log, 80, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor);
|
await SeedUserAsync(log, 80, AuthorizationRoles.SubContractorFull, UserType.ServiceContractor);
|
||||||
|
|
||||||
//limited subcontractors
|
//limited subcontractors
|
||||||
await SeedUserAsync(log, 40, AuthorizationRoles.SubContractorLimited, UserType.ServiceContractor);
|
await SeedUserAsync(log, 40, AuthorizationRoles.SubContractorLimited, UserType.ServiceContractor);
|
||||||
|
|
||||||
//generic office people people
|
//generic office people people
|
||||||
await SeedUserAsync(log, 200, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 200, AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//20 Full sales people
|
//20 Full sales people
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.SalesFull, UserType.NotService);
|
await SeedUserAsync(log, 20, AuthorizationRoles.SalesFull, UserType.NotService);
|
||||||
|
|
||||||
//10 Limited sales people
|
//10 Limited sales people
|
||||||
await SeedUserAsync(log, 10, AuthorizationRoles.SalesLimited, UserType.NotService);
|
await SeedUserAsync(log, 10, AuthorizationRoles.SalesLimited, UserType.NotService);
|
||||||
|
|
||||||
//dispatch manager
|
//dispatch manager
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 20, AuthorizationRoles.DispatchFull | AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//Inventory manager
|
//Inventory manager
|
||||||
await SeedUserAsync(log, 40, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NotService);
|
await SeedUserAsync(log, 40, AuthorizationRoles.InventoryFull | AuthorizationRoles.DispatchLimited, UserType.NotService);
|
||||||
|
|
||||||
//Inventory manager assistants
|
//Inventory manager assistants
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.InventoryLimited, UserType.NotService);
|
await SeedUserAsync(log, 20, AuthorizationRoles.InventoryLimited, UserType.NotService);
|
||||||
|
|
||||||
//accountant / bookkeeper
|
//accountant / bookkeeper
|
||||||
await SeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
await SeedUserAsync(log, 20, AuthorizationRoles.AccountingFull | AuthorizationRoles.BizAdminLimited, UserType.NotService);
|
||||||
|
|
||||||
//WIDGETS
|
|
||||||
await SeedWidgetAsync(log, 100);
|
await SeedWidgetAsync(log, 100);
|
||||||
|
|
||||||
//CUSTOMERS
|
|
||||||
await SeedCustomerAsync(log, 20000);
|
await SeedCustomerAsync(log, 20000);
|
||||||
|
|
||||||
//HEAD-OFFICES
|
|
||||||
await SeedHeadOfficeAsync(log, 40);
|
await SeedHeadOfficeAsync(log, 40);
|
||||||
|
|
||||||
//VENDORS
|
|
||||||
await SeedVendorAsync(log, 100);
|
await SeedVendorAsync(log, 100);
|
||||||
|
|
||||||
//PROJECTS
|
|
||||||
await SeedProjectAsync(log, 500);
|
await SeedProjectAsync(log, 500);
|
||||||
|
|
||||||
//RATES
|
|
||||||
await SeedServiceRateAsync(log, 30);
|
await SeedServiceRateAsync(log, 30);
|
||||||
await SeedTravelRateAsync(log, 15);
|
await SeedTravelRateAsync(log, 15);
|
||||||
|
|
||||||
//UNITMODELS
|
|
||||||
await SeedUnitModelAsync(log, 40);
|
await SeedUnitModelAsync(log, 40);
|
||||||
|
await SeedUnitAsync(log, 100000);//5 times the customers or 5 units per customer
|
||||||
//UNITS
|
await SeedLoanLoanUnitAsync(log, 20);
|
||||||
await SeedUnitAsync(log, 100000);//5 times the customers or 5 units per customer
|
|
||||||
|
|
||||||
//PERF
|
//PERF
|
||||||
watch.Stop();
|
watch.Stop();
|
||||||
@@ -1435,17 +1335,17 @@ namespace AyaNova.Util
|
|||||||
o.PurchasedFromVendorId = Fake.Random.Long(1, TotalSeededVendors);
|
o.PurchasedFromVendorId = Fake.Random.Long(1, TotalSeededVendors);
|
||||||
}
|
}
|
||||||
|
|
||||||
o.Receipt=Fake.Finance.Account(6);
|
o.Receipt = Fake.Finance.Account(6);
|
||||||
o.PurchasedDate=Fake.Date.Between(seedStartWindow, DateTime.Now).ToUniversalTime();
|
o.PurchasedDate = Fake.Date.Between(seedStartWindow, DateTime.Now).ToUniversalTime();
|
||||||
o.Description=Fake.Commerce.ProductName();
|
o.Description = Fake.Commerce.ProductName();
|
||||||
o.ReplacedByUnitId=null;
|
o.ReplacedByUnitId = null;
|
||||||
//for now no banked units in seeds
|
//for now no banked units in seeds
|
||||||
o.UsesBanking=false;
|
o.UsesBanking = false;
|
||||||
o.Metered=false;//for now no meters either
|
o.Metered = false;//for now no meters either
|
||||||
o.Text1=null;
|
o.Text1 = null;
|
||||||
o.Text2=null;
|
o.Text2 = null;
|
||||||
o.Text3=null;
|
o.Text3 = null;
|
||||||
o.Text4=null;
|
o.Text4 = null;
|
||||||
|
|
||||||
//Unit has own address 5% chance (1/20)
|
//Unit has own address 5% chance (1/20)
|
||||||
if (Fake.Random.Number(1, 20) == 5)
|
if (Fake.Random.Number(1, 20) == 5)
|
||||||
@@ -1480,6 +1380,60 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private int TotalSeededLoanUnits = 0;
|
||||||
|
//////////////////////////////////////////////////////
|
||||||
|
//LOANUNIT
|
||||||
|
//
|
||||||
|
public async Task SeedLoanLoanUnitAsync(ILogger log, int count)
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int x = 0; x < count; x++)
|
||||||
|
{
|
||||||
|
LoanUnit o = new LoanUnit();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
o.Serial = Fake.Finance.Account();
|
||||||
|
} while (!HashUnitNames.Add(o.Serial));
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
o.Name = Fake.Commerce.ProductName();
|
||||||
|
} while (!HashUnitNames.Add(o.Name));
|
||||||
|
|
||||||
|
|
||||||
|
o.Active = true;
|
||||||
|
o.Notes = Fake.Lorem.Sentence();
|
||||||
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
|
o.RateHour = Fake.Random.Decimal(1, 25);
|
||||||
|
o.RateHalfDay = o.RateHour * 4;
|
||||||
|
o.RateDay = o.RateHour * 8;
|
||||||
|
o.RateWeek = o.RateHour * 36.8m;
|
||||||
|
o.RateMonth = o.RateHour * 21 * 8;
|
||||||
|
o.RateYear = o.RateHour * 36.8m * 52;
|
||||||
|
o.DefaultRate=Fake.Random.Enum<LoanUnitRateUnit>();
|
||||||
|
|
||||||
|
|
||||||
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
|
{
|
||||||
|
LoanUnitBiz biz = LoanUnitBiz.GetBiz(ct);
|
||||||
|
var NewObject = await biz.CreateAsync(o);
|
||||||
|
TotalSeededLoanUnits++;
|
||||||
|
if (NewObject == null)
|
||||||
|
{
|
||||||
|
var err = $"Seeder::SeedLoanUnit error creating {o.Serial}\r\n{biz.GetErrorsAsString()}";
|
||||||
|
log.LogError(err);
|
||||||
|
throw new System.Exception(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|||||||
Reference in New Issue
Block a user