예제 #1
0
        private void cbFormType_SelectedIndexChanged(object sender, EventArgs e)
        {
            Program.permissionLevels permission = (Program.permissionLevels)cbFormType.SelectedItem;

            switch (permission)
            {
            case Program.permissionLevels.User:
                userScheme();
                break;

            case Program.permissionLevels.TechSupport:
                techScheme();
                break;

            case Program.permissionLevels.Admin:
                adminScheme();
                break;

            default:
                break;
            }
        }
예제 #2
0
        public formSignUp(formAccount formParent, Account account, int access)
        {
            InitializeComponent();
            this.formParent = formParent;
            cbFormType.Show();
            labFormType.Show();
            cbFormType.Items.Add(Program.permissionLevels.User);
            cbFormType.Items.Add(Program.permissionLevels.TechSupport);
            cbFormType.Items.Add(Program.permissionLevels.Admin);
            Program.permissionLevels permission = (Program.permissionLevels)access;

            switch (permission)
            {
            case Program.permissionLevels.User:
                this.userScheme();
                cbFormType.SelectedIndex = 0;
                this.cbFormType.Refresh();
                break;

            case Program.permissionLevels.TechSupport:
                this.techScheme();
                cbFormType.SelectedIndex = 1;
                this.cbFormType.Refresh();
                break;

            case Program.permissionLevels.Admin:
                this.adminScheme();
                cbFormType.SelectedIndex = 2;
                this.cbFormType.Refresh();
                break;

            default:
                MessageBox.Show("Exception, wrong permission");
                return;
            }
        }
예제 #3
0
        private void btnSignUp_Click(object sender, EventArgs e)
        {
            resetValidLables();

            List <bool> valid = new List <bool>();

            Program.permissionLevels permission = (Program.permissionLevels)cbFormType.SelectedItem;

            switch (permission)
            {
            case Program.permissionLevels.User:
                valid.Add(checkIfUsernameExists());
                valid.Add(checkUsername());
                valid.Add(checkPassword());
                valid.Add(checkPasswordsMatch());
                valid.Add(checkFname());
                valid.Add(checkLname());
                valid.Add(checkDate());
                valid.Add(checkCity());
                valid.Add(checkMaritalStatus());
                valid.Add(checkInfo());
                break;

            case Program.permissionLevels.TechSupport:
                valid.Add(checkIfUsernameExists());
                valid.Add(checkUsername());
                valid.Add(checkPassword());
                valid.Add(checkPasswordsMatch());
                valid.Add(checkFname());
                valid.Add(checkLname());
                break;

            case Program.permissionLevels.Admin:
                valid.Add(checkIfUsernameExists());
                valid.Add(checkUsername());
                valid.Add(checkPassword());
                valid.Add(checkPasswordsMatch());
                valid.Add(checkFname());
                valid.Add(checkLname());
                break;

            default:
                MessageBox.Show("Exceptional Exception - permission unknown - exiting program");
                return;

                break;
            }

            if (valid.Contains(false) == false)
            {
                switch (permission)
                {
                case Program.permissionLevels.User:
                    User user = new User(txtUsername.Text, txtFname.Text, txtLname.Text, txtPassword.Text,
                                         cbMaritalStatus.SelectedText, txtDob.Text, txtCity.Text, txtInfo.Text, "");
                    this.database.addUser(user);
                    break;

                case Program.permissionLevels.TechSupport:
                    TechSupport tech = new TechSupport(txtUsername.Text, txtFname.Text, txtLname.Text, txtPassword.Text);
                    this.database.addTech(tech);
                    break;

                case Program.permissionLevels.Admin:
                    Admin admin = new Admin(txtUsername.Text, txtFname.Text, txtLname.Text, txtPassword.Text);
                    this.database.addAdmin(admin);
                    break;

                default:
                    MessageBox.Show("Exceptional Exception - permission unknown - exiting program");
                    return;

                    break;
                }

                MessageBox.Show("Succesful!");
                this.Close();
            }
        }