This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user