However, the problem i'm running into now is that it seems to constantly loop through these two ForEach loops. When i run it, the 'count' on both errorOrders & totalOrders is 38. The program loops through all 38 users just fine, but then it continues to loop through users again...re-doing the process that it just finished.
I'm looking to see if there is another way I could set this section up so that it only loops through users once. I was thinking about trying to create a 'Boolean flag' that would force the program out of the ForEach loop after it has run through all the users...but i'm sure there are other ways to handle this.
Expand|Select|Wrap|Line Numbers
- foreach (KeyValuePair<string, int> error in errorOrders)
- {
- foreach (KeyValuePair<string, int> total in totalOrders)
- {
- errPercentage = ((double)error.Value / (double)total.Value);
- Console.WriteLine("Percentage of errors for " + total.Key + ": " + Math.Round(errPercentage, 2) * 100 + "%");
- ordersPerHour = OrdersPerHour(total.Key);
- RandomOrders = RandomSelect(errPercentage, total.Key);
- Console.WriteLine("Number of orders pulled : " + RandomOrders.Rows.Count);
- //Print out orders randomly collected
- for (int i = 0; i < RandomOrders.Rows.Count; i++)
- {
- Console.WriteLine(RandomOrders.Rows[i]["ControlNumber"]);
- }
- Console.WriteLine("\r\n");
- //NumOrdersToPull = FindNumOrdersToPull(Math.Round(errPercentage,2), ordersPerHour);
- }
- }