Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Handling problems deep in BOs
Message
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Programmation Orientée Object
Divers
Thread ID:
00837088
Message ID:
00837484
Vues:
44
Well, there are a few issues we have to look at here.
>
>First of all, if your BO is handling data access, you shouldn't being handling the transaction outside of it, except if you have this code inside a bigger BO that calls the other ones.
>
>Second, a business object doesn't have to be handling a single table, nor a single record at a time. It can do it, but this is not a requirement. In your case, I'll do a single BO that handle all this in just one call.
>
>Can you briefly tell me what each BO represents?


I first learned to use BOs with the Web Connect framework, so my BOs are based on Rick's and mix business logic with data access. So some of them are more generic objects that handle a bunch of tables, and some are 1 BO = 1 table and are pretty strictly for data access.

I made a bigger outline of what's going on to hopfully clarify what's going on. It's hard to condense a really complex process down to a few lines. :)
UI.Ship()
  ShippingBO.Save()
    * Generate list of all items in a cursor
   
    BEGIN TRANSACTION  
    * Call the default to do the physical saving of the shipment info
    
    PicklistBO.Save()
    
    InventoryBO.Save()  
      SELECT (CursorWithAllItemsToUpdate)
      SCAN 
        UpdateItemTable()
        UpdateItemQuantityTable()
        UpdateItemLocationTable()
        UpdateTransactionTable()
        UpdateDistributionTable()
        UpdateTotalsCursor()
      ENDSCAN
      
      * Update system table with totals
    END TRANSACTION
In each of the method calls in the scan, it uses a BO to access 1 table and update it with information from the current item that we're working on.

The reason I can't do all my processing ahead of time is that if someone else edits a record before I get to it, it could change what I need to do. For example, if item ABC has 2 left in inventory, and I only need 1, it's a simple matter of subtracting. But if, when I do my processing, it says there is 2 left and when I get to it there really is 0 left, I need to go through an extra process and create an overship record. I won't know how many are there until I try to update the table, so I can't do it ahead of time.

I really appreciate you helping me with this. I know what a pain it can be to try and help someone with a complicated problem in a system you're not familiar with.

I hope there's some solution that I'm just not seeing. Thanks again,

Michelle
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform