本文整理汇总了C#中Rock.Model.FinancialTransactionService.Save方法的典型用法代码示例。如果您正苦于以下问题:C# FinancialTransactionService.Save方法的具体用法?C# FinancialTransactionService.Save怎么用?C# FinancialTransactionService.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Rock.Model.FinancialTransactionService
的用法示例。
在下文中一共展示了FinancialTransactionService.Save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessConfirmation
/// <summary>
/// Processes the confirmation.
/// </summary>
/// <param name="errorMessage">The error message.</param>
/// <returns></returns>
private bool ProcessConfirmation( out string errorMessage )
{
if ( string.IsNullOrWhiteSpace( TransactionCode ) )
{
GatewayComponent gateway = hfPaymentTab.Value == "ACH" ? _achGateway : _ccGateway;
if ( gateway == null )
{
errorMessage = "There was a problem creating the payment gateway information";
return false;
}
Person person = GetPerson( true );
if ( person == null )
{
errorMessage = "There was a problem creating the person information";
return false;
}
PaymentInfo paymentInfo = GetPaymentInfo();
if ( paymentInfo == null )
{
errorMessage = "There was a problem creating the payment information";
return false;
}
else
{
paymentInfo.FirstName = person.FirstName;
paymentInfo.LastName = person.LastName;
}
if ( paymentInfo.CreditCardTypeValue != null )
{
CreditCardTypeValueId = paymentInfo.CreditCardTypeValue.Id;
}
PaymentSchedule schedule = GetSchedule();
if ( schedule != null )
{
schedule.PersonId = person.Id;
var scheduledTransaction = gateway.AddScheduledPayment( schedule, paymentInfo, out errorMessage );
if ( scheduledTransaction != null )
{
scheduledTransaction.TransactionFrequencyValueId = schedule.TransactionFrequencyValue.Id;
scheduledTransaction.AuthorizedPersonId = person.Id;
scheduledTransaction.GatewayEntityTypeId = EntityTypeCache.Read( gateway.TypeGuid ).Id;
foreach ( var account in SelectedAccounts.Where( a => a.Amount > 0 ) )
{
var transactionDetail = new FinancialScheduledTransactionDetail();
transactionDetail.Amount = account.Amount;
transactionDetail.AccountId = account.Id;
scheduledTransaction.ScheduledTransactionDetails.Add( transactionDetail );
}
var transactionService = new FinancialScheduledTransactionService();
transactionService.Add( scheduledTransaction, CurrentPersonId );
transactionService.Save( scheduledTransaction, CurrentPersonId );
ScheduleId = scheduledTransaction.GatewayScheduleId;
TransactionCode = scheduledTransaction.TransactionCode;
}
else
{
return false;
}
}
else
{
var transaction = gateway.Charge( paymentInfo, out errorMessage );
if ( transaction != null )
{
transaction.TransactionDateTime = DateTime.Now;
transaction.AuthorizedPersonId = person.Id;
transaction.GatewayEntityTypeId = gateway.TypeId;
transaction.Amount = paymentInfo.Amount;
transaction.TransactionTypeValueId = DefinedValueCache.Read(new Guid(Rock.SystemGuid.DefinedValue.TRANSACTION_TYPE_CONTRIBUTION)).Id;
transaction.CurrencyTypeValueId = paymentInfo.CurrencyTypeValue.Id;
transaction.CreditCardTypeValueId = CreditCardTypeValueId;
Guid sourceGuid = Guid.Empty;
if (Guid.TryParse(GetAttributeValue("Source"), out sourceGuid))
{
transaction.SourceTypeValueId = DefinedValueCache.Read(sourceGuid).Id;
}
foreach ( var account in SelectedAccounts.Where( a => a.Amount > 0 ) )
{
var transactionDetail = new FinancialTransactionDetail();
transactionDetail.Amount = account.Amount;
transactionDetail.AccountId = account.Id;
transaction.TransactionDetails.Add( transactionDetail );
}
// Get the batch name
string ccSuffix = string.Empty;
//.........这里部分代码省略.........
示例2: rGridTransactions_Delete
/// <summary>
/// Handles the Delete event of the rGridTransactions control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="Rock.Web.UI.Controls.RowEventArgs"/> instance containing the event data.</param>
protected void rGridTransactions_Delete( object sender, Rock.Web.UI.Controls.RowEventArgs e )
{
var financialTransactionService = new Rock.Model.FinancialTransactionService();
FinancialTransaction financialTransaction = financialTransactionService.Get( (int)e.RowKeyValue );
if ( financialTransaction != null )
{
financialTransactionService.Delete( financialTransaction, CurrentPersonId );
financialTransactionService.Save( financialTransaction, CurrentPersonId );
}
BindGrid();
}