}/*public KidsMealModification(KidsMeal a_kidsMeals) : this()*/

        /// <summary>
        /// Performs the view formatting for the kids meal.
        /// Displays the entree, side and beverage to the ListBox.
        /// </summary>
        /// <remarks>
        /// NAME: PerformViewFormatting
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/15/2019
        /// </remarks>
        private void PerformViewFormatting()
        {
            m_kidsAttributes.Clear();
            m_mealView.FillMealDisplay();
            m_kidsAttributes = m_mealView.GetDisplay();
            for (int i = 0; i < m_kidsAttributes.Count; i++)
            {
                if (m_kidsAttributes[i].Equals("~"))
                {
                    m_kidsAttributes.RemoveAt(i);
                }
            }
        }/*private void PerformViewFormatting()*/
        } /*public KidsMealModification()*/

        /// <summary>
        /// A constructor for the KidsMealModification. Inherits from the default constructor.
        /// Passes in a KidsMeal and initializes the members that are vital
        /// to the ability to modify the meal.
        /// </summary>
        /// <remarks>
        /// NAME: KidsMealModification
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/15/2019
        /// </remarks>
        /// <param name="a_kidsMeals"></param>
        public KidsMealModification(KidsMeal a_kidsMeals) : this()
        {
            m_kidsMealFromMain = a_kidsMeals;
            m_mealView         = new MealView(m_kidsMealFromMain);

            PerformViewFormatting();
            lbModifiedKidsMeal.DataSource = m_mealView.GetDisplay();

            DefaultSide         = m_kidsMealFromMain.GetSide().SideIdentifier;
            DefaultBev          = m_kidsMealFromMain.GetBeverage().BeverageIdentifier;
            CurrentlyChosenSide = m_kidsMealFromMain.GetSide().SideIdentifier;
            CurrentlyChosenBev  = m_kidsMealFromMain.GetBeverage().BeverageIdentifier;

            GenerateAttributeButtonListAndSetProperties();
            CompleteButtonDisplay();
        }/*public KidsMealModification(KidsMeal a_kidsMeals) : this()*/
        }/*private List<int> MakeSavedIndexesUsefulForPricing()*/

        /// <summary>
        /// Gets the raw display items from the MealView and parses out
        /// the vital information.
        /// </summary>
        /// <remarks>
        /// NAME: PerformMealViewFormatting
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/16/2019
        /// </remarks>
        /// <param name="a_view">The MealView to parse data from.</param>
        private void PerformMealViewFormatting(MealView a_view)
        {
            a_view.FillMealDisplay();
            BindingList <string> viewDisplayDetails = a_view.GetDisplay();

            string[] indexArr = new string[viewDisplayDetails.Count];
            viewDisplayDetails.CopyTo(indexArr, 0);

            SaveNumberOfDisplayLinesOnEachAddition(indexArr);

            foreach (string val in viewDisplayDetails)
            {
                if (!val.Equals("") && !val.Equals(m_lineFeed) && !val.Equals(m_tilde))
                {
                    m_menuItemsForDisplay.Add(val);
                }
            }
        }/*private void PerformMealViewFormatting(MealView a_view)*/
        }/*public BindingList<string> GetItemsForDisplay()*/

        /// <summary>
        /// Gets the full list of all the lines in the display that have not been
        /// sent to the KitchenScreensClient yet. Determines this primarily through
        /// the SentFlag property of the Meal object.
        /// </summary>
        /// <remarks>
        /// NAME: GetUnsentItemsForSending
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/16/2019
        /// </remarks>
        /// <returns>
        /// A list of all strings that have not been sent to the KitchenScreensClient yet.
        /// </returns>
        public List <string> GetUnsentItemsForSending()
        {
            List <string> stringSender = new List <string>();

            for (int i = 0; i < m_customerCheck.NumberOfMeals(); i++)
            {
                Meal potentialSender = m_customerCheck.GetMealAtIndex(i);
                if (!potentialSender.SentFlag)
                {
                    MealView tempMealView = new MealView(potentialSender);
                    tempMealView.FillMealDisplay();

                    foreach (string str in tempMealView.GetDisplay())
                    {
                        if (!str.Contains(m_tilde))
                        {
                            stringSender.Add(str + '\n');
                        }
                    }
                }
            }
            return(stringSender);
        }/*public List<string> GetUnsentItemsForSending()*/
Пример #5
0
        }/*private void SendVoidCommandForBeverage(int a_mealIndex)*/

        /// <summary>
        /// Handles the composing of the void command for an KidsMeal item. Parses the selected
        /// KidsMeal's view and sends it to the KitchenScreenClient.
        /// </summary>
        /// <remarks>
        /// NAME: SendVoidCommandForKidsMeal
        /// AUTHOR: Ryan Osgood
        /// DATE: 9/1/2019
        /// </remarks>
        /// <param name="a_mealIndex">The index of the meal of which exists the KidsMeal to void.</param>
        private void SendVoidCommandForKidsMeal(int a_mealIndex)
        {
            Meal     targetMeal     = m_customerChecks[m_currentlySelectedTab].GetMealAtIndex(a_mealIndex);
            MealView targetMealView = new MealView(targetMeal);

            targetMealView.FillMealDisplay();
            List <string> attributesOfVoid = new List <string>();

            foreach (string s in targetMealView.GetDisplay())
            {
                if (!s.Equals("") && !s.Equals("\r") && !s.Equals("~"))
                {
                    attributesOfVoid.Add(s + '\n');
                }
            }

            attributesOfVoid.Insert(0, m_customerChecks[m_currentlySelectedTab].Name + '\n');
            attributesOfVoid.Insert(1, m_customerChecks[m_currentlySelectedTab].GetCheckGUID() + '\n');
            attributesOfVoid.Insert(2, "VOID" + '\n');
            string toBeSent = string.Join(string.Empty, attributesOfVoid);

            m_server.SendToAll(toBeSent);
            UpdateDisplay();
        }/*private void SendVoidCommandForKidsMeal(int a_mealIndex)*/