本文整理汇总了C#中FinancialAccountService.IsAuthorized方法的典型用法代码示例。如果您正苦于以下问题:C# FinancialAccountService.IsAuthorized方法的具体用法?C# FinancialAccountService.IsAuthorized怎么用?C# FinancialAccountService.IsAuthorized使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FinancialAccountService
的用法示例。
在下文中一共展示了FinancialAccountService.IsAuthorized方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShowDetail
/// <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);
}
}
示例2: ShowDetail
/// <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 );
}
}
示例3: ShowDetail
/// <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 );
}
}