コード例 #1
0
        //Room Select Close
        private void RoomSelect_Closed(object sender, FormClosedEventArgs e)
        {
            if (tabSelected == 2)
            {
                if (cancelled)
                {
                    pnlRoomSelect.Visible = false;

                    picTabDisplay_Click(sender, e);
                }
                else
                {
                    pnlRoomSelect.Visible = false;

                    RoomBookingAdd frm = new RoomBookingAdd();
                    frm.TopLevel        = false;
                    frm.FormBorderStyle = FormBorderStyle.None;
                    frm.WindowState     = FormWindowState.Maximized;
                    frm.FormClosing    += RoomBookingAdd_Closing;
                    frm.FormClosed     += RoomBookingAdd_Closed;
                    pnlMainBody.Controls.Add(frm);
                    frm.Show();
                }
            }
            else if (tabSelected == 3)
            {
                if (cancelled)
                {
                    pnlRoomSelect.Visible = false;

                    //Globals.firstLoad = true;

                    picTabEdit_Click(sender, e);
                }
                else
                {
                    pnlRoomSelect.Visible = false;

                    Globals.firstLoad = false;

                    RoomBookingEdit frm = new RoomBookingEdit();
                    frm.TopLevel        = false;
                    frm.FormBorderStyle = FormBorderStyle.None;
                    frm.WindowState     = FormWindowState.Maximized;
                    frm.FormClosing    += RoomBookingEdit_Closing;
                    frm.FormClosed     += RoomBookingEdit_Closed;
                    pnlMainBody.Controls.Add(frm);
                    frm.Show();
                }
            }
        }
コード例 #2
0
        private void picTabEdit_Click(object sender, EventArgs e)
        {
            tabSelected = 3;
            bool error = false;

            switch (menuSelected)
            {
            case 0:     //Welcome
                break;

            case 1:     //Room Booking
                if (Globals.bookNoSel == "")
                {
                    MessageBox.Show("Error: No Booking Selected!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    error = true;
                }
                else
                {
                    RoomBookingEdit frm = new RoomBookingEdit();
                    frm.TopLevel        = false;
                    frm.FormBorderStyle = FormBorderStyle.None;
                    frm.WindowState     = FormWindowState.Maximized;
                    frm.FormClosed     += RoomBookingEdit_Closed;
                    frm.FormClosing    += RoomBookingEdit_Closing;
                    pnlMainBody.Controls.Add(frm);
                    frm.Show();
                }
                break;

            case 2:     //Room Service
                RoomServiceEdit frm2 = new RoomServiceEdit();
                frm2.TopLevel        = false;
                frm2.FormBorderStyle = FormBorderStyle.None;
                frm2.WindowState     = FormWindowState.Maximized;
                frm2.FormClosed     += RoomServiceEdit_Closed;
                pnlMainBody.Controls.Add(frm2);
                frm2.Show();
                break;

            case 3:     //Table Booking
                if (Globals.bookSel == null)
                {
                    MessageBox.Show("Error: No Booking Selected!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    pnlTableSelect.BringToFront();
                    pnlTableSelect.Visible = true;

                    TableSelectEdit form = new TableSelectEdit();
                    form.TopLevel        = false;
                    form.FormBorderStyle = FormBorderStyle.None;
                    form.WindowState     = FormWindowState.Maximized;
                    form.FormClosed     += TableSelectEdit_Closed;
                    pnlTableSelect.Controls.Add(form);
                    form.Show();
                    TabVisible();
                    break;
                }
                break;

            case 4:     //Restaurant Stock NEEDS WORK
                if (Globals.prdNoSel == null)
                {
                    MessageBox.Show("Error: No Product Selected!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    error = true;
                }
                else
                {
                    RestaurantStockEdit frm4 = new RestaurantStockEdit();
                    frm4.TopLevel        = false;
                    frm4.FormBorderStyle = FormBorderStyle.None;
                    frm4.WindowState     = FormWindowState.Maximized;
                    pnlMainBody.Controls.Add(frm4);
                    frm4.Show();
                    TabVisible();
                    //break;
                }
                break;

            case 5:     //Staff
                break;

            case 6:     //Administration Staff
                if (Globals.staffSel == "")
                {
                    MessageBox.Show("Error: No Staff Selected!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    error = true;
                }
                else
                {
                    StaffEdit frm6 = new StaffEdit();
                    frm6.TopLevel        = false;
                    frm6.FormBorderStyle = FormBorderStyle.None;
                    frm6.WindowState     = FormWindowState.Maximized;
                    pnlMainBody.Controls.Add(frm6);
                    frm6.Show();
                }
                break;
            }

            if (!error)
            {
                if (menuSelected == 1)
                {
                    //Disable All Tab
                    picTabEdit.Enabled    = false;
                    picTabDisplay.Enabled = false;
                    picTabSearch.Enabled  = false;
                    picTabAdd.Enabled     = false;
                    picTabDelete.Enabled  = false;
                }
                else
                {
                    //Disable Selected Tab
                    picTabEdit.Enabled = false;

                    //Enable All Other Tabs
                    picTabDisplay.Enabled = true;
                    picTabSearch.Enabled  = true;
                    picTabAdd.Enabled     = true;
                    picTabDelete.Enabled  = true;

                    //Globals.bookNoSel = "";
                }
            }
        }