private void btnReservations_Click(object sender, RoutedEventArgs e)
        {
            ReservationMenu reservationMenu = new ReservationMenu();

            reservationMenu.Owner = this;
            reservationMenu.ShowDialog();
        }
        private void btnExit_Click(object sender, RoutedEventArgs e)
        {
            this.Hide();
            ReservationMenu RsvMenu = new ReservationMenu();

            RsvMenu.Owner = this;
            RsvMenu.ShowDialog();
        }
Beispiel #3
0
        private void btnConfirm_Click(object sender, RoutedEventArgs e)
        {
            //Update Database

            //Send out confirmation email

            //Return to Reservation Menu
            this.Hide();
            ReservationMenu RsvMenu = new ReservationMenu();

            RsvMenu.Owner = this;
            RsvMenu.ShowDialog();
        }
        //Continue
        private void btnContinue_Click(object sender, RoutedEventArgs e)
        {
            //Create an instance of a user class
            AUTHENTICATION userDetails = new AUTHENTICATION();
            //Get the Username from the tbxUserName.  Remove unnecessary spaces
            string currentUser = tbxUsername.Text.Trim();
            //Retrieve first 3 characters of Username
            string sub = currentUser.Substring(0, 3);
            //Get password text.  Note it does not use he same syntax as a normal text box
            string currentPassword = passwordBox.Password;

            //Run the mtdGetUserDetails method with the inptted user name and password information
            userDetails = mtdGetUserDetails(currentUser, currentPassword);


            //Normal User
            if (userDetails.AccessLevel == 1)
            {
                this.Hide();
                ReservationMenu RsvMenu = new ReservationMenu();
                RsvMenu.Owner = this;
                RsvMenu.ShowDialog();
                //initialise count
                int count = 0;
            }

            //Management
            if (userDetails.AccessLevel == 2)
            {
                this.Hide();
                ManagementMenu ManMenu = new ManagementMenu();
                ManMenu.Owner = this;
                ManMenu.ShowDialog();
                //initialise count
                int count = 0;
            }

            //Other
            else
            {
                //Start Count
                countStaff++;

                //Normal user
                //First attempt
                if (sub == "STF" && countStaff == 1)
                {
                    lblMessage.Content   = "Username and Password invalid, please try again";
                    tbxUsername.Text     = "";
                    passwordBox.Password = "";
                    tbxUsername.Focus();
                }

                //Second attempt
                if (sub == "STF" && countStaff == 2)
                {
                    lblMessage.Content   = "Username and Password invalid, One more try";
                    tbxUsername.Text     = "";
                    passwordBox.Password = "";
                    tbxUsername.Focus();
                }

                //Third attempt
                if (sub == "STF" && countStaff == 3 || sub == "STF" && countStaff > 3)
                {
                    lblMessage.Content    = "Username and Password invalid, please contact the administrator";
                    tbxUsername.IsEnabled = false;
                    passwordBox.IsEnabled = false;
                    tbxUsername.Focus();
                }

                //Start Count
                countManager++;

                //Manager
                //First attempt
                if (sub == "MGR" && countManager == 1)
                {
                    lblMessage.Content   = "Username and Password invalid, please try again";
                    tbxUsername.Text     = "";
                    passwordBox.Password = "";
                    tbxUsername.Focus();
                }

                //Second attempt
                if (sub == "MGR" && countManager == 2)
                {
                    lblMessage.Content   = "Username and Password invalid, One more try";
                    tbxUsername.Text     = "";
                    passwordBox.Password = "";
                    tbxUsername.Focus();
                }
                //Third attempt
                if (sub == "MGR" && countManager == 3 || sub == "MGR" && countManager > 3)
                {
                    lblMessage.Content   = "Reset Password";
                    tbxUsername.Text     = "";
                    passwordBox.Password = "";
                    tbxUsername.Focus();
                    btnResetPassword.Visibility = Visibility.Visible;
                    countManager = 0;
                }
            }
        }