Rock.Apps.StatementGenerator.ContributionReport.innerReport_OpeningRecordSet C# (CSharp) Method

innerReport_OpeningRecordSet() protected method

Handles the OpeningRecordSet event of the innerReport control.
protected innerReport_OpeningRecordSet ( object sender, OpeningRecordSetEventArgs e ) : void
sender object The source of the event.
e OpeningRecordSetEventArgs The instance containing the event data.
return void
        protected void innerReport_OpeningRecordSet( object sender, OpeningRecordSetEventArgs e )
        {
            RecordIndex++;
            UpdateProgress( "Processing..." );

            int? personId = null;
            int groupId = 0;

            personId = e.LayoutWriter.RecordSets.Current["PersonId"].ToString().AsIntegerOrNull();
            groupId = e.LayoutWriter.RecordSets.Current["GroupId"].ToString().AsInteger();

            string uriParam;

            if ( personId.HasValue )
            {
                uriParam = string.Format( "api/FinancialTransactions/GetContributionTransactions/{0}/{1}", groupId, personId );
            }
            else
            {
                uriParam = string.Format( "api/FinancialTransactions/GetContributionTransactions/{0}", groupId );
            }

            DataSet transactionsDataSet = _rockRestClient.PostDataWithResult<object, DataSet>( uriParam, _contributionStatementOptionsREST );
            _transactionsDataTable = transactionsDataSet.Tables[0];

            e.RecordSet = new DataTableRecordSet( _transactionsDataTable );
        }