From 4ed0aefd70ef0080ff6de0d4b68fec98edef9f73 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 24 May 2021 17:30:21 +0000 Subject: [PATCH] --- server/AyaNova/util/Seeder.cs | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index 43c814f2..f4a787f3 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -538,7 +538,7 @@ namespace AyaNova.Util //then it should figure out what 9am in a -7 time zone is in UTC //and return that value public DateTime DesiredTimeInUtc(DateTime dt) - { + { return dt.AddHours(0 - (double)TimeZoneOffset); } @@ -646,7 +646,7 @@ namespace AyaNova.Util c.ServiceRatesOverrideType = ContractOverrideType.PriceDiscount; c.TravelRatesOverridePct = 10; c.TravelRatesOverrideType = ContractOverrideType.PriceDiscount; - c.ResponseTime = new TimeSpan(48, 0, 0);//48 hour response time + c.ResponseTime = new TimeSpan(48, 0, 0);//48 hour response time c.ContractServiceRatesOnly = true; c.ServiceRateItems.Add(new ContractServiceRate() { ServiceRateId = 2 }); c.ContractTravelRatesOnly = true; @@ -2444,7 +2444,7 @@ namespace AyaNova.Util o.Notes = Fake.Lorem.Sentence(); o.Tags = RandomTags(); var tempDate = Fake.Date.Between(seedStartWindow, seedEndWindow); - var tempHour=Fake.Random.Int(9,17);//9am to 5 pm (except some times may be in different dst state so this will be out by an hour for example depending on time of year and time zone in question) + var tempHour = Fake.Random.Int(9, 17);//9am to 5 pm (except some times may be in different dst state so this will be out by an hour for example depending on time of year and time zone in question) var woDate = DesiredTimeInUtc(new DateTime(tempDate.Year, tempDate.Month, tempDate.Day, tempHour, 0, 0)); @@ -2497,8 +2497,8 @@ namespace AyaNova.Util Notes = $"itemnotes - {y} ", TechNotes = $"technotes - {y}", RequestDate = woDate.AddMinutes(y), - WorkorderItemPriorityId=Fake.Random.Long(1, 5),//there are 5 different sample priorities - WorkorderItemStatusId=Fake.Random.Long(1, 3)//there are 3 different sample woitem status + WorkorderItemPriorityId = Fake.Random.Long(1, 5),//there are 5 different sample priorities + WorkorderItemStatusId = Fake.Random.Long(1, 3)//there are 3 different sample woitem status }; //SCHEDULED USERS @@ -2527,12 +2527,12 @@ namespace AyaNova.Util //LABOR var woItemLabor = new WorkOrderItemLabor() { - UserId = RandomServiceTechUserId(), + UserId = RandomServiceTechUserId(), ServiceRateQuantity = 1, ServiceStartDate = woDate, ServiceStopDate = woDate.AddHours(1), - ServiceRateId=Fake.Random.Long(1, TotalSeededServiceRates), - ServiceDetails=Fake.Lorem.Sentence() + ServiceRateId = Fake.Random.Long(1, TotalSeededServiceRates), + ServiceDetails = Fake.Lorem.Sentence() }; woItem.Labors.Add(woItemLabor); @@ -2542,13 +2542,26 @@ namespace AyaNova.Util ServiceRateQuantity = 2, ServiceStartDate = woDate, ServiceStopDate = woDate.AddHours(1), - ServiceRateId=Fake.Random.Long(1, TotalSeededServiceRates), - ServiceDetails=Fake.Lorem.Sentence() + ServiceRateId = Fake.Random.Long(1, TotalSeededServiceRates), + ServiceDetails = Fake.Lorem.Sentence() }; woItem.Labors.Add(woItemLabor); + //TRAVEL + var woItemTravel = new WorkOrderItemTravel() + { + UserId = RandomServiceTechUserId(), + TravelRateQuantity = 1, + TravelStartDate = woDate, + TravelStopDate = woDate.AddHours(1), + TravelRateId = Fake.Random.Long(1, TotalSeededTravelRates), + TravelDetails = Fake.Lorem.Sentence(), + Distance = Fake.Random.Decimal(1.0m, 20.0m) + }; + woItem.Travels.Add(woItemTravel); + //EXPENSES var cost = Fake.Random.Decimal(1, 10);