Exemplo n.º 1
0
 public static string GetToppingDisplayName(ToppingName toppingName)
 {
     if (DisplayToppingNameDictionary.ContainsKey(toppingName))
     {
         return(DisplayToppingNameDictionary[toppingName]);
     }
     return("Not in Dictionary Yet");
 }
Exemplo n.º 2
0
 public static decimal GetDbItemId(ToppingName toppingName)
 {
     if (DataBaseDictionaries.ToppingDbIdDictionary.ContainsKey(toppingName))
     {
         return(DataBaseDictionaries.ToppingDbIdDictionary[toppingName]);
     }
     Console.WriteLine("***Debug JOANNE***TOPPINGS DICTIONARY ITEM NOT FOUND: " + toppingName);
     return(0);
 }
Exemplo n.º 3
0
 public bool CurrentToppingsHas(ToppingName toppingName)
 {
     foreach (var topping in CurrentToppings)
     {
         if (toppingName == topping.ToppingName)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 4
0
 public bool IsToppingAlreadyAdded(ToppingName toppingName)
 {
     foreach (var topping in CurrentToppings)
     {
         if (topping.ToppingName == toppingName)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
 public void ChangeToppingToHalf(ToppingName toppingName, ToppingWholeHalf toppingHalf)
 {
     foreach (var topping in CurrentToppings)
     {
         if (topping.ToppingName == toppingName)
         {
             topping.ToppingWholeHalf = toppingHalf;
             break;
         }
     }
     UpdateToppingsTotal();
 }
Exemplo n.º 6
0
 public Topping(ToppingName toppingName, ToppingWholeHalf toppingWholeHalf = ToppingWholeHalf.Whole)
 {
     ToppingName      = toppingName;
     toppingModifier  = ToppingModifierType.None;
     ToppingWholeHalf = toppingWholeHalf;
     Count            = 1;
     ForPizza         = true;
     ForSalad         = false;
     ForCalzone       = true;
     ForTakeout       = false;
     if (toppingWholeHalf != ToppingWholeHalf.Whole)
     {
         ChangeToppingDisplayNameHalf(toppingWholeHalf);
     }
     DbItemId           = Toppings.GetDbItemId(toppingName);
     SpecialPricingType = SpecialPricingType.DefaultOneTopping;
 }
Exemplo n.º 7
0
        public void RemoveTopping(ToppingName toppingName, bool calculateTotal = true)
        {
            int indexToRemove = 99;

            foreach (var topping in CurrentToppings)
            {
                if (topping.ToppingName == toppingName)
                {
                    //Can't remove an item from a list you are currently iterating through.
                    indexToRemove = CurrentToppings.IndexOf(topping);
                    break;
                }
            }
            if (indexToRemove != 99)
            {
                CurrentToppings.RemoveAt(indexToRemove);
            }
            if (calculateTotal)
            {
                ToppingsTotal = GetCurrentToppingsCost();
            }
        }
Exemplo n.º 8
0
 public Topping(ToppingName toppingName, ToppingWholeHalf toppingWholeHalf = ToppingWholeHalf.Whole)
 {
     ToppingName        = toppingName;
     ToppingWholeHalf   = toppingWholeHalf;
     ToppingDisplayName = DisplayNames.GetToppingDisplayName(toppingName);
 }