}/*public void ClearMembersForReinitialization()*/

        /// <summary>
        /// Using the meals within the CustomerCheck, generate their respective
        /// MealViews and add them to the MealView list.
        /// </summary>
        /// <remarks>
        /// NAME: RefreshMealViews
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/16/2019
        /// </remarks>
        public void RefreshMealViews()
        {
            for (int i = 0; i < m_customerCheck.NumberOfMeals(); i++)
            {
                Meal meal = new Meal();
                meal = m_customerCheck.GetMealAtIndex(i);

                MealView mealView = new MealView(meal);
                m_customerMealViews.Add(mealView);
            }
        }/*public void RefreshMealViews()*/
        } /*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()*/
        }/*public List<string> GetUnsentItemsForSending()*/

        /// <summary>
        /// Gets a count of the number of lines in the display
        /// that have been sent to the KitchenScreenClient.
        /// </summary>
        /// <remarks>
        /// NAME: GetCountInDisplayOfSentItems
        /// AUTHOR: Ryan Osgood
        /// DATE: 8/16/2019
        /// </remarks>
        /// <returns>
        /// An integer which is the number of sent lines to the KitchenScreenClient.
        /// </returns>
        public int GetCountInDisplayOfSentItems()
        {
            int numberOfSentLines = 0;

            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();
                    numberOfSentLines += tempMealView.NumberOfDisplayItems;
                }
            }

            return(numberOfSentLines);
        }/*public int GetCountInDisplayOfSentItems()*/
        }/*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()*/
Example #6
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)*/