예제 #1
0
        SalesData CreateItem(int i)
        {
            SalesData item = new SalesData()
            {
                TargetSales = random.Next(1000000, 10000000)
            };

            item.Country = countries[i];
            CreateStatisticsByMonthlies(ref item);
            item.ActualSales                = allActualSales;
            item.TargetSales                = random.Next((int)(item.ActualSales / 2), (int)(item.ActualSales * 2));
            item.AverageMonthlySales        = allActualSales / 12;
            item.AverageMonthlyQuantitySold = allQuantitySold / 12;
            return(item);
        }
예제 #2
0
 void CreateStatisticsByMonthlies(ref SalesData item)
 {
     allActualSales                     = 0;
     allQuantitySold                    = 0;
     item.ActualSalesByMonthlies        = new List <double>();
     item.QuantitySoldByMonthlies       = new List <double>();
     item.QuantityTargetSellByMonthlies = new List <double>();
     for (int i = 0; i < 12; i++)
     {
         double actualSales = GetRandomValue();
         item.ActualSalesByMonthlies.Add(actualSales);
         double actuallQuantitySold = GetRandomValue();
         item.QuantitySoldByMonthlies.Add(actuallQuantitySold);
         item.QuantityTargetSellByMonthlies.Add(GetRandomValue());
         allActualSales  += actualSales;
         allQuantitySold += actuallQuantitySold;
     }
 }