public static string RestoreOriginalValues() { System.Web.SessionState.HttpSessionState currentSession = HttpContext.Current.Session; string retVal = string.Empty; string userID = !string.IsNullOrEmpty(currentSession[vs_userID].ToString()) ? currentSession[vs_userID].ToString() : string.Empty; int? preInvoiceID = (int?)currentSession[vs_preInvoiceID]; eInvoiceType?invoiceType = (eInvoiceType?)currentSession[vs_preInvoiceType]; if (preInvoiceID != null && preInvoiceID > 0 && invoiceType != null && userID != string.Empty) { try { Facade.IPalletForceImportPreInvoice facPFImport = new Facade.PreInvoice(); facPFImport.RestoreOriginalValues((int)preInvoiceID, (eInvoiceType)invoiceType, userID); } catch (Exception ex) { retVal = RetrieveErrorMessages(ex); } } else { retVal = string.Format("{0}|{1}", 1, "There was an error retrieving the preinvoice details. Please reload the page and try again."); } ////Pause the app for 10 seconds. //DateTime dt = DateTime.Now.AddSeconds(10); //DateTime newdate = DateTime.Now; //do { newdate = DateTime.Now; } //while (newdate < dt); return(retVal); }