Reputation: 161
Scenario:
There is webapplication in which no of users working on no of tasks. The task is allocated to that user only and no one can work on same task till it get freed. I have used a flag in database to achieve this.. Everything is running fine when user close or logout the application. But, In case the page get crashed or suddenly closed then the flag remains unchanged Record is still locked for that user.
Kindly suggest any alternative...or how to achieve this..
Upvotes: 1
Views: 198
Reputation: 13198
You could put a timeout on how long the record can stay locked, as well as put a refresh of some sort on the page so that it keeps restarting the timeout as long as it is open.
You could also write a window/page that allows you to view the current locks so that you can manually release any that shouldn't be active anymore, although with a timeout this would probably not be necessary.
Upvotes: 0
Reputation: 13970
You can use the Application_Error in Global.Asax to handle this.
http://www.wduffy.co.uk/blog/using-application_error-in-asp-net-mvcs-global-asax-to-handle-errors/
Upvotes: 0
Reputation: 377
This is more of a flow of the application that you might think of with your client (or yourself).
As a suggestion, when that user enters the website, you can check if the flag is true. In that case, you might alert the user that he has pending changes to resolve and proceed with saving or discarding them.
Another suggestion if that you in a timely fashion, auto save the tasks, for example in intervals of 5 min, so if the user shuts down the page, he will loose a max of 5 min work.
But again, it all depends of the objectives of this feature and how you would like it to run and interface to the users.
Upvotes: 1