I have build a web application which shows the list of customers using datalist control of asp.net , Each customer can be updated, The issue is the application is used by multiple users for instance 5-6 at a time, The problem is when 5 users logged in at a same time they can view the same customer list and can make changes to the same customer at similar time,
Is it possible to restrict user from viewing one customer which is being viewed by other user, for instance if customer 1 is being watched and modified by user 1 then user 2,3,4 will not be able to see customer 1 in their list of customers.
Any assistance or tutorials will be highly appreciated
you have 2 options: pessimistic concurrency or optimistic concurrency.
pessimistic con concurrency locks the entity while the user is viewing it. during this time no one else can access the entity. this works on a small scale, but will quickly become a bottleneck in larger systems.
optimistic concurrency uses a version number. any user can view the data. when changing the data the version number must match, otherwise a change has occurred. then you can notify the user of the change and let them decide to cancel or update. this scales very nicely, but requires a little more work to handle version conflicts.