private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            LoginDialog dlg = new LoginDialog();

            dlg.Owner = this;
            dlg.ShowDialog();
            // Process data entered by user if dialog box is accepted
            if (dlg.DialogResult == true)
            {
                if (userData.LogIn(dlg.nameTextBox.Text, dlg.passwordTextBox.Password) == true)
                {
                    this.logoutButton.Visibility = Visibility.Visible;
                    this.loginButton.Visibility  = Visibility.Collapsed;
                    this.statusTextBlock.Text    = "You are logged in. Welcome " +
                                                   userData.FullName;

                    DBQueries dbQ = new DBQueries();
                    DataSet   ds  = new DataSet();
                    String    s1  = "Select Manager from UserData Where UserID ='" + userData.UserID + "'";
                    ds      = dbQ.SELECT_FROM_TABLE(s1);
                    Manager = bool.Parse(ds.Tables[0].Rows[0]["Manager"].ToString());

                    if (Manager)
                    {
                        this.AdminPanelbutton.Visibility = Visibility.Visible;
                        this.AskButton.Visibility        = Visibility.Collapsed;
                    }
                }
                else
                {
                    this.statusTextBlock.Text = "Your login failed. Please try again.";
                }
            }
        }
Beispiel #2
0
        //public DataTable Dbtable { get => dbtable; set => dbtable = value; }

        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            if (globalUserID == 0)
            {
                LoginDialog dlg = new LoginDialog();
                dlg.Owner = this;
                dlg.ShowDialog();
                // Process data entered by user if dialog box is accepted
                if (dlg.DialogResult == true)
                {
                    if (userData.LogIn(dlg.nameTextBox.Text, dlg.passwordTextBox.Password) == true)
                    {
                        userData.LogoutCheck(false);
                        this.statusTextBlock.Text = "You are logged in as " + userData.FullName;

                        bookWishList = new BookWishlist(); //Create Wishlist object
                        viewHistory  = new ViewHistory();  //Create View History object

                        CheckAvailableBook();
                        if (userData.isManager) //Checks if Account is Manager
                        {
                            this.adminButton.Visibility        = Visibility.Visible;
                            this.wishListButton.Visibility     = Visibility.Visible;
                            this.orderHistoryButton.Visibility = Visibility.Visible;
                            this.editProfile.Visibility        = Visibility.Visible;
                        }
                        else
                        {
                            this.adminButton.Visibility        = Visibility.Hidden;  // hide admin button
                            this.wishListButton.Visibility     = Visibility.Visible; //Display wishlist for non admin
                            this.orderHistoryButton.Visibility = Visibility.Visible;
                            this.editProfile.Visibility        = Visibility.Visible;
                        }

                        //Hide Login Text on Login Button
                        this.loginButton.Content = "Logout";
                        globalUserID             = userData.UserID;
                    }
                    else //if Login Fails
                    {
                        this.statusTextBlock.Text = "Your login failed. Please try again.";
                    }
                }
            }
            else //If user is already logged in and wants to logout
            {
                userData.LogoutCheck(true);
                globalUserID                       = 0;
                this.loginButton.Content           = "Login";
                this.statusTextBlock.Text          = "You have successfully Logged Out!";
                this.adminButton.Visibility        = Visibility.Hidden; //Hide Admin Button
                this.wishListButton.Visibility     = Visibility.Hidden; //Hide Wishlist Button
                this.orderHistoryButton.Visibility = Visibility.Hidden;
                this.editProfile.Visibility        = Visibility.Hidden;
            }
        }
Beispiel #3
0
        private void LoginButton_Click(object sender, RoutedEventArgs e)
        {
            var loginDialog = new LoginDialog();

            loginDialog.Owner = this;
            loginDialog.ShowDialog();

            if (loginDialog.DialogResult == true)
            {
                // Login successful
                User = loginDialog.User;
                this.textBlockStatus.Text = "You are logged in as " + User.FirstName + " " + User.LastName + ".";
                InitializeMenu();
            }
        }
Beispiel #4
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            LoginDialog dlg = new LoginDialog();

            dlg.Owner = this;
            dlg.ShowDialog();
            // Process data entered by user if dialog box is accepted
            if (dlg.DialogResult == true)
            {
                if (userData.LogIn(dlg.nameTextBox.Text, dlg.passwordTextBox.Password) == true)
                {
                    this.statusTextBlock.Text = "You are logged in as User #" +
                                                userData.UserID + ".";
                }
                else
                {
                    this.statusTextBlock.Text = "Your login failed. Please try again.";
                }
            }
        }
Beispiel #5
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            var userData = new UserData();
            var dlg      = new LoginDialog();

            dlg.Owner = this;
            dlg.ShowDialog();
            // Process data entered by user if dialog box is accepted
            if (dlg.DialogResult == true)
            {
                if (userData.LogIn(dlg.nameTextBox.Text, dlg.passwordTextBox.Password) == true)
                {
                    this.statusTextBlock.Text = userData.FullName + ", you are logged in as User #" + userData.UserID;
                }

                else
                {
                    MessageBox.Show("MAIN You could not be verified. Please try again.");
                }
            }
        }
Beispiel #6
0
        private void loginButton_Click(object sender, RoutedEventArgs e)
        {
            var userData = new UserData();
            var dlg      = new LoginDialog();

            dlg.Owner = this;
            dlg.ShowDialog();
            // Process data entered by user if dialog box is accepted
            if (dlg.DialogResult == true)
            {
                if (userData.LogIn(dlg.uname.Text, dlg.password.Password) == true)
                {
                    this.statusTextBlock.Text = "You are logged in as User #" + userData.UserId;
                    AppWindow.Title           = "Testing"; //Change Title
                }
                else
                {
                    MessageBox.Show("You could not be verified. Please try again.");
                }
            }
        }