Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Local Storage and Stored Procedures
Message
From
26/11/2014 02:01:55
 
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01611428
Message ID:
01611433
Views:
44
>I am working on a web page that will be used to update on-hand quantity of parts in a stock room. The page is very simple: it has a text box Part No and a text box Quantity. The user will scan or type in the Part No text box and then enter the current on-hand quantity in the Quantity box. Then user clicks on Submit button. Submit button will call a stored procedure that will update the database table(s).
>
>The program will work in a company Wi-Fi. But it is possible that for a short period (or maybe longer) the Wi-Fi signal will be dropped. So, if the connection is dropped, - ideally - (I would need to check it before calling the stored procedure) I would store the values in the Local Storage. Then, when connection is restored the data from the Local Storage should be processed (transparent to the user).
>
>How could this be done, conceptually? That is, how would a program/page call a stored procedure for every pair of values in the Local Storage?
>TIA

Something like:
saveEntry(partno, quan) {
            var entry = { PartNo: partno, Quan: quan };
            if (localStorage['entries'] === undefined) {
                var entries = new Array;
            } else {
                entries = JSON.parse(localStorage['entries']);
            }
            entries.push(entry);
            localStorage['entries'] = JSON.stringify(entries);
            if (window.navigator.onLine) {
                //Send entries array to server
                //On success:
                localStorage['entries'] = JSON.stringify(new Array);
            }
        }
This would send when a new entry was added. If you wanted to send when a connection became available you could add a watch on window.navigator.online and send from there....
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform