Example #1
0
        private void btnCreateUser_Click(object sender, EventArgs e)
        {
            bool userInfoIsValid = ValidateUserInformation();

            if (!userInfoIsValid)
            {
                return;
            }

            UserAccount newUser = new UserAccount(txtUsername.Text, txtUserPassword.Text, false);

            newUser.EmailAddress = txtEmailAddress.Text;
            newUser.FirstName    = txtFirstName.Text;
            newUser.LastName     = txtLastName.Text;
            newUser.PhoneNumber  = txtPhoneNumber.Text;

            foreach (object item in chklstRoles.CheckedItems)
            {
                PermissionSet permissionSet = new PermissionSet();
                switch (item.ToString())
                {
                case "Operational Manager":
                    permissionSet.IsManager        = true;
                    permissionSet.IsStockClerk     = true;
                    permissionSet.IsCustomer       = true;
                    permissionSet.IsWorkSpecialist = true;
                    break;

                case "Sales Person": permissionSet.IsCustomer = true;
                    break;

                case "Printing / Engraving Specialist": permissionSet.IsWorkSpecialist = true;
                    break;

                case "Stock Clerk": permissionSet.IsStockClerk = true;
                    break;
                }
                newUser.PermissionSet = permissionSet;
            }

            int returnValue = ApplicationObjects.NewUser(newUser);

            ApplicationObjects.DisplayDataStatus(returnValue);
            if (returnValue == 1)
            {
                return;
            }
            else if (returnValue == 2)
            {
                MessageBox.Show("A user by this name already exists.", "Duplicate User", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            _loginForm.ShowManagerMainForm(userAccount, _loginForm);
            this.Close();
        }
Example #2
0
        private void btnMainPage_Click_1(object sender, EventArgs e)
        {
            //if statement for user account: manager or sales oriented forms
            if (userAccount.PermissionSet.IsOperationsManager)
            {
                _loginForm.ShowManagerMainForm(userAccount, _loginForm);
            }


            else if (userAccount.PermissionSet.IsSalesPerson)
            {
                _loginForm.ShowSalesEmployeeForm(userAccount, _loginForm);
            }

            this.Close();
        }
        private void btnMainPage_Click(object sender, EventArgs e)
        {
            //if statement for manager user account is true then goes to manager page or else sales employee page

            if (userAccount.PermissionSet.IsOperationsManager)
            {
                _loginForm.ShowManagerMainForm(userAccount, _loginForm);
            }


            else if (userAccount.PermissionSet.IsSalesPerson)
            {
                _loginForm.ShowSalesEmployeeForm(userAccount, _loginForm);
            }

            this.Close();
        }
Example #4
0
        private void btnMainPage_Click(object sender, EventArgs e)
        {
            if (userAccount.PermissionSet.IsWorkSpecialist)
            {
                _loginForm.ShowWorkSpecialistForm(userAccount, _loginForm);
            }
            else if (userAccount.PermissionSet.IsOperationsManager)
            {
                _loginForm.ShowManagerMainForm(userAccount, _loginForm);
            }
            else if (userAccount.PermissionSet.IsSalesPerson)
            {
                _loginForm.ShowSalesEmployeeForm(userAccount, _loginForm);
            }
            else if (userAccount.PermissionSet.IsWorkSpecialist)
            {
                _loginForm.ShowWorkSpecialistForm(userAccount, _loginForm);
            }

            this.Close();
        }
        private void btnGO_Click(object sender, EventArgs e)
        {
            switch (cbRole.SelectedItem.ToString())
            {
            case ("Operations Manager"):
                userAccount.PermissionSet.IsSalesPerson    = false;
                userAccount.PermissionSet.IsStockClerk     = false;
                userAccount.PermissionSet.IsWorkSpecialist = false;
                _loginForm.ShowManagerMainForm(userAccount, _loginForm);
                this.Close();
                break;

            case ("Sales Person"):
                userAccount.PermissionSet.IsOperationsManager = false;
                userAccount.PermissionSet.IsStockClerk        = false;
                userAccount.PermissionSet.IsWorkSpecialist    = false;
                _loginForm.ShowSalesEmployeeForm(userAccount, _loginForm);
                this.Close();
                break;

            case ("Printing / Engraving Specialist"):
                userAccount.PermissionSet.IsOperationsManager = false;
                userAccount.PermissionSet.IsSalesPerson       = false;
                userAccount.PermissionSet.IsStockClerk        = false;
                _loginForm.ShowWorkSpecialistForm(userAccount, _loginForm);
                this.Close();
                break;

            case ("Stock Room Clerk"):
                userAccount.PermissionSet.IsOperationsManager = false;
                userAccount.PermissionSet.IsSalesPerson       = false;
                userAccount.PermissionSet.IsWorkSpecialist    = false;
                _loginForm.ShowStockClerkForm(userAccount, _loginForm);
                this.Close();
                break;
            }
        }
 private void btnMainPage_Click(object sender, EventArgs e)
 {
     _loginForm.ShowManagerMainForm(userAccount, _loginForm);
     this.Close();
 }