Example #1
0
 public formSettingsAdmin(Admin admin, formAdmin parent)
 {
     InitializeComponent();
     this.admin  = admin;
     this.parent = parent;
 }
Example #2
0
        private void login()
        {
            String username = txtUsername.Text;
            String password = txtPassword.Text;



            if (database.checkIfUserExists(username) == false)
            {
                MessageBox.Show("Wrong Account Details");
                if (count++ == 3)
                {
                    MessageBox.Show("Too many attempts");
                    this.Close();
                }
            }
            else
            {
                Account account = database.Login(username, password);

                if (account == null)
                {
                    MessageBox.Show("Wrong account details");
                }

                else
                {
                    if (account.Disabled == true)
                    {
                        formDisabled disabled = new formDisabled(account, parent);
                    }
                    else
                    {
                        switch (account.Permission)
                        {
                        case 0:
                            close = false;
                            this.Close();
                            formUser user = new formUser(account, parent);
                            user.Show();
                            break;

                        case 1:
                            close = false;
                            this.Close();
                            formTechSupport tech = new formTechSupport(account, parent);
                            tech.Show();
                            break;

                        case 2:
                            close = false;
                            this.Close();
                            formAdmin admin = new formAdmin(account, parent);
                            admin.Show();
                            break;

                        default:
                            MessageBox.Show("Error - account permission unknown");
                            close = false;
                            this.Close();
                            break;
                        }
                    }
                }
            }
        }