Example #1
0
        public MenuForm(Table curTable, FoodMenu menu)
        {
            InitializeComponent();

            //array of food prices
            this.FoodPrices = new TextBox[18]{priceAppetizer1, priceAppetizer2, priceAppetizer3,priceSoupSalad1, priceSoupSalad2, priceSoupSalad3,
            priceEntree1, priceEntree2, priceEntree3, priceDesserts1, priceDesserts2, priceDesserts3,  priceDrinkKid1, priceDrinkKid2, priceDrinkKid3,
            priceDrinkAdult1, priceDrinkAdult2, priceDrinkAdult3 };

            this.tbFoodNames = new TextBox[18] {appetizer1, appetizer2, appetizer3, soupSalad1,soupSalad2, soupSalad3,
                                            entree1,entree2,entree3,desserts1,desserts2,dessert3,
                                            drinkKid1, drinkKid2, drinkKid3, drinkAdult1, drinkAdult2,drinkAdult3 };

            this.nudSelectors = new NumericUpDown[18] {selectAppetizer1, selectAppetizer2, selectAppetizer3, selectSoupSalad1, selectSoupSalad2,
                selectSoupSalad3, selectEntree1, selectEntree2, selectEntree3, selectDesserts1, selectDesserts2, selectDesserts3, selectDrinkKid1,
                selectDrinkKid2, selectDrinkKid3, selectDrinkAdult1, selectDrinkAdult2, selectDrinkAdult3 };

            curMenu = menu;

            this.appetizer1avail.Visible = !(curMenu.getAvaliable(0));
            this.appetizer2avail.Visible = !(curMenu.getAvaliable(1));
            this.appetizer3avail.Visible = !(curMenu.getAvaliable(2));
            this.soupSalad1Avail.Visible = !(curMenu.getAvaliable(3));
            this.soupSalad2Avail.Visible = !(curMenu.getAvaliable(4));
            this.soupSalad3Avail.Visible = !(curMenu.getAvaliable(5));
            this.entree1Avail.Visible = !(curMenu.getAvaliable(6));
            this.entree2Avail.Visible = !(curMenu.getAvaliable(7));
            this.entree3Avail.Visible = !(curMenu.getAvaliable(8));
            this.dessert1Avail.Visible = !(curMenu.getAvaliable(9));
            this.dessert2Avail.Visible = !(curMenu.getAvaliable(10));
            this.dessert3Avail.Visible = !(curMenu.getAvaliable(11));
            this.drinkKid1Avail.Visible = !(curMenu.getAvaliable(12));
            this.drinkKid2Avail.Visible = !(curMenu.getAvaliable(13));
            this.drinkKid3Avail.Visible = !(curMenu.getAvaliable(14));
            this.drinkAdult1Avail.Visible = !(curMenu.getAvaliable(15));
            this.drinkAdult2Avail.Visible = !(curMenu.getAvaliable(16));
            this.drinkAdult3Avail.Visible = !(curMenu.getAvaliable(17));

            table = curTable;
            usingReceipt = curTable.getReceipt();

            //For setting the prices in the GUI
            for (int i= 0; i< FoodPrices.Length; i++){
                FoodPrices[i].Text = "" + curMenu.getFoodItem(i).getPrice();
            }

            //For setting the names in the GUI
            for (int j = 0; j < tbFoodNames.Length; j++)
            {
                tbFoodNames[j].Text = "" + curMenu.getFoodItem(j).getName();
            }

            //For setting if the food is available. if checked, the item is not available and value set to 0.
            for (int k = 0; k < nudSelectors.Length; k++)
            {
                /*if(checkBoxes[k].CheckState == CheckState.Checked){

                    nudSelectors[k].Value = 0;

                }*/

            }

            /*
            //Changes all the values of the int array to 0. Used for storing the amount of orders for each item
            for (int i = 0; i < menuValues.Length; i++)
            {
                menuValues[i] = 0;
            }
            */
        }
Example #2
0
        Table[] tables = new Table[16]; //an array representing the table objects for the restaurant

        #endregion Fields

        #region Constructors

        /*
            Constructor
            Initializes the buttons and creates all objects necessary for the program
        */
        public Sections()
        {
            InitializeComponent();
            buttons = new Button[16]{tableButton1, tableButton2, tableButton3, tableButton4, tableButton5, tableButton6,  tableButton7,
                    tableButton8, tableButton9, tableButton10, tableButton11, tableButton12,  tableButton13, tableButton14,
                    tableButton15, toGoTable};

            tableBoxes = new PictureBox[16]{pictureBox1,pictureBox2,pictureBox3,pictureBox4,pictureBox5,pictureBox6,pictureBox7,
                        pictureBox8,pictureBox9,pictureBox10,pictureBox11,pictureBox12,pictureBox13,pictureBox14,pictureBox15,pictureBox16};
            //update button names
            for(int i = 0; i < buttons.Length;i++)
            {
                buttons[i].Text = "Table " + (i+1);
                buttons[i].BackColor = Color.Green;
            }
            buttons[15].Text = "TOGO";

            //initialize the staff members
            for(int i = 0; i < staff.Length; i++)
            {
                staff[i] = new Employee("Employee " + (i + 1));
            }

            //initialize the table objects
            for (int i = 0; i < tables.Length; i++)
            {
                tables[i] = new Table();
                tables[i].setTableNum(i + 1);

                //set certain employees to their corresponding tables
                if(i < 3)
                {
                    tables[i].setEmployee(staff[0]);
                }
                else if( i < 6 )
                {
                    tables[i].setEmployee(staff[1]);
                }
                else if( i < 9)
                {
                    tables[i].setEmployee(staff[2]);
                }
                else if( i < 12)
                {
                    tables[i].setEmployee(staff[3]);
                }
                else if( i < 15)
                {
                    tables[i].setEmployee(staff[4]);
                }
            }

            string userName = Environment.UserName;
            Console.WriteLine(userName);
            string[] menuFile = System.IO.File.ReadAllLines(@"C:\Users\" + userName + @"\Dropbox\CS 341\Waitstaff\menu.txt");
            menu = new FoodMenu(19);
            FoodItem temp;
            for(int i = 0; i < menuFile.Length; i+=4)
            {
                try
                {
                    Console.WriteLine("" + menuFile[i] + " "+ Int32.Parse(menuFile[i + 1]) + " " +Int32.Parse(menuFile[i + 2]));
                    temp = new FoodItem(menuFile[i], Int32.Parse(menuFile[i + 1]), Int32.Parse(menuFile[i + 2]));
                    menu.addItem(temp);

                }
                catch(Exception e)
                {
                    break;
                }
            }

            for(int i = 0; i < 19; i++)
            {
                if(menu.getFoodItem(i) == null)
                {
                    temp = new FoodItem("0", 0, 0);
                    menu.addItem(temp);

                }
            }
        }