My Silverlight application inserts records tp a table named Prscrpts. The prescriptionno is the primary key.
I also maintain another table named PrscrptRange which has the lastest prescription number. there are 3 records in this table, depending on the type of the prescription. eg: Medication :3035 , Plain : 74023, External :503336. I use three different ranges depending on the type of prescription.
Now, what I need is whenever I insert a record into the prescrpts table, I need to check whether the prescription is of type medication, if its medication, get the corresponding value from the PrscrptRange table and increment it and use this new value as the prescriptionno and update the PrscrptRange table and insert the new prescription record.
How can I do this in the client side? What I need to take care of is that no two person should use the same prescriptionno. (concurrency) This is an online order entry system.
Please Please Please help…
If you want to do this on the client, you can do the following:
The problem with this that if the client decides not to save, you get holes in the series.
I would have moved this functionality to the server, increment the prescription number and save the prescription in the same transaction.