Logic question

Results 1 to 2 of 2

Thread: Logic question

  1. #1
    Join Date
    Dec 1969

    Default Logic question

    I&#039;ve almost completed building a multi-step ordering system (choose items, collect customer info, review order, process/finalize order). The backend is an Access DB. <BR><BR>The first step presents the items and their associated available quantity at that moment. In both JavaScript (client-side) and VBScript (server-side), I ensure the quantity entered does not exceed that which is available; a simple pre-check. <BR><BR>However, the final step has to ensure that the quantity requested does not exceed the physical quantity available at the time the order is finalized. Obviously, this is because inventory can be reduced at any given moment by some other person ordering on-line. <BR><BR>(Q1) I was thinking of using the TRANSACTION directive, but was hoping someone would confirm it would work for MS Access tables/database. <BR><BR>(Q2) Also, any insight into my update approach would be appreciated. Basically, the finalization step will process all items being ordered. Per each item, I will perform a LOCK PESSIMISTIC Select (not sure?) on that particular inventory item and attempt to reduce the available qty by the quantity ordered. If there is insufficient inventory at that moment, I will employ the ObjectContext.SetAbort method. I am hoping that this will "roll back" all database (inventory) changes that may have already taken place during this script (customer orders 10 different items but the 10th item has insufficient qty -- I would want to roll back all changes and inform customer of the issue). <BR><BR>Per (Q2), I am obviously unsure as to what the best approach should be. While processing items ordered, I want to fetch the inventory record, lock it, check if it has sufficient qty and, if so, update it and continue onto the next ordered item. If at any time there is not sufficient qty, I want to abort the process and roll back any prior changes. If there were no inventory issues, I will then write to my order header/detail files. <BR><BR>While I understand the logic, I am not certain how to correctly accomplish this. All suggestions will be welcomed. Thank you in advance for as much insight as you can provide.

  2. #2
    Join Date
    Dec 1969

    Default RE: Logic question

    I&#039;ve done this before with a Temp table which mirrors the main db inventory table and holds the client&#039;s choices. The primary key is the IIS-generated SessionID (not always unique but usually is unless you reboot frequently).<BR>At the last minute, check the client&#039;s choices against the main inventory table and report back. That way, you retain the client&#039;s choices and you can let him update them appropriately.<BR><BR>hth<BR>hc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts