Ejemplo n.º 1
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="accountId">The account identifier.</param>
        public void ShowDetail(int accountId)
        {
            FinancialAccount account = null;

            bool editAllowed = UserCanEdit;

            if (!accountId.Equals(0))
            {
                account     = new FinancialAccountService(new RockContext()).Get(accountId);
                editAllowed = editAllowed || account.IsAuthorized(Authorization.EDIT, CurrentPerson);
                pdAuditDetails.SetEntity(account, ResolveRockUrl("~"));
            }

            if (account == null)
            {
                account = new FinancialAccount {
                    Id = 0, IsActive = true
                };
                // hide the panel drawer that show created and last modified dates
                pdAuditDetails.Visible = false;
            }

            hfAccountId.Value = account.Id.ToString();

            nbEditModeMessage.Text = string.Empty;
            if (editAllowed)
            {
                ShowEditDetails(account);
            }
            else
            {
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(FinancialAccount.FriendlyTypeName);
                ShowReadonlyDetails(account);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="accountId">The account identifier.</param>
        public void ShowDetail( int accountId )
        {
            FinancialAccount account = null;

            bool editAllowed = UserCanEdit;

            if ( !accountId.Equals( 0 ) )
            {
                account = new FinancialAccountService( new RockContext() ).Get( accountId );
                editAllowed = editAllowed || account.IsAuthorized( Authorization.EDIT, CurrentPerson );
                pdAuditDetails.SetEntity( account, ResolveRockUrl( "~" ) );
            }

            if ( account == null )
            {
                account = new FinancialAccount { Id = 0, IsActive = true };
                // hide the panel drawer that show created and last modified dates
                pdAuditDetails.Visible = false;
            }

            hfAccountId.Value = account.Id.ToString();

            nbEditModeMessage.Text = string.Empty;
            if (editAllowed)
            {
                ShowEditDetails(account);
            }
            else
            {
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(FinancialAccount.FriendlyTypeName);
                ShowReadonlyDetails(account);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="itemKey">The item key.</param>
        /// <param name="itemKeyValue">The item key value.</param>
        public void ShowDetail(string itemKey, int itemKeyValue)
        {
            pnlDetails.Visible = false;

            if (!itemKey.Equals("accountId"))
            {
                return;
            }

            bool editAllowed = true;

            FinancialAccount account = null;

            if (!itemKeyValue.Equals(0))
            {
                account     = new FinancialAccountService(new RockContext()).Get(itemKeyValue);
                editAllowed = account.IsAuthorized(Authorization.EDIT, CurrentPerson);
            }
            else
            {
                account = new FinancialAccount {
                    Id = 0, IsActive = true
                };
            }

            if (account == null)
            {
                return;
            }

            pnlDetails.Visible = true;
            hfAccountId.Value  = account.Id.ToString();

            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if (!editAllowed || !IsUserAuthorized(Authorization.EDIT))
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(FinancialAccount.FriendlyTypeName);
            }

            if (readOnly)
            {
                ShowReadonlyDetails(account);
            }
            else
            {
                ShowEditDetails(account);
            }
        }
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="itemKey">The item key.</param>
        /// <param name="itemKeyValue">The item key value.</param>
        public void ShowDetail( string itemKey, int itemKeyValue )
        {
            pnlDetails.Visible = false;

            if ( !itemKey.Equals( "accountId" ) )
            {
                return;
            }

            bool editAllowed = true;

            FinancialAccount account = null;

            if ( !itemKeyValue.Equals( 0 ) )
            {
                account = new FinancialAccountService( new RockContext() ).Get( itemKeyValue );
                editAllowed = account.IsAuthorized( Authorization.EDIT, CurrentPerson );
            }
            else
            {
                account = new FinancialAccount { Id = 0, IsActive = true };
            }

            if ( account == null )
            {
                return;
            }

            pnlDetails.Visible = true;
            hfAccountId.Value = account.Id.ToString();

            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if ( !editAllowed || !IsUserAuthorized( Authorization.EDIT ) )
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed( FinancialAccount.FriendlyTypeName );
            }

            if ( readOnly )
            {
                ShowReadonlyDetails( account );
            }
            else
            {
                ShowEditDetails( account );
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="accountId">The account identifier.</param>
        public void ShowDetail(int accountId)
        {
            FinancialAccount account = null;

            bool editAllowed = UserCanEdit;

            if (!accountId.Equals(0))
            {
                account     = new FinancialAccountService(new RockContext()).Get(accountId);
                editAllowed = editAllowed || account.IsAuthorized(Authorization.EDIT, CurrentPerson);
            }

            if (account == null)
            {
                account = new FinancialAccount {
                    Id = 0, IsActive = true
                };
            }

            hfAccountId.Value = account.Id.ToString();

            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if (!editAllowed || !editAllowed)
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed(FinancialAccount.FriendlyTypeName);
            }

            if (readOnly)
            {
                ShowReadonlyDetails(account);
            }
            else
            {
                ShowEditDetails(account);
            }
        }
        /// <summary>
        /// Shows the detail.
        /// </summary>
        /// <param name="accountId">The account identifier.</param>
        public void ShowDetail( int accountId )
        {
            FinancialAccount account = null;

            bool editAllowed = UserCanEdit;

            if ( !accountId.Equals( 0 ) )
            {
                account = new FinancialAccountService( new RockContext() ).Get( accountId );
                editAllowed = editAllowed || account.IsAuthorized( Authorization.EDIT, CurrentPerson );
            }

            if ( account == null )
            {
                account = new FinancialAccount { Id = 0, IsActive = true };
            }

            hfAccountId.Value = account.Id.ToString();

            bool readOnly = false;

            nbEditModeMessage.Text = string.Empty;
            if ( !editAllowed || !editAllowed )
            {
                readOnly = true;
                nbEditModeMessage.Text = EditModeMessage.ReadOnlyEditActionNotAllowed( FinancialAccount.FriendlyTypeName );
            }

            if ( readOnly )
            {
                ShowReadonlyDetails( account );
            }
            else
            {
                ShowEditDetails( account );
            }
        }