Beispiel #1
0
        }/*public bool IsKidsMeal()*/

        /// <summary>
        /// Checks if this meal has each type of item and if it does, add it to
        /// a list for returning.
        /// </summary>
        /// <remarks>
        /// NAME: CompilePricingOfOrders
        /// AUTHOR: Ryan Osgood
        /// DATE: 9/3/2019
        /// </remarks>
        /// <returns>
        /// A list of decimals that correspond to this meal's prices for each
        /// item in this meal
        /// </returns>
        public List <decimal> RetrieveMealPrices()
        {
            List <decimal> mealPricing = new List <decimal>();

            if (HasEntree())
            {
                mealPricing.Add(m_entree.CalculatePrice());
            }
            if (HasSide() && !IsKidsMeal())
            {
                mealPricing.Add(m_side.CalculatePrice());
            }
            if (HasBeverage() && !IsKidsMeal())
            {
                mealPricing.Add(m_beverage.CalculatePrice());
            }

            return(mealPricing);
        }/*public List<decimal> RetrieveMealPrices()*/
Beispiel #2
0
        }/*private void RadioButtonSelection_CheckedChanged(object sender, EventArgs e)*/

        /// <summary>
        /// This event is raised whenever the user selects a protein option. If a signature hasn't
        /// been selected yet, return. Otherwise, create the desired Entree object by retrieving
        /// the sandwiches attributes from the database.
        /// </summary>
        /// <remarks>
        /// NAME: BtnSignatureAndProteinSelection_Click
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/13/2019
        /// </remarks>
        /// <param name="sender">The button that raised this event</param>
        /// <param name="e">The EventArgs of the event</param>
        private void BtnSignatureAndProteinSelection_Click(object sender, EventArgs e)
        {
            if (m_selectedSignature == null)
            {
                return;
            }

            Button proteinButton = sender as Button;
            Entree signature     = new Entree();

            //On the menu, The Classic Signature is the only sandwich which recipe differs depending on the protein selection.
            //This feels like an iffy way to do it, but in the interest of keeping a generic method for ringing up a sandwich,
            //this is the best solution I could think of at the time I fleshed out this part of the project.

            if (proteinButton.Text.Equals("Grilled") && m_selectedSignature.Text.Equals("Classic Smash"))
            {
                //Since there is no "Classic Chicken" button, I just need to pass "ClassicChicken" so the db knows to get the chicken version of this signature
                signature.RetrieveAttributesFromDb("ClassicChicken");
                signature.RetrieveBasePriceFromDb("ClassicChicken");
            }
            else if (proteinButton.Text.Equals("Crispy") && m_selectedSignature.Text.Equals("Classic Smash"))
            {
                signature.RetrieveAttributesFromDb("ClassicCrispy");
                signature.RetrieveBasePriceFromDb("ClassicCrispy");
            }
            else
            {
                signature.RetrieveAttributesFromDb((string)m_selectedSignature.Tag);
                signature.RetrieveBasePriceFromDb((string)m_selectedSignature.Tag);
            }

            signature.SetProteinType(proteinButton.Text);
            AttributeModification atModForm = new AttributeModification(signature);

            atModForm.ShowDialog();

            m_customerChecks[m_currentlySelectedTab].CreateNewMealOrAddEntreeToMeal(signature);
            m_selectedSignature.Checked = false;
            m_selectedSignature         = null;
            Debug.WriteLine(signature.CalculatePrice());
            UpdateDisplay();
        }/*private void BtnSignatureAndProteinSelection_Click(object sender, EventArgs e)*/