private string ConvertOrderHashToString(Dictionary <KeyValuePair <Enums.TimeOfDay, Enums.DishType>, int> orderHash,
                                                Enums.TimeOfDay timeOfDay, bool error)
        {
            string output = string.Empty;

            // We know time from input, so only loop through the dishTypes in order
            foreach (Enums.DishType dishType in Enum.GetValues(typeof(Enums.DishType)))
            {
                var dish = new KeyValuePair <Enums.TimeOfDay, Enums.DishType>(timeOfDay, dishType);
                if (orderHash.ContainsKey(dish))
                {
                    output += dishesAvailable[dish];
                    if (orderHash[dish] > 1)
                    {
                        output += "(x" + orderHash[dish] + ")";
                    }
                    output += ", ";
                }
            }

            if (error)
            {
                output += "error";
            }

            // Delete last comma in series before returning.
            else if (output.EndsWith(", ") == true)
            {
                output = output.Substring(0, output.Length - 2);
            }

            return(output);
        }
Esempio n. 2
0
 /// <summary>
 /// Sets the dish's properties based on time of day parameter.
 /// </summary>
 /// <param name="timeOfDay">The time of day value.</param>
 public void SetDishes(Enums.TimeOfDay timeOfDay)
 {
     if (timeOfDay == Enums.TimeOfDay.Morning)
     {
         Entree  = MORNING_ENTREE;
         Side    = MORNING_SIDE;
         Drink   = MORNING_DRINK;
         Dessert = MORNING_DESSERT;
     }
     else if (timeOfDay == Enums.TimeOfDay.Night)
     {
         Entree  = NIGHT_ENTREE;
         Side    = NIGHT_SIDE;
         Drink   = NIGHT_DRINK;
         Dessert = NIGHT_DESSERT;
     }
     else
     {
         Entree  = "";
         Side    = "";
         Drink   = "";
         Dessert = "";
     }
 }
Esempio n. 3
0
 /// <summary>
 /// Sets the time of day property.
 /// </summary>
 /// <param name="timeOfDay">TimeOfDay enum value.</param>
 public void SetTimeOfDay(Enums.TimeOfDay timeOfDay)
 {
     TimeOfDay = timeOfDay;
 }