Exemple #1
0
        /// <summary>
        /// show or hide ribbon pages depending on authorization
        /// </summary>
        private void EvaluateMainViewAuth()
        {
            //handle ribbon pages auth
            foreach (var page in ribbon.Pages)
            {
                var pageTag = ((RibbonPage)page).Tag.ToString();
                if (!string.IsNullOrEmpty(pageTag))
                {
                    if (!_authEvaluator.IsFunctionAuthorized(pageTag, false))
                    {
                        ((RibbonPage)page).Visible = false;
                    }
                }
            }

            //handle ribbon auth
            var ribbonTag = ribbon.Tag.ToString();

            if (!string.IsNullOrEmpty(ribbonTag))
            {
                ribbon.Visible = _authEvaluator.IsFunctionAuthorized(ribbonTag);
            }
        }
Exemple #2
0
        private async void ManageKeyUpEvents(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Delete:

                if (!_authEvaluator.IsFunctionAuthorized(simpleButtonRemoveTest.Tag.ToString()))
                {
                    return;
                }
                //change focus to make sure that everything is validated.
                simpleButtonRemoveTest.Focus();
                //execute remove test.
                RemoveTestFromAR(this, EventArgs.Empty);
                break;

            case Keys.F6:

                if (!_authEvaluator.IsFunctionAuthorized(simpleButtonConfirm.Tag.ToString()))
                {
                    return;
                }
                //change focus to confim to which validates any control that has focus and thereby updating view model
                simpleButtonConfirm.Focus();
                //execute confim analysis request.
                OnConfirmAnalysisRequest(this, EventArgs.Empty);
                break;

            case Keys.F2:

                if (!_authEvaluator.IsFunctionAuthorized(simpleButtonSearch.Tag.ToString()))
                {
                    return;
                }

                //change focus to search button to which validates any control that has focus and thereby updating view model
                simpleButtonSearch.Focus();
                //execute search
                OnPatientSearch(this, EventArgs.Empty);
                break;

            case Keys.F7:

                if (!_authEvaluator.IsFunctionAuthorized(simpleButtonSearchRequest.Tag.ToString()))
                {
                    return;
                }

                //change focus to search request button to which validates any control that has focus and thereby updating view model
                simpleButtonSearchRequest.Focus();

                try
                {
                    //execute search
                    await InitializeRequestSearchByCinAsync();
                }
                catch (Exception ex)
                {
                    XtraMessageBox.Show(ex.Message);
                }

                break;

            default:
                break;
            }
        }