/// <summary> /// Shows the account dialog. /// </summary> /// <param name="guid">The unique identifier.</param> private void ShowAccountDialog(Guid guid) { hfAccountGuid.Value = guid.ToString(); var txnDetail = TransactionDetailsState.Where(d => d.Guid.Equals(guid)).FirstOrDefault(); if (txnDetail != null) { apAccount.SetValue(txnDetail.AccountId); tbAccountAmount.Text = txnDetail.Amount.ToString("N2"); tbAccountSummary.Text = txnDetail.Summary; if (txnDetail.Attributes == null) { txnDetail.LoadAttributes(); } } else { apAccount.SetValue(null); tbAccountAmount.Text = string.Empty; tbAccountSummary.Text = string.Empty; txnDetail = new FinancialScheduledTransactionDetail(); txnDetail.LoadAttributes(); } phAccountAttributeEdits.Controls.Clear(); Helper.AddEditControls(txnDetail, phAccountAttributeEdits, true, mdAccount.ValidationGroup); ShowDialog("ACCOUNT"); }
/// <summary> /// Handles the SaveClick event of the mdAccount 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 mdAccount_SaveClick(object sender, EventArgs e) { Guid?guid = hfAccountGuid.Value.AsGuidOrNull(); if (guid.HasValue) { var txnDetail = TransactionDetailsState.Where(t => t.Guid.Equals(guid.Value)).FirstOrDefault(); if (txnDetail == null) { txnDetail = new FinancialScheduledTransactionDetail(); TransactionDetailsState.Add(txnDetail); } txnDetail.AccountId = apAccount.SelectedValue.AsInteger(); txnDetail.Amount = tbAccountAmount.Text.AsDecimal(); txnDetail.Summary = tbAccountSummary.Text; txnDetail.LoadAttributes(); Rock.Attribute.Helper.GetEditValues(phAccountAttributeEdits, txnDetail); foreach (var attributeValue in txnDetail.AttributeValues) { txnDetail.SetAttributeValue(attributeValue.Key, attributeValue.Value.Value); } BindAccounts(); } HideDialog(); }
/// <summary> /// Handles the SaveClick event of the mdAccount 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 mdAccount_SaveClick(object sender, EventArgs e) { Guid?guid = hfAccountGuid.Value.AsGuidOrNull(); if (guid.HasValue) { var financialTransactionDetail = TransactionDetailsState.Where(t => t.Guid.Equals(guid.Value)).FirstOrDefault(); if (financialTransactionDetail == null) { financialTransactionDetail = new FinancialScheduledTransactionDetail(); TransactionDetailsState.Add(financialTransactionDetail); } financialTransactionDetail.AccountId = apAccount.SelectedValue.AsInteger(); var feeCoverageAmount = tbAccountFeeCoverageAmount.Value; financialTransactionDetail.Amount = (tbAccountAmountMinusFeeCoverageAmount.Value ?? 0.0M) + (feeCoverageAmount ?? 0.00M); financialTransactionDetail.FeeCoverageAmount = feeCoverageAmount; financialTransactionDetail.Summary = tbAccountSummary.Text; financialTransactionDetail.LoadAttributes(); Rock.Attribute.Helper.GetEditValues(phAccountAttributeEdits, financialTransactionDetail); foreach (var attributeValue in financialTransactionDetail.AttributeValues) { financialTransactionDetail.SetAttributeValue(attributeValue.Key, attributeValue.Value.Value); } BindAccounts(); } HideDialog(); }
/// <summary> /// Handles the DeleteClick event of the gAccountsEdit control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RowEventArgs"/> instance containing the event data.</param> protected void gAccountsEdit_DeleteClick(object sender, RowEventArgs e) { Guid?guid = e.RowKeyValue.ToString().AsGuidOrNull(); if (guid.HasValue) { var txnDetail = TransactionDetailsState.Where(t => t.Guid.Equals(guid.Value)).FirstOrDefault(); if (txnDetail != null) { TransactionDetailsState.Remove(txnDetail); } BindAccounts(); } }
/// <summary> /// Handles the SaveClick event of the mdAccount 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 mdAccount_SaveClick(object sender, EventArgs e) { Guid?guid = hfAccountGuid.Value.AsGuidOrNull(); if (guid.HasValue) { var txnDetail = TransactionDetailsState.Where(t => t.Guid.Equals(guid.Value)).FirstOrDefault(); if (txnDetail == null) { txnDetail = new FinancialTransactionDetail(); TransactionDetailsState.Add(txnDetail); } txnDetail.AccountId = ddlAccount.SelectedValue.AsInteger(); txnDetail.Amount = tbAccountAmount.Text.AsDecimal(); txnDetail.Summary = tbAccountSummary.Text; BindAccounts(); } HideDialog(); }
/// <summary> /// Shows the account dialog. /// </summary> /// <param name="guid">The unique identifier.</param> private void ShowAccountDialog(Guid guid) { hfAccountGuid.Value = guid.ToString(); var txnDetail = TransactionDetailsState.Where(d => d.Guid.Equals(guid)).FirstOrDefault(); if (txnDetail != null) { ddlAccount.SetValue(txnDetail.AccountId); tbAccountAmount.Text = txnDetail.Amount.ToString("N2"); tbAccountSummary.Text = txnDetail.Summary; } else { ddlAccount.SelectedIndex = -1; tbAccountSummary.Text = string.Empty; tbAccountSummary.Text = string.Empty; } ShowDialog("ACCOUNT"); _focusControl = tbAccountAmount; }