/// <summary> /// Handles the Click event of the btnSaveAccount 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 btnSaveAccount_Click(object sender, EventArgs e) { using (new Rock.Data.UnitOfWorkScope()) { var accountService = new Rock.Model.FinancialAccountService(); Rock.Model.FinancialAccount modifiedAccount; int accountId = (hfAccountId.Value) != null?Int32.Parse(hfAccountId.Value) : 0; if (accountId == 0) { modifiedAccount = new Rock.Model.FinancialAccount(); accountService.Add(modifiedAccount, CurrentPersonId); } else { modifiedAccount = accountService.Get(accountId); } modifiedAccount.Name = tbName.Text; modifiedAccount.PublicName = tbPublicName.Text; modifiedAccount.Description = tbDescription.Text; modifiedAccount.Order = Int32.Parse(tbOrder.Text); modifiedAccount.GlCode = tbGLCode.Text; modifiedAccount.IsActive = cbIsActive.Checked; modifiedAccount.IsTaxDeductible = cbIsTaxDeductible.Checked; modifiedAccount.StartDate = dtpStartDate.SelectedDate; modifiedAccount.EndDate = dtpEndDate.SelectedDate; modifiedAccount.ParentAccountId = apParentAccount.SelectedValueAsInt(); modifiedAccount.AccountTypeValueId = ddlAccountType.SelectedValueAsInt(); accountService.Save(modifiedAccount, CurrentPersonId); } //BindCategoryFilter(); BindGrid(); pnlAccountDetails.Visible = false; pnlAccountList.Visible = true; }
/// <summary> /// Handles the Click event of the btnSave 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 btnSave_Click(object sender, EventArgs e) { FinancialAccount account; using (new Rock.Data.UnitOfWorkScope()) { var accountService = new Rock.Model.FinancialAccountService(); int accountId = Int32.Parse(hfAccountId.Value); if (accountId == 0) { account = new Rock.Model.FinancialAccount(); accountService.Add(account, CurrentPersonId); } else { account = accountService.Get(accountId); } account.Name = tbName.Text; account.IsActive = cbIsActive.Checked; account.Description = tbDescription.Text; account.ParentAccountId = apParentAccount.SelectedValueAsInt(); account.AccountTypeValueId = ddlAccountType.SelectedValueAsInt(); account.PublicName = tbPublicName.Text; account.GlCode = tbGLCode.Text; account.StartDate = dtpStartDate.SelectedDate; account.EndDate = dtpEndDate.SelectedDate; account.IsTaxDeductible = cbIsTaxDeductible.Checked; accountService.Save(account, CurrentPersonId); } NavigateToParentPage(); }
/// <summary> /// Handles the Click event of the btnSave 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 btnSave_Click( object sender, EventArgs e ) { FinancialAccount account; using ( new Rock.Data.UnitOfWorkScope() ) { var accountService = new Rock.Model.FinancialAccountService(); int accountId = Int32.Parse( hfAccountId.Value ); if ( accountId == 0 ) { account = new Rock.Model.FinancialAccount(); accountService.Add( account, CurrentPersonId ); } else { account = accountService.Get( accountId ); } account.Name = tbName.Text; account.IsActive = cbIsActive.Checked; account.Description = tbDescription.Text; account.ParentAccountId = apParentAccount.SelectedValueAsInt(); account.AccountTypeValueId = ddlAccountType.SelectedValueAsInt(); account.PublicName = tbPublicName.Text; account.GlCode = tbGLCode.Text; account.StartDate = dtpStartDate.SelectedDate; account.EndDate = dtpEndDate.SelectedDate; account.IsTaxDeductible = cbIsTaxDeductible.Checked; accountService.Save( account, CurrentPersonId ); } NavigateToParentPage(); }