This commit is contained in:
2021-05-03 17:37:43 +00:00
parent 8e004be55c
commit f0db66a0fa
7 changed files with 39 additions and 6 deletions

View File

@@ -2236,6 +2236,39 @@ namespace AyaNova.Util
o.CompleteByDate = woDate.AddDays(5).ToUniversalTime();
o.CustomerContactName = "contact name here";
o.CustomerId = Fake.Random.Long(1, TotalSeededCustomers);
using (AyContext ct = ServiceProviderProvider.DBContext)
{
var cust = await ct.Customer.AsNoTracking().FirstAsync(z => z.Id == o.CustomerId);
o.Latitude = cust.Latitude;
o.Longitude = cust.Longitude;
o.Address = cust.Address;
o.City = cust.City;
o.Region = cust.Region;
o.Country = cust.Country;
if (cust.BillHeadOffice && cust.HeadOfficeId != null)
{
var head = await ct.HeadOffice.AsNoTracking().FirstAsync(z => z.Id == cust.HeadOfficeId);
o.PostAddress = head.PostAddress;
o.PostCity = head.PostCity;
o.PostRegion = head.PostRegion;
o.PostCountry = head.PostCountry;
o.PostCode = head.PostCode;
}
else
{
o.PostAddress = cust.PostAddress;
o.PostCity = cust.PostCity;
o.PostRegion = cust.PostRegion;
o.PostCountry = cust.PostCountry;
o.PostCode = cust.PostCode;
}
}
o.CustomerReferenceNumber = "crf-" + Fake.Finance.Account(4);
o.InternalReferenceNumber = "irf-" + Fake.Finance.Account(4);
o.ServiceDate = woDate.ToUniversalTime();