/// <summary> /// Handles the Click event of the lbReactivateSchedule control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void lbReactivateSchedule_Click( object sender, EventArgs e ) { int? txnId = PageParameter( "ScheduledTransactionId" ).AsIntegerOrNull(); if ( txnId.HasValue ) { using ( var rockContext = new RockContext() ) { var txnService = new FinancialScheduledTransactionService( rockContext ); var txn = txnService .Queryable( "AuthorizedPersonAlias.Person,FinancialGateway" ) .FirstOrDefault( t => t.Id == txnId.Value ); if ( txn != null ) { if ( txn.FinancialGateway != null ) { txn.FinancialGateway.LoadAttributes( rockContext ); } string errorMessage = string.Empty; if ( txnService.Reactivate( txn, out errorMessage ) ) { txnService.GetStatus( txn, out errorMessage ); rockContext.SaveChanges(); } else { ShowErrorMessage( errorMessage ); } ShowView( txn ); } } } }
/// <summary> /// Handles the Click event of the btnReactivateSchedule control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnReactivateSchedule_Click(object sender, EventArgs e) { var financialScheduledTranactionGuid = GetScheduledTransactionGuidFromUrl(); if (!financialScheduledTranactionGuid.HasValue) { return; } using (var rockContext = new RockContext()) { var financialScheduledTransactionService = new FinancialScheduledTransactionService(rockContext); var financialScheduledTransaction = financialScheduledTransactionService.Queryable() .Include(a => a.AuthorizedPersonAlias.Person) .Include(a => a.FinancialGateway) .FirstOrDefault(t => t.Guid == financialScheduledTranactionGuid.Value); if (financialScheduledTransaction == null) { return; } if (financialScheduledTransaction.FinancialGateway != null) { financialScheduledTransaction.FinancialGateway.LoadAttributes(rockContext); } string errorMessage = string.Empty; if (financialScheduledTransactionService.Reactivate(financialScheduledTransaction, out errorMessage)) { financialScheduledTransactionService.GetStatus(financialScheduledTransaction, out errorMessage); rockContext.SaveChanges(); } else { ShowErrorMessage(errorMessage); } ShowView(financialScheduledTransaction); } }
/// <summary> /// Handles the Click event of the btnReactivateSchedule control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param> protected void btnReactivateSchedule_Click(object sender, EventArgs e) { int?financialScheduledTransactionId = PageParameter(PageParameterKey.ScheduledTransactionId).AsIntegerOrNull(); if (financialScheduledTransactionId.HasValue) { using (var rockContext = new RockContext()) { var financialScheduledTransactionService = new FinancialScheduledTransactionService(rockContext); var financialScheduledTransaction = financialScheduledTransactionService.Queryable() .Include(a => a.AuthorizedPersonAlias.Person) .Include(a => a.FinancialGateway) .FirstOrDefault(t => t.Id == financialScheduledTransactionId.Value); if (financialScheduledTransaction != null) { if (financialScheduledTransaction.FinancialGateway != null) { financialScheduledTransaction.FinancialGateway.LoadAttributes(rockContext); } string errorMessage = string.Empty; if (financialScheduledTransactionService.Reactivate(financialScheduledTransaction, out errorMessage)) { financialScheduledTransactionService.GetStatus(financialScheduledTransaction, out errorMessage); rockContext.SaveChanges(); } else { ShowErrorMessage(errorMessage); } ShowView(financialScheduledTransaction); } } } }