//////////////////////////////////////////////////////////////////////////////////////////// // Internal Events //////////////////////////////////////////////////////////////////////////////////////////// private void accountBindingNavigatorSaveItem_Click(object sender, EventArgs e) { this.accountBindingSource.EndEdit(); this.eADataSet.myUpdateAccountDB(); DBquery.deleteOrphanELines(); this.buildAccountTree(); }
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(); }
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; }
private void e_Finder_DoWork(object sender, DoWorkEventArgs e) { int accountID = (int)e.Argument; e_TransactionErrors = DBquery.getTransactionErrors(accountID); e_LineErrors = DBquery.getLineErrors(accountID); }
private void envelopesCheckBox_Click(object sender, EventArgs e) { string text; string caption; DialogResult res; // If still using envelopes return if (envelopesCheckBox.Checked == true) { return; } int count = DBquery.getELineCount(currentID); if (count < 1) { return; } caption = "Delete Envelope Lines?"; text = "By removing the use of envelopes from this account \n"; text += count.ToString() + " envelope lines will be deleted. \n\n"; text += "Click YES if you want this to happen."; res = MessageBox.Show(text, caption, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button3); if (res != DialogResult.Yes) { this.envelopesCheckBox.Checked = true; } }
private void handleThisEnvelopeNode(EnvelopeNode envNode) { int envelopeID = envNode.EnvelopeID; foreach (var item in DBquery.getSubEnvelopeBalances(envelopeID)) { AENode node = new AENode(item.ID, envelopeID, item.Name, item.SubBalance); node.ImageId = (int)NodeImage.Bank; envNode.Nodes.Add(node); } }
private void handleThisGroupNode(GroupNode gNode) { // Fill with names foreach (var item in DBquery.getEnvelopeNamesByGroup(gNode.GroupID)) { gNode.Nodes.Add(new EnvelopeNode(item.ID, item.Name)); } // Fill in the balances foreach (var item in DBquery.getEnvelopeBalancesByGroup(gNode.GroupID)) { this.updateBalanceRecurse(gNode, SpclAccount.NULL, item.ID, item.Balance); } }
private void handleThisAccountNode(AccountNode accNode) { int accountID = accNode.AccountID; if (accNode.Catagory == SpclAccountCat.ACCOUNT) { foreach (var item in DBquery.getSubAccountBalances(accountID)) { AENode node = new AENode(accountID, item.ID, item.Name, item.SubBalance); node.ImageId = (int)NodeImage.Envelope; accNode.Nodes.Add(node); } } this.setErrorFlag(accNode); }
public void myInit() { // Initialize Table Adapters this.accountTypeTA = new AccountTypeTableAdapter(); this.accountTA = new AccountTableAdapter(); this.envelopeTA = new EnvelopeTableAdapter(); this.lineTypeTA = new LineTypeTableAdapter(); this.lineItemTA = new LineItemTableAdapter(); this.eLineTA = new EnvelopeLineTableAdapter(); // Initialize Maps this.accountMap = new Dictionary <string, int>(); this.envelopeMap = new Dictionary <string, int>(); // Fillup certain tables (Tables that can allow overlap of imported data) this.accountTypeTA.Fill(this.AccountType); this.lineTypeTA.Fill(this.LineType); // Setup ID Counters this.AccountID = DBquery.getNewID("id", "Account"); this.AccountTypeID = DBquery.getNewID("id", "AccountType"); this.EnvelopeID = DBquery.getNewID("id", "Envelope"); this.LineTypeID = DBquery.getNewID("id", "LineType"); this.LineItemID = DBquery.getNewID("id", "LineItem"); this.TransactionID = DBquery.getNewID("transactionID", "LineItem"); this.EnvelopeLineID = DBquery.getNewID("id", "EnvelopeLine"); // Subscribe to table events this.Account.TableNewRow += new System.Data.DataTableNewRowEventHandler(Account_TableNewRow); this.Account.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging); this.AccountType.TableNewRow += new System.Data.DataTableNewRowEventHandler(AccountType_TableNewRow); this.AccountType.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging); this.Envelope.TableNewRow += new System.Data.DataTableNewRowEventHandler(Envelope_TableNewRow); this.Envelope.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging); this.EnvelopeLine.TableNewRow += new System.Data.DataTableNewRowEventHandler(EnvelopeLine_TableNewRow); this.EnvelopeLine.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging); this.LineItem.TableNewRow += new System.Data.DataTableNewRowEventHandler(LineItem_TableNewRow); this.LineItem.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging); this.LineType.TableNewRow += new System.Data.DataTableNewRowEventHandler(LineType_TableNewRow); this.LineType.ColumnChanging += new System.Data.DataColumnChangeEventHandler(ColumnChanging); }
private static bool createDataBase(string path) { bool result = false; try { AppDomain.CurrentDomain.SetData("DataDirectory", path); result = DBquery.createDBFile(); } catch { MessageBox.Show("Failed to create the database file.", "", MessageBoxButtons.OK, MessageBoxIcon.Stop); result = false; } return result; }
private static bool setPath(string dbDir) { bool result = false; string dbFilePath = dbDir + "\\" + Properties.Settings.Default.DBFileName; if (File.Exists(dbFilePath)) { try { AppDomain.CurrentDomain.SetData("DataDirectory", dbDir); result = DBquery.goodPath(); } catch { result = false; } } return result; }
private void handleThisTypeNode(TypeNode tNode) { byte cat = tNode.Catagory; // Fill with account Names by type foreach (var item in DBquery.getAccountNamesByCatagoryAndType(cat, tNode.TypeID)) { tNode.Nodes.Add(new AccountNode(cat, item.ID, item.Name, item.Envelopes)); } // If this is an account add in the balances if (cat == SpclAccountCat.ACCOUNT) { foreach (var item in DBquery.getAccountBalancesByType(cat, tNode.TypeID)) { this.updateBalanceRecurse(tNode, item.ID, SpclEnvelope.NULL, item.Balance); } } this.setErrorFlag(tNode); }
private void LineItem_TableNewRow(object sender, System.Data.DataTableNewRowEventArgs e) { stayOut = true; LineItemRow newLine = e.Row as LineItemRow; newLine.id = DBquery.getNewID("id", "LineItem"); newLine.transactionID = DBquery.getNewID("transactionID", "LineItem"); newLine.date = DateTime.Today; newLine.typeID = SpclLineType.NULL; newLine.accountID = currentAccountID; newLine.oppAccountID = SpclAccount.NULL; newLine.description = ""; newLine.confirmationNumber = ""; newLine.envelopeID = SpclEnvelope.NULL; newLine.complete = LineState.PENDING; newLine.amount = 0.00m; newLine.creditDebit = LineCD.CREDIT; newLine.lineError = false; newLine.transactionError = false; stayOut = false; }
private void EditAccountsForm_FormClosing(object sender, FormClosingEventArgs e) { this.accountBindingSource.EndEdit(); this.eADataSet.myUpdateAccountDB(); DBquery.deleteOrphanELines(); }
///////////////////////// // Function Public public void myFill(int transID) { this.EnvelopeLineTA.FillByTransID(this, transID); this.newID = DBquery.getNewID("id", "EnvelopeLine"); }
/////////////////////////////////////////////////////////////////////// // Functions Private /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // Functions Public /////////////////////////////////////////////////////////////////////// public void myFillTable() { this.groupTA.Fill(this); this.newID = DBquery.getNewID("id", "EnvelopeGroup"); }
///////////////////////// // Public Functions public void myFill(int transID) { this.LineItemTA.FillByTransID(this, transID); this.newLineID = DBquery.getNewID("id", "LineItem"); }
///////////////////////// // Functions Public public void myResetID() { this.newID = DBquery.getNewID("id", "Envelope"); }
private void handleThisRootNode(RootNode rNode) { Boolean groupAcc = this.groupAccountsMenuItem.Checked; Boolean groupEnv = this.groupEnvelopesMenuItem.Checked; byte cat = rNode.Catagory; if (groupEnv && cat == SpclAccountCat.ENVELOPE) { // Fill with Envelope Groups foreach (var item in DBquery.getEnvelopeGroups()) { rNode.Nodes.Add(new GroupNode(item.ID, item.Name)); } } else if (!groupEnv && cat == SpclAccountCat.ENVELOPE) { // Fill with All Envelope names foreach (var item in DBquery.getAllEnvelopeNames()) { rNode.Nodes.Add(new EnvelopeNode(item.ID, item.Name)); } // Fill all Envelope balances foreach (var item in DBquery.getAllEnvelopeBalances()) { this.updateBalanceRecurse(rNode, SpclAccount.NULL, item.ID, item.Balance); } } else if (groupAcc) { // Fill with the Account Types foreach (var item in DBquery.getAccountTypes(cat)) { rNode.Nodes.Add(new TypeNode(item.ID, item.Name, cat)); } } else if (cat == SpclAccountCat.ACCOUNT) { // Fill with All Account names foreach (var item in DBquery.getAccountNamesByCatagory(cat)) { rNode.Nodes.Add(new AccountNode(cat, item.ID, item.Name, item.Envelopes)); } // Fill all Account balances foreach (var item in DBquery.getAccountBalancesByCatagory(cat)) { this.updateBalanceRecurse(rNode, item.ID, SpclEnvelope.NULL, item.Balance); } } else if (cat == SpclAccountCat.EXPENSE || cat == SpclAccountCat.INCOME) { // Fill with the Account names. No balances foreach (var item in DBquery.getAccountNamesByCatagory(cat)) { rNode.Nodes.Add(new AccountNode(cat, item.ID, item.Name, false)); } } this.setErrorFlag(rNode); }
private void e_Finder_DoWork(object sender, DoWorkEventArgs e) { e.Result = DBquery.getAccountErrors(); }
public void stressFillDataBase() { stressDS = new StressDataSet(); rnd = new Random(); accountTypeTA = new AccountTypeTableAdapter(); lineTypeTA = new LineTypeTableAdapter(); envGroupTA = new EnvelopeGroupTableAdapter(); accountTA = new AccountTableAdapter(); envelopeTA = new EnvelopeTableAdapter(); lineTA = new LineItemTableAdapter(); envLineTA = new EnvelopeLineTableAdapter(); // Reset the database DBquery.dropTables(); DBquery.buildTables(); // Fill the data tables accountTypeTA.Fill(stressDS.AccountType); lineTypeTA.Fill(stressDS.LineType); envGroupTA.Fill(stressDS.EnvelopeGroup); accountTA.Fill(stressDS.Account); envelopeTA.Fill(stressDS.Envelope); lineTA.Fill(stressDS.LineItem); envLineTA.Fill(stressDS.EnvelopeLine); accountID = DBquery.getNewID("id", "Account"); aTypeID = DBquery.getNewID("id", "AccountType"); envelopeID = DBquery.getNewID("id", "Envelope"); eGroupID = DBquery.getNewID("id", "EnvelopeGroup"); eLineID = DBquery.getNewID("id", "EnvelopeLine"); lTypeID = DBquery.getNewID("id", "LineType"); lineID = DBquery.getNewID("id", "LineItem"); transID = DBquery.getNewID("transactionID", "LineItem"); date = DateTime.Now.AddMonths(-12 * 100).Date; addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addAccount(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); addEnvelope(); int num; // Make alot of entries while (date < DateTime.Now.AddMonths(3).Date) { num = rnd.Next(0, 10000); if (num == 0) { addAccountType(); } else if (num == 1) { addLineType(); } else if (num == 2) { addEnvelopeGroup(); } if (10 < num && num < 15) { addAccount(); } if (30 < num && num < 34) { addEnvelope(); } if (100 < num && num < 200) { complexTrans(); } else { simpleTrans(); } } // Save the data accountTypeTA.Update(stressDS.AccountType); lineTypeTA.Update(stressDS.LineType); envGroupTA.Update(stressDS.EnvelopeGroup); accountTA.Update(stressDS.Account); envelopeTA.Update(stressDS.Envelope); lineTA.Update(stressDS.LineItem); envLineTA.Update(stressDS.EnvelopeLine); }
/////////////////////////////////////////////////////////////////////// // Functions Private /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // Functions Public /////////////////////////////////////////////////////////////////////// public void myFillTable() { this.ACTableAdapter.Fill(this); this.newID = DBquery.getNewID("id", "AccountType"); }
/////////////////////////////////////////////////////////////////////// // Function Private /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // Functions Public /////////////////////////////////////////////////////////////////////// public void myFillTable() { this.LTTableAdapter.Fill(this); this.newID = DBquery.getNewID("id", "LineType"); }
///////////////////////// // Functions Public public void myResetID() { this.newID = DBquery.getNewID("id", "Account"); }