예제 #1
0
        public void LoadBarSeats()
        {
            List <BarSeat> oBarSeats = BarSeatDA.GetBarSeatLayout();

            if (!(Utility.IsNullOrEmpty(oBarSeats)))
            {
                foreach (BarSeat oBarSeat in oBarSeats)
                {
                    RoundButton button = new RoundButton();
                    button.Cursor    = Cursors.Hand;
                    button.Height    = 30;
                    button.Width     = 30;
                    button.FlatStyle = FlatStyle.Flat;
                    button.FlatAppearance.BorderSize = 0;
                    if (oBarSeat.TableState == TableState.Empty.ToString())
                    {
                        button.BackColor = Color.Cyan;
                    }
                    else if (oBarSeat.TableState == TableState.Occupied.ToString())
                    {
                        button.BackColor = Color.Red;
                    }
                    else if (oBarSeat.TableState == TableState.Bussable.ToString())
                    {
                        button.BackColor = Color.Yellow;
                    }
                    button.Tag      = oBarSeat;
                    button.Text     = "B" + Convert.ToString(oBarSeat.TableNumber);
                    button.Location = new Point(oBarSeat.TablePositionX, oBarSeat.TablePositionY);
                    button.Click   += new EventHandler(btnBarSeatClick);
                    pnlRoom.Controls.Add(button);
                }
            }
        }
예제 #2
0
        public void LoadTables()
        {
            List <Table> oTables = TableDA.GetTableLayout();

            if (!(Utility.IsNullOrEmpty(oTables)))
            {
                foreach (Table oTable in oTables)
                {
                    RoundButton button = new RoundButton();
                    button.Cursor    = Cursors.Hand;
                    button.Height    = 50;
                    button.Width     = 50;
                    button.FlatStyle = FlatStyle.Flat;
                    button.FlatAppearance.BorderSize = 0;
                    if (oTable.TableState == TableState.Empty.ToString())
                    {
                        button.BackColor = Color.Cyan;
                    }
                    else if (oTable.TableState == TableState.Occupied.ToString())
                    {
                        button.BackColor = Color.Red;
                    }
                    else if (oTable.TableState == TableState.Bussable.ToString())
                    {
                        button.BackColor = Color.Yellow;
                    }
                    button.Tag  = oTable.TableNumber;
                    button.Text = Convert.ToString(oTable.TableNumber)
                                  + "\n" + Convert.ToString(oTable.NumberOfSeats) + " seats";
                    //button.Text = "#"+Convert.ToString(oTable.TableNumber)
                    //    + "\nSeats " + Convert.ToString(oTable.NumberOfSeats);
                    button.Location = new Point(oTable.TablePositionX, oTable.TablePositionY);
                    button.Click   += new EventHandler(btnSeatClick);
                    pnlRoom.Controls.Add(button);
                }
            }
        }
예제 #3
0
        private void btnAddTable_Click(object sender, EventArgs e)
        {
            table    = new Table();
            assigned = new AssignedTable();
            int startLeft = pnlRoom.Left;
            int startTop  = pnlRoom.Top;

            string sErrorMess = "";
            bool   bIsValid   = true;

            try {
                table.TableNumber    = Convert.ToInt32(txtTableNumber.Text);
                assigned.TableNumber = table.TableNumber;

                if (rdoSection1.Checked)
                {
                    assigned.SectionNum = (int)AvailableSections.Section1;
                }
                else if (rdoSection2.Checked)
                {
                    assigned.SectionNum = (int)AvailableSections.Section2;
                }
                else if (rdoSection3.Checked)
                {
                    assigned.SectionNum = (int)AvailableSections.Section3;
                }
            }
            catch (Exception)  {
                bIsValid    = false;
                sErrorMess += "TableNumber is required and must be a number";
            }

            try {
                table.NumberOfSeats = Convert.ToInt32(cboSeats.SelectedItem);
                //table.NumberOfSeats = Convert.ToInt32(txtNumberOfSeats.Text);
            }
            catch (Exception) {
                bIsValid    = false;
                sErrorMess += "\nNumber of Seats is required and must be a number";
            }

            if (bIsValid)
            {
                table.TablePositionX = startLeft;
                table.TablePositionY = startTop;
                tables.Add(table);
                assignedList.Add(assigned);
                RoundButton button = new RoundButton();
                button.Cursor    = Cursors.Hand;
                button.Height    = 50;
                button.Width     = 50;
                button.FlatStyle = FlatStyle.Flat;
                button.FlatAppearance.BorderSize = 0;
                button.BackColor = Color.Cyan;
                button.Tag       = table;
                button.Text      = Convert.ToString(table.TableNumber)
                                   + "\n" + Convert.ToString(table.NumberOfSeats) + " seats";
                button.Location = new Point(startLeft, startTop);
                pnlRoom.Controls.Add(button);

                button.MouseDown += button_MouseDown;
                button.MouseUp   += button_MouseUp;
                button.MouseMove += button_MouseMove;

                txtTableNumber.Text   = Convert.ToString(Table.TotalTables);
                btnSaveLayout.Enabled = true;
                lblMessage.Text       = "Table " + table.TableNumber + " successfully added.";
            }
            else
            {
                MessageBox.Show(sErrorMess, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #4
0
        private void btnAddBarSeat_Click(object sender, EventArgs e)
        {
            barSeat  = new BarSeat();
            assigned = new AssignedTable();
            int startLeft = pnlRoom.Left;
            int startTop  = pnlRoom.Top;

            string sErrorMess = "";
            bool   bIsValid   = true;

            try {
                barSeat.TableNumber  = Convert.ToInt32(txtBarSeatNumber.Text);
                assigned.TableNumber = barSeat.TableNumber;
                assigned.SectionNum  = (int)AvailableSections.Section4;
            }
            catch (Exception) {
                bIsValid    = false;
                sErrorMess += "TableNumber is required and must be a number";
            }

            //try {

            //    barSeat.NumberOfSeats = Convert.ToInt32(txtNumberOfSeats.Text);

            //}
            //catch (Exception) {

            //    bIsValid = false;
            //    sErrorMess += "\nNumber of Seats is required and must be a number";

            //}

            if (bIsValid)
            {
                barSeat.TablePositionX = startLeft;
                barSeat.TablePositionY = startTop;
                barSeats.Add(barSeat);
                assignedList.Add(assigned);
                RoundButton button = new RoundButton();
                button.Cursor    = Cursors.Hand;
                button.Height    = 30;
                button.Width     = 30;
                button.FlatStyle = FlatStyle.Flat;
                button.FlatAppearance.BorderSize = 0;
                button.BackColor = Color.Cyan;
                button.Tag       = barSeat;
                button.Text      = "B" + Convert.ToString(barSeat.TableNumber);
                button.Location  = new Point(startLeft, startTop);
                pnlRoom.Controls.Add(button);

                button.MouseDown += button_MouseDown;
                button.MouseUp   += button_MouseUp;
                button.MouseMove += button_MouseMove;

                txtBarSeatNumber.Text = Convert.ToString(BarSeat.TotalTables);
                btnSaveLayout.Enabled = true;
                lblMessage.Text       = "BarSeat " + barSeat.TableNumber + " successfully added.";
            }
            else
            {
                MessageBox.Show(sErrorMess, "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #5
0
        public void LoadTables()
        {
            // Load Tables
            tables = TableDA.GetTableLayout();

            if (!(Utility.IsNullOrEmpty(tables)))
            {
                foreach (Table eachTable in tables)
                {
                    table = eachTable;

                    RoundButton button = new RoundButton();
                    button.Cursor    = Cursors.Hand;
                    button.Height    = 50;
                    button.Width     = 50;
                    button.FlatStyle = FlatStyle.Flat;
                    button.FlatAppearance.BorderSize = 0;
                    button.BackColor = Color.Cyan;
                    button.Tag       = table;
                    button.Text      = Convert.ToString(table.TableNumber)
                                       + "\n" + Convert.ToString(table.NumberOfSeats) + " seats";
                    button.Location = new Point(table.TablePositionX, table.TablePositionY);
                    pnlRoom.Controls.Add(button);

                    button.MouseDown += button_MouseDown;
                    button.MouseUp   += button_MouseUp;
                    button.MouseMove += button_MouseMove;
                }

                txtTableNumber.Text = Convert.ToString(Table.TotalTables);
            }

            //Load BarSeats.
            barSeats = BarSeatDA.GetBarSeatLayout();

            if (!(Utility.IsNullOrEmpty(barSeats)))
            {
                foreach (BarSeat eachBarSeat in barSeats)
                {
                    barSeat = eachBarSeat;

                    RoundButton button = new RoundButton();
                    button.Cursor    = Cursors.Hand;
                    button.Height    = 30;
                    button.Width     = 30;
                    button.FlatStyle = FlatStyle.Flat;
                    button.FlatAppearance.BorderSize = 0;
                    button.BackColor = Color.Cyan;
                    button.Tag       = barSeat;
                    button.Text      = "B" + Convert.ToString(barSeat.TableNumber);
                    button.Location  = new Point(barSeat.TablePositionX, barSeat.TablePositionY);
                    pnlRoom.Controls.Add(button);

                    button.MouseDown += button_MouseDown;
                    button.MouseUp   += button_MouseUp;
                    button.MouseMove += button_MouseMove;
                }

                txtBarSeatNumber.Text = Convert.ToString(BarSeat.TotalTables);
            }

            // Load BarTable.
            barTable = BarTableDA.GetBarTableLayout();

            if (barTable != null)
            {
                StayInsideButton button = new StayInsideButton();
                button.Cursor    = Cursors.Hand;
                button.Height    = 30;
                button.Width     = 200;
                button.FlatStyle = FlatStyle.Flat;
                button.FlatAppearance.BorderSize = 0;
                button.BackColor = Color.Cyan;
                button.Tag       = barTable;
                button.Text      = "Bar";
                button.Location  = new Point(barTable.TablePositionX, barTable.TablePositionY);
                pnlRoom.Controls.Add(button);

                button.MouseDown += button_MouseDown;
                button.MouseUp   += button_MouseUp;
                button.MouseMove += button_MouseMove;
            }

            lblMessage.Text = "Seating layout successfully loaded!";
        }