示例#1
0
        public mapping_editor()
        {
            InitializeComponent();


            List <Label> EntryFields = new List <Label> {
                label1,
                label2,
                label3,
                label4,
                label5,
                label6,
                label7,
                label8,
                label9,
                label10,
                label11
            };

#if UPDATE_201909
            // update teh output with the apropriate name... we'll test to make sure this is fine.
            for (int i = 0; i < 12; i++)
            {
                var z = ENTRY_FORM.field_map_mapping();
                EntryFields[i].Text = z.Keys.ToList <string>()[i];
            }
#endif
        }
示例#2
0
        // 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--;
                        }
                    }
                }
            }
        }
示例#3
0
        /// <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.
            }
        }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ButtonObjectClick(object sender, EventArgs e)
        {
            if (sender.Equals(button1))
            {
                // might want to update the key - so I'll have to look at ways to do that.
                Tuple <string, string> Curr_Key = this.display_keys[selected_key];
                // edit entry/addenda
                Tuple <string, string> My_Entry = working_file.entryAddenda[this.display_keys[selected_key]];
                int pos = 0;
                foreach (var a in working_file.entryAddenda)
                {
                    if (a.Value.Equals(My_Entry))
                    {
                        break;
                    }
                    else
                    {
                        pos++;
                    }
                }
                ENTRY_FORM My_Form = new ENTRY_FORM(My_Entry.Item1, My_Entry.Item2, false, pos);
                My_Form.ShowDialog();
                string new_entry = ENTRY_FORM.last_entry; // we'll handle this after the fact.
#if DEBUG
                Console.WriteLine(new_entry);             // alrighty - confirmed that we can write output back to file.
#endif
                working_file.entryAddenda[Curr_Key] = new Tuple <string, string>(new_entry, My_Entry.Item2);

                // okay - so if the amount has changed, we'll trigger the update unit.
#if UPDATE_20190723
                // trying an "Update every time" approach.
                // there appears to be a negligible difference in this...
#if DEBUG
                var dbgtime = DateTime.Now;
                if (toggleCounter % 2 == 0)
                {
                    if (working_file.entryAddenda[this.display_keys[selected_key]].Item1.Substring(FORMS.ENTRY_FORM.field_map["Amount     "].Item1, FORMS.ENTRY_FORM.field_map["Amount     "].Item2) !=
                        working_file.entryAddenda[this.display_keys[selected_key]].Item2)
                    {
                        // okay - I think that this should update the output.
                        working_file.updateEntryAddenda(this.display_keys[this.selected_key], working_file.entryAddenda[Curr_Key]);
                    }
                    Console.WriteLine($"W/IF {DateTime.Now - dbgtime}");
                    this.label3.Text = $"W/IF {DateTime.Now - dbgtime}";
                }
                else
                {
                    {
                        // okay - I think that this should update the output.
                        working_file.updateEntryAddenda(this.display_keys[this.selected_key], working_file.entryAddenda[Curr_Key]);
                    }
                    Console.WriteLine($"N/IF {DateTime.Now - dbgtime}");
                    this.label3.Text = $"N/IF {DateTime.Now - dbgtime}";
                }
                toggleCounter++; // so we'll try benchmarking it.
#else
                //if (working_file.entryAddenda[this.display_keys[selected_key]].Item1.Substring(FORMS.ENTRY_FORM.field_map["Amount     "].Item1, FORMS.ENTRY_FORM.field_map["Amount     "].Item2) !=
                //    working_file.entryAddenda[this.display_keys[selected_key]].Item2)
                {
                    // okay - I think that this should update the output.
                    working_file.updateEntryAddenda(this.display_keys[this.selected_key], working_file.entryAddenda[Curr_Key]);
                }
#endif
#endif

#if UPDATE_20190718
                DisplayKeysUpdate();  // I think this will work...
                ListBoxItemsUpdate(); // let's see where this goes.
                MidInterrupt();       // we'll try this one then.
#endif
            }
            else if (sender.Equals(button2))
            {
                // quit
                this.DestroyHandle(); // remove self. the ACH_FILE class should hold all of the changes.
            }
            else if (sender.Equals(button3))
            {
                // add
                string     new_entry   = "";
                string     new_addenda = "";
                ENTRY_FORM My_Form     = new ENTRY_FORM("", "", false, display_keys.Count); // will be the last record available.
                My_Form.ShowDialog();                                                       // get the new entry value.
                new_entry = ENTRY_FORM.last_entry;                                          // not thread safe.
#if DEBUG
                Console.WriteLine(new_entry);
#endif
                working_file.add_entry(new string[2] {
                    new_entry, new_addenda
                }, 0);                                                              // will always be the first entry.

                // we'll need to update keys.
                this.DisplayKeysUpdate();
                this.ListBoxItemsUpdate();
            }
            else if (sender.Equals(button4))
            {
                // delete
                // we'll need to update keys.
                working_file.entryAddenda.Remove(display_keys[selected_key]);
                this.DisplayKeysUpdate();
                this.ListBoxItemsUpdate();
            }
            else
            {
                // suppress error?
            }
        }
示例#5
0
        // 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.
                }
            }
        }