private static IList <CustomerOrder> GenerateCustomerOrders(int maxNumberOfProducts, int maxNumberOfOrders, int maxNumberOfCustomers, int maxQuantityPerOrder, int maxTotalQuantityPerProduct, ProgressStatus status, System.Action <string> progressChanged, string operation)
        {
            List <CustomerOrder> records = new List <CustomerOrder>();
            Random random           = new Random(DateTime.Now.Millisecond);
            int    numberOfProducts = (int)(random.NextDouble() * maxNumberOfProducts);
            int    total            = 0;

            for (int iOrder = 1, iProduct = 1; iOrder <= maxNumberOfOrders && iProduct <= numberOfProducts; iOrder++)
            {
                int quantity = (int)(random.NextDouble() * maxQuantityPerOrder);
                total += quantity;
                if (total > maxTotalQuantityPerProduct)
                {
                    total = quantity;
                    iProduct++;
                }
                records.Add(new CustomerOrder()
                {
                    OrderID    = iOrder,
                    CustomerID = random.Next() % maxNumberOfCustomers + 1,
                    ItemName   = "Product" + iProduct,
                    Quantity   = quantity
                });
                status.CustomerOrderCount++;
            }
            return(records);
        }
        private static IList <FactoryShipment> GenerateFactoryShipments(int maxNumberOfProducts, int maxTotalQuantityPerProduct, ProgressStatus status, System.Action <string> progressChanged, string operation)
        {
            List <FactoryShipment> records = new List <FactoryShipment>();
            Random random           = new Random(DateTime.Now.Millisecond);
            int    numberOfProducts = (int)(random.NextDouble() * maxNumberOfProducts);

            for (int iProduct = 1; iProduct <= numberOfProducts; iProduct++)
            {
                string product     = "Product" + iProduct;
                int    maxQuantity = (int)(random.NextDouble() * maxTotalQuantityPerProduct);
                var    total       = 0;
                if (maxQuantity > 0)
                {
                    while (total < maxQuantity)
                    {
                        int quantity = Math.Max((int)(random.NextDouble() * maxQuantity), 1);
                        records.Add(new FactoryShipment()
                        {
                            ItemName = product,
                            Quantity = quantity
                        });
                        total += quantity;
                        status.FactoryShipmentCount++;
                    }
                }
            }
            return(records);
        }