private void ShowTransactions() { this.dataGridView1.Rows.Clear(); int ItemCount = 0; foreach (int i in transactions.Keys) { CCBTransaction t = transactions[i]; if (this.chkboxHideCategorized.Checked && !string.IsNullOrEmpty(t.Category)) { continue; } if (this.chkboxHideUncategorized.Checked && string.IsNullOrEmpty(t.Category)) { continue; } bool ShowThis = true; while (!string.IsNullOrEmpty(this.txtTransactionFilter.Text.Trim())) { ShowThis = false; if (t.Description.IndexOf(this.txtTransactionFilter.Text, StringComparison.InvariantCultureIgnoreCase) >= 0) { ShowThis = true; break; } if (t.Memo.IndexOf(this.txtTransactionFilter.Text, StringComparison.InvariantCultureIgnoreCase) >= 0) { ShowThis = true; break; } if (t.Payee.IndexOf(this.txtTransactionFilter.Text, StringComparison.InvariantCultureIgnoreCase) >= 0) { ShowThis = true; } break; } if (ShowThis) { ItemCount++; DataGridViewRow r = new DataGridViewRow(); r.Tag = t.ID.ToString(); r.CreateCells(this.dataGridView1); r.SetValues(new string[] { t.Date.ToString("d"), t.Payee, t.Memo, t.Category, t.Description, t.Amount.ToString("f"), t.Account, t.Jived.ToString(), t.CheckNumber, t.User }); this.dataGridView1.Rows.Add(r); } this.btnSelectedUncategorizedTransactions.Enabled = this.dataGridView1.Rows.Count > 0; } this.toolStripStatusLabel1.Text = string.Format("({0} transactions {1} filters)", ItemCount, this.txtTransactionFilter.Text.Trim().Length > 0 || this.chkboxHideCategorized.Checked || this.chkboxHideUncategorized.Checked ? "with" : "without"); }
private void btnSave_Click(object sender, EventArgs e) { this.toolStripStatusLabel1.Text = "Saving CSV file..."; this.statusStrip1.Refresh(); List <CCBTransaction> trans = new List <CCBTransaction>(); foreach (int i in transactions.Keys) { CCBTransaction t = transactions[i]; trans.Add(t); } Processor dl = new Processor(); dl.SaveCSV(trans, this.txtImportFilename.Text, this.chkEditingAnImportFile.Checked); this.toolStripStatusLabel1.Text = "CSV file saved"; this.btnLoad.Enabled = true; this.btnSave.Enabled = false; UnsavedChangesExist = false; }