Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How would you do this?
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00287031
Message ID:
00287137
Views:
36
>I have posted something similar to this already and received one good idea but thought a different category and approach to the question would help. Sorry for the redundancy but please bear with me.
>
>Here is the scenario:
>
>You are asked to design an Invoice Form for a client/server system (generic to any back-end).
>This Invoice Form will be a parent-child form using the Invoices table and the InvoiceItems table.
>The main validation is that only one users changes to any part of an invoice can be saved. This means that, for example, if a user modifies an invoice by adding an invoice item line, before saving to the back end, it must be determined that no changes to this invoice have been made, either to the main Invoice table of the Invoice Items table
>
>i.e. consider the following:
>
>Both User1 and User2 are modifying Invoice 111
>User1 changes the Invoice Description (parent view)
>User2 changes the Quantity of a line item (child view)
>User1 and User2 both issue TABLEUPDATE(0,'ParentView') and TABLEUPDATE(1,'ChildView')
>
>Both users changes have now been saved to the base table. This is what I'm trying to avoid. Any ideas? TIA

Sounds like a good example for some type of Invoice data manager class. The class would have a property that would hold the unique key and it would have two differing update methods....one to update description, one to update line items. I'm assuming that you have some mechanism to identify what each user is allowed to update on this invoice form.

IF oUser.lCandDoDescription
oInvoice.UpdateDescription()
ELSE
oInvoice.UpdateLineItems()
ENDIF

Invoice.UpdateDescription would have an UPDATE SQL statement to just do the desciption. Invoice.UpdateLineItems would have an UPDATE SQL statement to update just the line items. Both would contain a WHERE clause that uses the value in the key field of this class.

HTH
Steve
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform