Hi,
I would like upgrade my framework to have n-tier capabilities, for now 3 tier will do. I have a few initial questions:
1) I know I need to create a Class (custom type class?) as the Business Object for the business rules.
2) I need to choose a way to transfer data back and forth between the presentation layer, the business layer(middle tier) and the data layer.
I can use either XML or ADO recordsets, maybe some other technology,what is the suggested method to handle the data? XML? ADO?
3) I will need to instantiate this class when I open my forms.
Let's say it's a customer data entry screen. Basically the screen will function like this(assume we gonna use XML):
* Instantiate the business layer class (oBusiness for this example)
* Get the record.
- oXML_Record = Thisform.oBusiness.Get_Record("Select * from customers WHERE nCust_id = 54")
(The "oBusiness.Get_Data" method will issue a call to the database, get the results and put them in XML format and send the result back to the presentation layer.)
* If it's foxpro interface I can convert the XML to a cursor and bind to the controls.
* Save Record.
- Convert cursor to XML if foxpro interface
- Thisform.oBusiness.Save_Record(oXML_Object)
- How can I check for field changes? Keep a copy of the original XML on the business layer and when the business layer receives back the XML from the presentation layer compare against it?
- Call data validation method
aFailedFields = Thisform.oBusiness.Validate(oXML_Object)
(send the XML, the business object will validate and return an array with the fields that failed the validation)
* Add Record
- oXML_record = Thisform.oBusiness.Add_Record("Select * FROM Customers WHERE 1=2")
(it would return nothing but it will enable me to create the cursor based on the XML structure when I convert, so I have an empty cursor)
* Delete Record
- Thisform.oBusiness.Delete_Record(nCust_id)
* Cancel Changes
- oXML_Record = Thisform.oBusiness.Get_Record("Select * from customers WHERE nCust_id = 54")
(just call the same procedure as when getting the record)
- if I'm updating multiple tables in this screen then have a business layer object for each table that I'm updating?
Am I in the right direction?
Thanks!
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only