public static string CreatePalletForcePreInvoice() { int preInvoiceID = -1; string retVal = string.Empty; System.Web.SessionState.HttpSessionState currentSession = HttpContext.Current.Session; //Check to see if the file already exists. Facade.IPalletForceImportPreInvoice facPFImport = new Facade.PreInvoice(); string uploadedFilePath = currentSession[vs_uploadedFilePath].ToString(); if (currentSession[vs_pfImportedInvoice] != null) { #region Import File Entities.PalletForceImportedInvoice pfii = (Entities.PalletForceImportedInvoice)currentSession[vs_pfImportedInvoice]; try { preInvoiceID = facPFImport.CreatePalletForcePreInvoice(pfii, uploadedFilePath, currentSession[vs_userID].ToString()); retVal = preInvoiceID.ToString(); } catch (Exception ex) { #region File Removal on Error retVal = FileRemovalOnError(uploadedFilePath, ex); #endregion } finally { currentSession[vs_preInvoiceID] = preInvoiceID; } #endregion } return(retVal); }