Exemplo n.º 1
0
        private void btnCreateBar_Click(object sender, EventArgs e)
        {
            barTable = new BarTable();
            int startLeft = pnlRoom.Left;
            int startTop  = pnlRoom.Top;

            barTable.TableNumber    = 1;
            barTable.TablePositionX = startLeft;
            barTable.TablePositionY = startTop;

            Button 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(startLeft, startTop);
            pnlRoom.Controls.Add(button);

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

            btnSaveLayout.Enabled = true;
            lblMessage.Text       = "Bar was successfully added.";

            btnCreateBar.Enabled = false;
        }
Exemplo n.º 2
0
 public frmManageSeatingLayout()
 {
     InitializeComponent();
     lblMessage.Text = "";
     LoadTables();
     btnSaveLayout.Enabled  = false;
     cboSeats.SelectedIndex = 0;
     StayInsideButton.SetPanelSize(pnlRoom.Size);
 }
Exemplo n.º 3
0
        public void LoadBarTable()
        {
            BarTable oBarTable = BarTableDA.GetBarTableLayout();

            if (oBarTable != null)
            {
                Button 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       = oBarTable;
                button.Text      = "Bar";
                button.Location  = new Point(oBarTable.TablePositionX, oBarTable.TablePositionY);
                pnlRoom.Controls.Add(button);
            }
        }
Exemplo n.º 4
0
        public void button_MouseMove(object sender, MouseEventArgs e)
        {
            StayInsideButton button = (StayInsideButton)sender;

            if (button != null)
            {
                if (e.Button == MouseButtons.Left)
                {
                    BarObject barObject = (BarObject)button.Tag;

                    if (barObject != null)
                    {
                        Point mouseMovePoint = pnlRoom.PointToClient(button.PointToScreen(e.Location));

                        button.CheckSetLocation(barObject.TablePositionX + (mouseMovePoint.X - mouseDownPoint.X),
                                                barObject.TablePositionY + (mouseMovePoint.Y - mouseDownPoint.Y));
                    }
                }
            }
        }
Exemplo n.º 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!";
        }