private void ShowAdminView()
        {
            var eoMainForm = new EoMainForm();

            eoMainForm.Show();
            Hide();
        }
Ejemplo n.º 2
0
        private void btnAuthenticate_Click(object sender, EventArgs e)
        {
            var model = new UserModel
            {
                Username = txtUsername.Text,
                Password = txtPassword.Text
            };

            var result = _accountController.Authenticate(model);

            if (!result.Success)
            {
                lblError.Text = (string)result.Data;
            }
            else
            {
                var user = (UserModel)result.Data;
                if (!user.IsAdmin && !user.IsActiveEO)
                {
                    MessageBox.Show($@"Contact the admin of the software to authorize your acccout",
                                    "Account Issue",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);

                    return;
                }

                if (user.IsAdmin)
                {
                    AdminMainForm adminMainForm = new AdminMainForm();
                    adminMainForm.Show();
                    Hide();
                }

                if (user.IsActiveEO)
                {
                    var eoMainForm = new EoMainForm();
                    eoMainForm.Show();
                    Hide();
                }
            }
        }