Esempio n. 1
0
        /// <summary>
        /// Handles the SaveClick event of the mdAccountsPersonalFilter 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 mdAccountsPersonalFilter_SaveClick(object sender, EventArgs e)
        {
            var selectedAccountIdList   = apPersonalAccounts.SelectedValuesAsInt().ToList();
            var selectedAccountGuidList = new FinancialAccountService(new RockContext()).GetByIds(selectedAccountIdList).Select(a => a.Guid).ToList();

            string keyPrefix = string.Format("transaction-matching-{0}-", this.BlockId);

            this.SetUserPreference(keyPrefix + "account-list", selectedAccountGuidList.AsDelimited(","));

            mdAccountsPersonalFilter.Hide();
            LoadDropDowns();
        }
Esempio n. 2
0
        /// <summary>
        /// Handles the SaveClick event of the mdAccountsPersonalFilter 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 mdAccountsPersonalFilter_SaveClick( object sender, EventArgs e )
        {
            var selectedAccountIdList = apPersonalAccounts.SelectedValuesAsInt().ToList();
            var selectedAccountGuidList = new FinancialAccountService( new RockContext() ).GetByIds( selectedAccountIdList ).Select( a => a.Guid ).ToList();

            string keyPrefix = string.Format( "transaction-matching-{0}-", this.BlockId );
            this.SetUserPreference( keyPrefix + "account-list", selectedAccountGuidList.AsDelimited( "," ) );

            mdAccountsPersonalFilter.Hide();
            LoadDropDowns();
        }
Esempio n. 3
0
        /// <summary>
        /// Handles the SaveClick event of the mdAccountsPersonalFilter 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 mdAccountsPersonalFilter_SaveClick( object sender, EventArgs e )
        {
            var selectedAccountIdList = apPersonalAccounts.SelectedValuesAsInt().ToList();
            var selectedAccountGuidList = new FinancialAccountService( new RockContext() ).GetByIds( selectedAccountIdList ).Select( a => a.Guid ).ToList();

            string keyPrefix = string.Format( "transaction-matching-{0}-", this.BlockId );
            this.SetUserPreference( keyPrefix + "account-list", selectedAccountGuidList.AsDelimited( "," ) );

            mdAccountsPersonalFilter.Hide();
            LoadDropDowns();

            // Reload the transaction amounts after changing the displayed accounts.
            int? transactionId = hfTransactionId.Value.AsIntegerOrNull();
            if (transactionId.HasValue)
            {
                using (var rockContext = new RockContext())
                {
                    var financialTransactionService = new FinancialTransactionService(rockContext);
                    var txn = financialTransactionService.Queryable().Where(t => t.Id == transactionId).SingleOrDefault();

                    foreach (var detail in txn.TransactionDetails)
                    {
                        var accountBox = rptAccounts.ControlsOfTypeRecursive<CurrencyBox>().Where(a => a.Attributes["data-account-id"].AsInteger() == detail.AccountId).FirstOrDefault();
                        if (accountBox != null)
                        {
                            accountBox.Text = detail.Amount.ToString();
                        }
                    }
                }
            }
        }