Пример #1
0
        private void Edit_Click(object sender, EventArgs e)
        {
            if (nameOfFormOpen.Equals("VenuesGUI") && VenuesGUI.Instance.idFromTable != -1)
            {
                VenueGUI venueGUI = new VenueGUI();
                venueGUI.Edit();
                venueGUI.Show();
            }

            else if (nameOfFormOpen.Equals("TablesGUI") && TablesGUI.Instance.idFromTable != -1)
            {
                TableGUI tableGUI = new TableGUI();
                tableGUI.Edit();
                tableGUI.Show();
            }

            else if (nameOfFormOpen.Equals("TablePackagesGUI") && TablePackagesGUI.Instance.idFromTable != -1)
            {
                TablePackageGUI tablePackageGUI = new TablePackageGUI();
                tablePackageGUI.Edit();
                tablePackageGUI.Show();
            }

            else if (nameOfFormOpen.Equals("EmployeesGUI") && EmployeesGUI.Instance.IdFromTable != -1)
            {
                EmployeeGUI employeeGUI = new EmployeeGUI();
                employeeGUI.Edit();
                employeeGUI.Show();
            }

            else
            {
                MessageBox.Show("Please select a " + newTitle + " from the list");
            }
        }
Пример #2
0
        private async void BtnCreateNew_ClickAsync(object sender, EventArgs e)
        {
            if (nameOfFormOpen.Equals("VenuesGUI"))
            {
                VenueGUI venueGUI = new VenueGUI();
                venueGUI.Create();
                venueGUI.Show();
            }
            else if (nameOfFormOpen.Equals("TablesGUI"))
            {
                TableGUI tableGUI = new TableGUI();
                await tableGUI.Create();

                tableGUI.Show();
            }

            else if (nameOfFormOpen.Equals("TablePackagesGUI"))
            {
                TablePackageGUI tablePackageGUI = new TablePackageGUI();
                tablePackageGUI.Create();
                tablePackageGUI.Show();
            }

            else if (nameOfFormOpen.Equals("EmployeesGUI"))
            {
                EmployeeGUI employeeGUI = new EmployeeGUI();
                await employeeGUI.Create();

                employeeGUI.Show();
            }
        }
Пример #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            Utilities account = new Utilities();

            // reset error status

            // if username not entered
            if (string.IsNullOrWhiteSpace(textEmployee.Text))
            {
                lblError.Text = "employeeID is required";
            }
            // if password not entered
            else if (string.IsNullOrWhiteSpace(txtPassword.Text))
            {
                lblError.Text = "Password is required";
            }

            else
            {
                if (verifyCredentials.employeeIDexist(textEmployee.Text))
                {
                    if (verifyCredentials.passwordMatches(Convert.ToInt32(textEmployee.Text), txtPassword.Text))
                    {
                        // re-direct to menu, hide admin buttons
                        var menuScreen = new EmployeeGUI();
                        menuScreen.FormClosed += new FormClosedEventHandler(menuScreen_FormClosed);
                        this.Hide();
                        menuScreen.Show();
                        menuScreen.employeeID = Convert.ToInt32(textEmployee.Text);
                    }

                    else
                    {
                        lblError.Text = "Invalid password";
                    }
                }
                else
                {
                    lblError.Text = "Username does not exist";
                }
            }
            textEmployee.Text = String.Empty;
            txtPassword.Text  = String.Empty;
        }