private static Supplier GenerateSupplier(GeneratorContext context) { int id = (int)IdIterator.GetNextId(context.Description.Type); return(new Supplier() { SupplierId = id, Name = "Company " + id, Latitude = RandomPicker.Random.Next(75), Longitude = RandomPicker.Random.Next(75) }); }
private static PurchaseOrder GeneratePurchaseOrder(GeneratorContext context, Supplier supplier, Buyer buyer) { //accept offer based on distanse double distance = MathNet.Numerics.Distance.Euclidean( new[] { buyer.Longitude, buyer.Latitude }, new[] { supplier.Longitude, supplier.Latitude }); bool purchasePositive = distance <= 50; int id = (int)IdIterator.GetNextId(context.Description.Type); return(new PurchaseOrder() { PurchaseOrderId = id, SupplierId = supplier.SupplierId, BuyerId = buyer.BuyerId, Accepted = purchasePositive }); }