private void LoginButton_Click(object sender, EventArgs e)
        {
            // check password match
            if (Database.CheckCredentials(username.Text, userpassword.Text))
            {
                // write in Current_User
                Database.SetCurrentUser(username.Text);

                this.f1.Controls["HomeLoginButton"].Text = "You are identified as \n" + username.Text + "\n Click here to logout";
                this.Close();
                if (username.Equals("Admin"))
                {
                    ListCartForm lcf = new ListCartForm();
                    lcf.Show();
                }
                else
                {
                    UserShoppingForm usf = new UserShoppingForm();
                    usf.Show();
                }
            }
            else
            {
                MessageBox.Show("Bad Username or password, Try again");
            }
        }
Ejemplo n.º 2
0
 private void buttonCartsList_Click(object sender, EventArgs e)
 {
     if (Database.GetCurrentUser("Name").Equals("Admin"))
     {
         ListCartForm lcf = new ListCartForm();
         lcf.Show();
     }
     else
     {
         MessageBox.Show("You must be identified as Admin to enter this section. Log In first");
     }
 }