// adding this section for the new constructor module, that should make the old version obsolete. private void original_key_format(ACH_FILE search_file) { this.working_file = search_file; foreach (Tuple <string, string> a in working_file.entryAddenda.Keys) { string my_key = $"{a.Item1},\t{ENTRY_FORM.padding_router("Amount ", a.Item2, true)}"; try { display_keys.Add(my_key, a); // update with the new keys amount. } catch (Exception e) { #if UPDATE_20190807 Program.encountered_Exceptions.Add(e); #endif string e_Key = $"{my_key}"; int allowed_runs = 100; bool m = false; while (m != true) { try { e_Key = $"[DUPLICATE]{e_Key}"; display_keys.Add(e_Key, a); // this should be fine. m = true; break; // not relying on the system to work correctly. } catch (Exception e2) { #if UPDATE_20190807 Program.encountered_Exceptions.Add(e2); #endif // this would be the alternative. if (allowed_runs <= 0) { break; } allowed_runs--; } } } } }
/// <summary> /// DisplayKeysUpdate - /// Update the key amounts based on the amounts contained in the line item. /// </summary> public void DisplayKeysUpdate() { this.display_keys.Clear(); // display keys are fine - but we need to edit working file. #if UPDATE_20190723 #if DEBUG // we're going to try the List <Tuple <string, string> > workingFileKeys = new List <Tuple <string, string> >(); foreach (Tuple <string, string> tss in working_file.entryAddenda.Keys) { workingFileKeys.Add(tss); } // okay - with the keys obtained - we're going to get the entry addedna value. #endif #endif foreach (Tuple <string, string> a in working_file.entryAddenda.Keys) { // set it up to pretty print the amount and pair with the name. // it almost looked like item 2 was assigned as amount. #if UPDATE_20190723 // updating this to only show a more manageable output value. string my_key = $"{GLOBALS.PadString(a.Item1,15)},\t{ENTRY_FORM.padding_router("Amount ", a.Item2, true)}"; #else string my_key = $"{a.Item1},\t{ENTRY_FORM.padding_router("Amount ", a.Item2, true)}"; #endif try { display_keys.Add(my_key, a); // update with the new keys amount. } catch (Exception e) { #if UPDATE_20190807 Program.encountered_Exceptions.Add(e); #endif // looks like this case is that key is duplicate - we'll need to adjust the key. my_key = $"[DUPLICATE]{my_key}"; display_keys.Add(my_key, a); }// this will help identify duplicates while we're at it. } }
// UPDATING 7-18-2019 - removing some of the input parameters (reforming through preprocessor commands. // allowing these commands to be processed later will allow us to construct most of the form, while separating it from the underlying code. /// <summary> /// /// </summary> public ACCESS_RECORD( #if UPDATE_20190718 #else ACH_FILE search_file #endif ) { this.display_keys = new Dictionary <string, Tuple <string, string> >(); // forgot that this needed to be initialized. #if UPDATE_20190718 // following portion immediately attempts to establish the keys on initialization - // we're going to set up a process to set the keys up as a prerequisite to display - // possibly with an override to the "Show()" and "ShowDialog()" methods. #else this.working_file = search_file; foreach (Tuple <string, string> a in working_file.entryAddenda.Keys) { // this is the location that causes an issue. // set it up to pretty print the amount and pair with the name. // it almost looked like item 2 was assigned as amount. /* */ string my_key = $"{a.Item1},\t{ENTRY_FORM.padding_router("Amount ", a.Item2, true)}"; try { display_keys.Add(my_key, a); // update with the new keys amount. } catch (Exception e) { // we'll, I would think this should capture the duplicate keys. // looks like this case is that key is duplicate - we'll need to adjust the key. my_key = $"[DUPLICATE]{my_key}"; display_keys.Add(my_key, a); }// this will help identify duplicates while we're at it. } #endif // this function has been modified in the 20190723 update. InitializeComponent(); this.label1.Text = "Selected Record"; this.label2.Text = "Original Names and Amounts:"; this.label3.Text = "Amounts to left will show the original names and amounts remaining\nin the file. As you add and delete, they will appear to the left.\nEdits can be viewed in the window above."; this.button1.Text = "Edit"; this.button2.Text = "Save and Quit"; this.button3.Text = "Add"; this.button4.Text = "Delete"; #if UPDATE_20190723 #if UPDATE_20190725 foreach (Control c in this.Controls) { Program.set_font(c); // let's see if this works. } #if UPDATE_20190807 //this.label4.Text = "File Hash"; this.label4.Text = "File Credit Amount"; // we'll do the same output for this as we did with the debit. this.label5.Text = "File Debit Amount"; // focusing on how much we are drafting, not paying (for now); this.textBox2.ReadOnly = true; this.textBox3.ReadOnly = true; // we'll need to add some update methods. #endif #endif this.button5.Text = "Search"; this.button5.Click += searchInteractionClick; // let's try this on for size. // we're going to need to outsource these as a function... //this.listBox1.Font = new System.Drawing.Font("Consolas",10); #endif this.textBox1.Multiline = true; this.textBox1.ScrollBars = ScrollBars.Horizontal; this.textBox1.ReadOnly = true; this.listBox1.SelectedIndexChanged += ListBoxItemClick;// let's give this a go // foreach (string a in this.display_keys.Keys) { listBox1.Items.Add(a); } foreach (Control c in this.Controls) { if (c.Name.Contains("button")) { c.Click += ButtonObjectClick; // this should handle all of the clicks in a centralized place. } } }