Beispiel #1
0
        private void UpdateRole()
        {
            _role.RoleName         = txtTitle.Text;
            _role.Description      = txtDescription.Text;
            _role.DefaultStartPage = (OStartPages.StartPages)defaultWindowComboBox.Tag;

            try
            {
                RoleServices.RoleErrors roleErrors = ServicesProvider.GetInstance().GetRoleServices().UpdateRole(_role);
                if (roleErrors.FindError)
                {
                    MessageBox.Show(GetString(roleErrors.ErrorCode), "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                UpdateControlStatus();
                User.CurrentUser = ServicesProvider.GetInstance().GetUserServices().Find(User.CurrentUser.Id, true);
                //clean deid menu
                foreach (MenuObject item in GetDeidMenuItems())
                {
                    ServicesProvider.GetInstance().GetMenuItemServices().DeleteMenuItem(item);
                }
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }
            EraseRole();
        }
Beispiel #2
0
        private void SaveRole()
        {
            _role.RoleName        = txtTitle.Text;
            _role.Description     = txtDescription.Text;
            _role.IsRoleForLoan   = trvOptions.Nodes[0].Checked;
            _role.IsRoleForSaving = trvOptions.Nodes[1].Checked;
            _role.IsRoleForTeller = trvOptions.Nodes[2].Checked;

            try
            {
                RoleServices.RoleErrors roleErrors = ServicesProvider.GetInstance().GetRoleServices().SaveRole(_role);
                if (roleErrors.FindError)
                {
                    MessageBox.Show(GetString(roleErrors.ErrorCode), "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                UpdateControlStatus();
                User.CurrentUser = ServicesProvider.GetInstance().GetUserServices().Find(User.CurrentUser.Id, true);
            }
            catch (Exception ex)
            {
                new frmShowError(CustomExceptionHandler.ShowExceptionText(ex)).ShowDialog();
            }

            EraseRole();
        }