StrataFrame Forum

Adding and Editing records

http://forum.strataframe.net/Topic28073.aspx

By Ger Cannoll - 8/24/2010

I am in the process of writing  forms to Add/Edit records and would welcome some guidance on best practice for this.  I have a parent BO and Child BO and want to Save back to the database at the Parent Level. On my Child Form, I have the various fields, and then a Save and Cancel button. My pseudo code for the Child BO is:

Adding:
  MyBO.Add   // Add the BO record
  MYBO.EDIT // (Must I put the BO into Edit Mode to be able to edit the record just added ?
     ....... edit the various fields 
 
Editing
  MyBO.EDit
     ....... edit the various fields


Save/Cancel Buttons
if no Errors and want to save  .... Do nothing as BO's will be saved from Parent Form
If Errors  or I Choose to Abort the Changes ......
Case:
  (1) If was adding a record......BO.DeleteCurrentRow() or Revert to original state of BO;   //I no longer want the record added
  (2) If I was Editing a record ...... Revert to original state of BO  // want to keep the state prior to editing

I am not sure how to use the EditingState, as I need to kow whether I am adding a new row or editing an exisitng row, but it would appear that I need to have EditingMode = Editing to be able to edit either the new or exisitng record.

By Greg McGuffey - 8/24/2010

Are you managing the parent and child data on the same form or using ChildFormDialogs or you're own dialogs?
By Ger Cannoll - 8/24/2010

Hi Greg.

I am using childFormDialog. I have a Header Form for Invoice header details like Invocie No. Invoice Date and Customer Number (With a Save and Cancel Button where I want to Save All BO's (i.e. parent and Child ) out to disk.

 On the Child Form, I have a Save, Cancel, which is really just for the user, so that they can 'Save' each child record, but no saving is done to Disk until the user selects Save from the parent form.

The 'Save' on the child form is  really an indicator for the User , to finish with the current record and 'Add' another child record.

When all is done, i.e. All header data is input (parent BO) and all the child records have been input by the user, I want to Save the Parent and Child records to disk.

By Ger Cannoll - 9/3/2010

Any feedback on this appreciated
By Ivan George Borges - 9/3/2010

Hi Gerard.

This is a good post to follow:

http://forum.strataframe.net/FindPost18089.aspx