private void closedCheckBox_Click(object sender, EventArgs e) { string text; string caption; DialogResult res; // If "opening" an account return. if (closedCheckBox.Checked == false) { return; } if (this.eADataSet.Account.FindByid(this.currentID).catagory != SpclAccountCat.ACCOUNT) { return; } decimal balance = DBquery.getAccBalance(currentID); int count = DBquery.getAccountErrorCount(currentID); if (balance == 0.0m && count == 0) { return; } caption = "Zero balance needed"; text = "This account has a balance of " + balance.ToString("C2") + ". \n"; text += "This account has " + count.ToString() + " error(s). \n\n"; text += "Please get the balance to zero and resolve the errors before closing."; res = MessageBox.Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); closedCheckBox.Checked = false; }
public void updateBalance(List <AEPair> aeChanges) { decimal newBalance; foreach (AEPair pair in aeChanges) { if (pair.AccountID > SpclAccount.NULL && pair.EnvelopeID > SpclEnvelope.NOENVELOPE) { newBalance = DBquery.getAccBalance(pair.AccountID); this.updateBalanceRecurse(this.accountRootNode, pair.AccountID, SpclEnvelope.NULL, newBalance); newBalance = DBquery.getAEBalance(pair.AccountID, pair.EnvelopeID); this.updateBalanceRecurse(this.accountRootNode, pair.AccountID, pair.EnvelopeID, newBalance); this.updateBalanceRecurse(this.envelopeRootNode, pair.AccountID, pair.EnvelopeID, newBalance); newBalance = DBquery.getEnvBalance(pair.EnvelopeID); this.updateBalanceRecurse(this.envelopeRootNode, SpclAccount.NULL, pair.EnvelopeID, newBalance); } else if (pair.AccountID > SpclAccount.NULL) { newBalance = DBquery.getAccBalance(pair.AccountID); this.updateBalanceRecurse(this.accountRootNode, pair.AccountID, SpclEnvelope.NULL, newBalance); } } this.accTLV.Refresh(); findNewErrors(); }