Exemple #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            frmManagerMenu newForm = new frmManagerMenu();

            newForm.Show();
            this.Hide();
        }
Exemple #2
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Returning to Manager Menu. Press 'Yes' to proceed.", "Confirmation", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                frmManagerMenu newForm = new frmManagerMenu();
                newForm.Show();
                this.Hide();
            }
        }
Exemple #3
0
        private void btnLogIn_Click(object sender, EventArgs e)
        {
            string inputUsername = txtUsername.Text;
            string inputPassword = txtPassword.Text;

            int  index         = 0;
            bool usernameFound = false;
            bool passwordFound = false;

            for (int i = 0; i < username.Count; i++)
            {
                if (inputUsername == username[i])
                {
                    index         = i;
                    usernameFound = true;
                    break;
                }
            }

            if (usernameFound == false)
            {
                MessageBox.Show("Wrong username! Please try again!", "Unsuccessful");
                return;
            }

            if (inputPassword == password[index])
            {
                passwordFound = true;
            }

            if (passwordFound == false)
            {
                MessageBox.Show("Wrong password! Please try again!", "Unsuccessful");
                return;
            }

            if (usernameFound == true && passwordFound == true)
            {
                MessageBox.Show("Successful login. Redirecting to " + position[index] + " Menu!", "Successful");
                if (position[index] == "Manager")
                {
                    frmManagerMenu newForm = new frmManagerMenu();
                    newForm.Show();
                    this.Hide();
                }
                else if (position[index] == "Cashier")
                {
                    frmGenerateBill newForm = new frmGenerateBill();
                    newForm.Show();
                    this.Hide();
                }
            }
        }