diff --git a/.vscode/launch.json b/.vscode/launch.json
index c0f0d08d..cd448218 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -48,7 +48,7 @@
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
"AYANOVA_USE_URLS": "http://*:7575;",
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
- "AYANOVA_SERVER_TEST_MODE": "false",
+ "AYANOVA_SERVER_TEST_MODE": "true",
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"60",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
diff --git a/server/AyaNova/util/MoneyUtil.cs b/server/AyaNova/util/MoneyUtil.cs
index 7bfa3643..1b8940ae 100644
--- a/server/AyaNova/util/MoneyUtil.cs
+++ b/server/AyaNova/util/MoneyUtil.cs
@@ -11,10 +11,8 @@ namespace AyaNova.Util
///
///
///
- public static decimal Round(decimal d)
- {
- return Decimal.Round(d, 2, MidpointRounding.AwayFromZero);
- }
+ public static decimal Round(decimal d) => Decimal.Round(d, 2, MidpointRounding.AwayFromZero);
+
}//eoc
diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs
index caa95db5..de36eb30 100644
--- a/server/AyaNova/util/Seeder.cs
+++ b/server/AyaNova/util/Seeder.cs
@@ -540,8 +540,6 @@ namespace AyaNova.Util
}
-
-
private string[] TagSet = new[] { "red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown", "black", "white", "silver", "gold", "fuchsia", "jade", "mauve", "purple", "quince", "xanthic", "zebra", "zone0", "zone1", "zone2", "zone3", "zone4", "zone5", "zone6", "zone7", "zone8", "zone9" };
private List RandomTags()
@@ -896,7 +894,7 @@ namespace AyaNova.Util
o.WebAddress = Fake.Internet.Protocol() + "://example." + Fake.Internet.DomainSuffix();
o.EmailAddress = Fake.Internet.ExampleEmail();
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
VendorBiz biz = VendorBiz.GetBiz(ct);
@@ -1694,7 +1692,7 @@ namespace AyaNova.Util
gbiz.CustomerAllowNotifyWOCreated = true;
gbiz.CustomerAllowUserSettings = true;
gbiz.CustomerAllowViewWO = true;
- gbiz.CustomerDefaultWorkOrderReportId=SampleCustomerWorkOrderReportId;
+ gbiz.CustomerDefaultWorkOrderReportId = SampleCustomerWorkOrderReportId;
gbiz.CustomerAllowWOWiki = true;
gbiz.CustomerAllowWOAttachments = true;
@@ -1881,7 +1879,7 @@ namespace AyaNova.Util
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
CustomerBiz biz = CustomerBiz.GetBiz(ct);
@@ -1958,7 +1956,7 @@ namespace AyaNova.Util
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct);
@@ -2036,7 +2034,7 @@ namespace AyaNova.Util
o.WebAddress = Fake.Internet.Protocol() + "://example." + Fake.Internet.DomainSuffix();
o.EmailAddress = Fake.Internet.ExampleEmail();
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
VendorBiz biz = VendorBiz.GetBiz(ct);
@@ -2083,7 +2081,7 @@ namespace AyaNova.Util
o.ProjectOverseerId = Fake.Random.Long(2, 13);//NOTE: this is exactly 13 not total seeded users because it needs to be inside users and they're seeded first
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //This seems wrong to do in a loop but is 4 times faster this way
using (AyContext ct = ServiceProviderProvider.DBContext)
{
ProjectBiz biz = ProjectBiz.GetBiz(ct);
@@ -2128,13 +2126,13 @@ namespace AyaNova.Util
o.Notes = Fake.Lorem.Sentence(null, 3);
o.Tags = RandomTags();
- o.Cost = Fake.Random.Decimal(0.25m, 50);
- o.Charge = o.Cost * 1.55m;
+ o.Cost = MoneyUtil.Round(Fake.Random.Decimal(0.25m, 50));
+ o.Charge = MoneyUtil.Round(o.Cost * 1.55m);
o.Unit = "hour";
o.ContractOnly = contractOnly;
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct);
@@ -2178,13 +2176,13 @@ namespace AyaNova.Util
o.Notes = Fake.Lorem.Sentence(null, 3);
o.Tags = RandomTags();
- o.Cost = Fake.Random.Decimal(0.25m, 10);
- o.Charge = o.Cost * 2m;
+ o.Cost = MoneyUtil.Round(Fake.Random.Decimal(0.25m, 10));
+ o.Charge = MoneyUtil.Round(o.Cost * 2m);
o.Unit = Fake.PickRandom(Units);
o.ContractOnly = contractOnly;
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
TravelRateBiz biz = TravelRateBiz.GetBiz(ct);
@@ -2237,7 +2235,7 @@ namespace AyaNova.Util
o.WarrantyLength = Fake.PickRandom(WarrantyMonths);
o.WarrantyTerms = Fake.PickRandom(WarrantyTerms);
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
UnitModelBiz biz = UnitModelBiz.GetBiz(ct);
@@ -2337,7 +2335,7 @@ namespace AyaNova.Util
o.UnitHasOwnAddress = false;
}
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
UnitBiz biz = UnitBiz.GetBiz(ct);
@@ -2396,18 +2394,18 @@ namespace AyaNova.Util
o.Notes = Fake.Lorem.Sentence(null, 3);
o.Tags = RandomTags();
- o.RateHour = Fake.Random.Decimal(1, 25);
- o.RateHourCost = o.RateHour / 2;
- o.RateHalfDay = o.RateHour * 4;
- o.RateHalfDayCost = o.RateHalfDay / 2;
- o.RateDay = o.RateHour * 8;
- o.RateDayCost = o.RateDay / 2;
- o.RateWeek = o.RateHour * 36.8m;
- o.RateWeekCost = o.RateWeek / 2;
- o.RateMonth = o.RateHour * 21 * 8;
- o.RateMonthCost = o.RateMonth / 2;
- o.RateYear = o.RateHour * 36.8m * 52;
- o.RateYearCost = o.RateYear / 2;
+ o.RateHour = MoneyUtil.Round(Fake.Random.Decimal(1, 25));
+ o.RateHourCost = MoneyUtil.Round(o.RateHour / 2);
+ o.RateHalfDay = MoneyUtil.Round(o.RateHour * 4);
+ o.RateHalfDayCost = MoneyUtil.Round(o.RateHalfDay / 2);
+ o.RateDay = MoneyUtil.Round(o.RateHour * 8);
+ o.RateDayCost = MoneyUtil.Round(o.RateDay / 2);
+ o.RateWeek = MoneyUtil.Round(o.RateHour * 36.8m);
+ o.RateWeekCost = MoneyUtil.Round(o.RateWeek / 2);
+ o.RateMonth = MoneyUtil.Round(o.RateHour * 21 * 8);
+ o.RateMonthCost = MoneyUtil.Round(o.RateMonth / 2);
+ o.RateYear = MoneyUtil.Round(o.RateHour * 36.8m * 52);
+ o.RateYearCost = MoneyUtil.Round(o.RateYear / 2);
o.DefaultRate = Fake.Random.Enum();
@@ -2518,7 +2516,7 @@ namespace AyaNova.Util
o.Tags = RandomTags();
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
PartWarehouseBiz biz = PartWarehouseBiz.GetBiz(ct);
@@ -2570,13 +2568,13 @@ namespace AyaNova.Util
o.AlternativeWholeSalerId = Fake.Random.Long(7, 9);
o.AlternativeWholeSalerNumber = "aws-" + o.Name;
- o.Cost = Fake.Random.Decimal(1, 25);
- o.Retail = o.Cost * 1.2m;
+ o.Cost = MoneyUtil.Round(Fake.Random.Decimal(1, 25));
+ o.Retail = MoneyUtil.Round(o.Cost * 1.2m);
o.UnitOfMeasure = "each";
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
PartBiz biz = PartBiz.GetBiz(ct);
@@ -2678,7 +2676,7 @@ namespace AyaNova.Util
}
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
PartAssemblyBiz biz = PartAssemblyBiz.GetBiz(ct);
@@ -2744,7 +2742,7 @@ namespace AyaNova.Util
} while (partsAdded.Contains(partId));
partsAdded.Add(partId);
var qty = Fake.Random.Int(1, 5);
- var cost = Fake.Random.Decimal(1, 25);
+ var cost = MoneyUtil.Round(Fake.Random.Decimal(1, 25));
// 50% chance it has received serial numbers
string serials = string.Empty;
@@ -2774,7 +2772,7 @@ namespace AyaNova.Util
}
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
PurchaseOrderBiz biz = PurchaseOrderBiz.GetBiz(ct);
@@ -3187,7 +3185,7 @@ namespace AyaNova.Util
{
UserId = RandomServiceTechUserId(),
//TotalCost = cost,
- ChargeAmount = cost * 1.2m,
+ ChargeAmount = MoneyUtil.Round(cost * 1.2m),
ChargeToCustomer = true,
ReimburseUser = true,
ChargeTaxCodeId = TCGoods,
@@ -3200,7 +3198,7 @@ namespace AyaNova.Util
{
UserId = RandomServiceTechUserId(),
// TotalCost = cost * 2m,
- ChargeAmount = cost * 2.2m,
+ ChargeAmount = MoneyUtil.Round(cost * 2.2m),
ChargeToCustomer = true,
ReimburseUser = true,
ChargeTaxCodeId = TCGoods,
@@ -3214,8 +3212,8 @@ namespace AyaNova.Util
//OUTSIDE SERVICES
if (Fake.Random.Int(1, 10) == 2)//10% chance
{
- var ShippingCost = Fake.Random.Decimal(5, 20);
- var RepairCost = Fake.Random.Decimal(50, 1000);
+ var ShippingCost = MoneyUtil.Round(Fake.Random.Decimal(5, 20));
+ var RepairCost = MoneyUtil.Round(Fake.Random.Decimal(50, 1000));
var woItemOutsideService = new WorkOrderItemOutsideService()
{
UnitId = GetNextUnitForCustomer(o.CustomerId),
@@ -3225,9 +3223,9 @@ namespace AyaNova.Util
RMANumber = "RMA" + Fake.Finance.Account(6),
TrackingNumber = "TR" + Fake.Finance.Account(8),
RepairCost = RepairCost,
- RepairPrice = RepairCost * 1.5m,
+ RepairPrice = MoneyUtil.Round(RepairCost * 1.5m),
ShippingCost = ShippingCost,
- ShippingPrice = ShippingCost * 1.5m,
+ ShippingPrice = MoneyUtil.Round(ShippingCost * 1.5m),
SentDate = woDate,
ETADate = woDate.AddDays(7),
ReturnDate = woDate.AddDays(8),
@@ -3354,7 +3352,7 @@ namespace AyaNova.Util
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct);
@@ -3768,7 +3766,7 @@ namespace AyaNova.Util
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
QuoteBiz biz = QuoteBiz.GetBiz(ct);
@@ -4183,7 +4181,7 @@ namespace AyaNova.Util
- //This seems wrong to do in a loop but is 4 times faster this way ?!?
+ //intentional: tested and faster in loop
using (AyContext ct = ServiceProviderProvider.DBContext)
{
PMBiz biz = PMBiz.GetBiz(ct);