Ejemplo n.º 1
0
        public ReceiptForm(Receipt newReceipt, Employee newEmployee)
        {
            InitializeComponent();
            rCurrentReceipt = newReceipt;
            eCurrentEmployee = newEmployee;

            ReceiptView.Text = rCurrentReceipt.printReceipt();
        }
Ejemplo n.º 2
0
 /**
 * sets the server for the table
 */
 public void setEmployee(Employee newEmployee)
 {
     employee = newEmployee;
 }
Ejemplo n.º 3
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);

                }
            }
        }