Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Local Storage and Stored Procedures
Message
 
 
À
26/11/2014 02:01:55
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
VB 9.0
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01611428
Message ID:
01611445
Vues:
32
>>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....

Thank you, Viv. I will try your code. Do I understand that, since you can write this code off the top of your head, you have used Local Storage and it is more or less reliable?
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform