• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 219
  • Last Modified:

Need Help Trying to Implement a Parent - Child UI and Business Logic

I am about ready to abandon what I've done and just add additional [Edit] buttons to the form. I would blame the 'fuzziness' on my meds, but all five of my doctors tell me I am perfectly normal :-)

I have an Employee class. Within this class, amongst all the other methods and properties, are three collections, one for Work phone numbers, one for Personal phone numbers and one for Addresses. An employee can have a primary, secondary, cell, pager, fax number, and separate home and mailing (as well as an alternate) addresses.

When the user goes into Update mode, all fields become updatable. The main one I am having problems with is the address. By default, the edit form displays the first available address (assume Home). There is a read-only combo box to the left of the address textboxes. The user can drop down the combo and chose Home, Mailing or Alternate. If an address exits for that address type, I retrieve a class with the properties and populate the text boxes. If no class exists in the collection, I create a new one, populate it with the address type code, and allow the user to enter data.

My main problem is determining how (and when) to handle getting all the data back into the collection. My thinking is way too much inside the box and for some reason I am having trouble visualizing this, handling data validation, the best way to handle persistence (as it stands now, it is an all or nothing scenario. The user makes all the changes they want, and when done, clicks [Save] - assuming all data is valid and [Save] has become enabled.

As I stated, one stumbling block I have encountered is what to do with the class that has been updated, in getting it back into the collection. If it is a new address, I have no problem as I have an AddAddress method on the collection that I pass a class to and it is added. Would it be appropriate to have an UpdateAddress method that accepts a class, finds the matching key in the collection and updates the properties one at a time? I guess with all my programming, I have never run across this scenario.

Would the experts recommend that I break apart validation of the main employee data from the address validation so the primary data can be saved even if an address is invalid and allow the user to then go in and correct the address (invalid address data would not be saved, it would just be ignored when other data was saved). Programming the way the user wants it can get to be a BIG pain.

Like I said at the start, part of me wnats to put an [Edit] button next to the address and then bring up a separate form to enter info. That would certainly help with the issue of knowing when to allow navigation away from the address data and if they do not get the address right, their only option is to click [Cancel] and go back to the main form.

Oh, great SAGES of the VB Code! Shed thy wisdom upon me!
0
dbbishop
Asked:
dbbishop
1 Solution
 
jmundsackCommented:
I have run into this situation a lot--users wanting to update what is effectively child info directly on the parent info screen--and I always opt for the modal child form.  I let them view the child info read only, select between the various child records, and then have buttons to add, edit and delete.  It may not be exactly the way the user wants it, but it's usually way too much of a pain in the tuckus to deal with the other way.  The nearest compromise I've ever done (which was aggravating enough), was to simulate a modal form by having an editable set of controls appear in the same place as the read-only controls, while disabling every other control on the parent form.  But ultimately the result is the same: you want to edit child info, then you run a function to begin the edit, and then either save or cancel the edit.

HTH-Jon
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now