public formManageUsers(TechSupport tech, formTechSupport parent)
 {
     InitializeComponent();
     this.tech   = tech;
     this.parent = parent;
     userslist   = database.getAllAccounts();
     loadTable(tech);
     dgvUsers.CurrentCell = dgvUsers.Rows[0].Cells["colPassword"];
 }
Ejemplo n.º 2
0
 public formSettingsTechSupport(TechSupport tech, formTechSupport parent)
 {
     InitializeComponent();
     this.tech   = tech;
     this.parent = parent;
 }
Ejemplo n.º 3
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;
                        }
                    }
                }
            }
        }