/// <summary>
        /// Method for deciding which View will open according to logged in Employee credentials
        /// </summary>
        private void LoginExecute()
        {
            try
            {
                switch (loggedEmployee.Role)
                {
                case "Admin":
                    AdminView adminMenu = new AdminView();
                    adminMenu.ShowDialog();
                    loginView.Close();
                    break;

                case "Employee":
                    EmployeeView employeeView = new EmployeeView(loggedEmployee.ID);
                    employeeView.ShowDialog();
                    loginView.Close();
                    break;

                case "Manager":
                    tblManager manager = Services.LogInService.GetManagerById(loggedEmployee.ID);
                    if (manager.AccessLevel == "Modify")
                    {
                        ModifyView modify = new ModifyView();
                        modify.ShowDialog();
                        loginView.Close();
                    }
                    else
                    {
                        ReadOnlyView readOnly = new ReadOnlyView();
                        readOnly.ShowDialog();
                        loginView.Close();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Пример #2
0
        private void LoginExecute()
        {
            try
            {
                switch (role.RoleName)
                {
                case "WPFadmin":
                    WPFadminView adminMenu = new WPFadminView();
                    adminMenu.ShowDialog();
                    break;

                case "Employee":
                    AddReportView addReport = new AddReportView();
                    addReport.ShowDialog();
                    break;

                case "Manager":
                    tblManager manager = Service.Service.GetManagerById(logged.EmployeeID);
                    if (manager.AccessLevel == "Modify")
                    {
                        ModifyView modify = new ModifyView();
                        modify.ShowDialog();
                    }
                    else
                    {
                        ReadOnlyView readOnly = new ReadOnlyView();
                        readOnly.ShowDialog();
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }