Entering data in a form with different BO at runtime


Author
Message
Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
I have a several tables which has the same Address fields (Street, City, State, ZipCode), I would like to have use a generic ChildFormDialog to allow end user to enter the data for each table based on the calling form. 

Can this be done with the ChildFormDialog? if so:

  • How to programmatically update the CFD properties to use the correct BO to be translated.
  • Should I create a generic BO with the Address fields to be used in the ChildForm and then translate this BO with all other BO?


Edhy Rijo

Replies
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Does the Phone type table have a field to hold the Parent Table Name which will be used to relate the Parent PK?

No, just the primary key value (i.e. BigInt, Guid, etc.)  Then you will have a type field which is an integer and you will create an Enum for within your application and assign to this as a Custom Data Type in the BO Mapper.  This is how you will identify to which table the record belongs.  You will not want to use a string and the table name as this will be much slower on queries and it prevents you from changing table names, etc. if the need arises.

The Parent PK field, is this field automatically related to the Parent Table in the BO or is this handle manually whenever you add a phone from each particular form?

You can automatically manage this on your manager class.  You will create two properties on your class.

ParentBusinessObject As BusinessLayer - The Parent table reference
BusinessObject As BusinessLayer - The Notes table

You will also have a property of the enum value that you create that identifies the parent table:

ParentType As MyNotesEnum

This will tell you how to treat the ParentBusinessObject property and pull the PK.  You could do this by using the PrimarykeyField property on the BO as well, but you will still need the enum property so that you can set this value on the NoteItems record when created so you know how to get it back out of the database.

Edhy Rijo
E
StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)StrataFrame VIP (6.4K reputation)
Group: StrataFrame Users
Posts: 2.4K, Visits: 23K
Hi Trent,

Thanks a lot for the ideas.

I took another approach by passing the NoteType and ParentPK values as a parameter to the Note Manager form and then created a method [FillByTypeAndPK(pFK_NoteType, pFK_ParentRecord)] in the the BO to get the correct note records. Tongue

Then in the parent form I have this code to call the Note Management form:

Dim loNoteForm As New frmHistoryAndNotes(IBS_BOL.IBSEnums.HistoryAndNoteType.InsuredCustomer, Me.InsuredCustomerBO1.PK_InsuredCustomer)

loNoteForm.ShowDialog(Me)

loNoteForm.Dispose()

loNoteForm = Nothing

 



Edhy Rijo

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search