Welcome! Log In Create A New Profile

Advanced

How do you deal with this issue?

Posted by Jenny.pcs.crosspost 
Jenny.pcs.crosspost
How do you deal with this issue?
April 27, 2009 05:51PM
I have a issue here: If an user is on a order, another user is not allowed to issue an invoice on this order.

What I am doing is: when an user open a order, I add a record to the usage table, when he leave the order, I delete this record. when exception happened I will also delete this recode.

The problem is: in some case, the user is not there, but the recorde is not deleted. I guess there are many possibilities the record is not deleted, for example, when the user is on the order, the power is failure, or some other unkonwn reasons.

How do you deal with this issue? Use transaction? Is there any other problems?

Message forwarded from pcsoft.us.windev
ICI
Re: How do you deal with this issue?
April 27, 2009 10:10PM
Hi,
Maybe you point to wrong record number for deletion.
If you use Hseek or HreadSeek try to do nect:

nActualRecord is int = HRecNum(MyTable)

//Your code here and when it is finished

HRead(MyTable, nActualRecord)
HDelete(MyTable)



Piet van Zanten
Re: How do you deal with this issue?
April 27, 2009 11:27PM
Hi Jenny,

You could automatically delete all log entries from a certain age, e.g. 30 minutes.
If someone is on an order for a longer period the log entry will have to be renewed.
More simple is just use Windev's locking mechanism.

Regards,
Piet
Al
Re: How do you deal with this issue?
April 28, 2009 08:07AM
Hello Jenny

An alternative method might be to write the current user id into the order header record. You would then know who has the order open and when they close the order header record you could easily clear their info out. This would be quicker and simpler than maintaining a separate usage file

Regards
Al
Art Bonds
Re: How do you deal with this issue?
April 28, 2009 08:23AM
My 2 euros worth... building on Piet's answer:

Have the application wants to read and work with the order check the control record for a previous "lock" on the order, and if none found create a record in the control file like you are doing, except write the computers unique ID, the order ID and the date/time the app read the order record. Every x time frame (whatever works for you) have the application rewrite the control record with an updated time.

If a second computer wants to create an invoice (or work with the same order), have it check the date/time in the control records (check all records if an invoice is to be created, check one for the unique order ID if you only want to work on that specific order) (as you can see there can be multiple orders "locked" at any one time). If the check is within y amount of time then restrict the application from creating an invoice or working with that "locked" order (where y is at least greater than 2 times x's value - just in case the first computer misses an update due to communications issue or something else). If it is over y time, change the control record to the second computer's unique ID and time (taking ownership of the order(s)), and allow creation of the invoice/modification of the order.

The first computer that read the order in for modification, before being allowed to save the modified order record, has to check that the control record (for the appropriate order ID) for it's own unique computer ID. If it's not there (was deleted) or there is another computer's ID (someone took ownership), inform the user and don't allow any writes from the first computer.

This way there is no automatic deletion of the control record if no other application needs to access that order or create invoices on that/those orders.

Issues:

1. Time, making sure the clocks are synced between the applications.

2. The user gets up and walks away from the original order. I would code it so that if there is no keyboard, mouse or other use (the user is in Outlook, or some other computer usage that would indicate the user is still at the computer and has not abandoned the order), the program times the user out, releases the order with no modifications, deletes the control record so others can create invoices or work with the order.

This was just off the top of my head, if anybody sees any issues let's post them and work the thought through.

Art

Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: