//readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // GET: Invoices public ActionResult Index() { // Log to database FileStatus fileStatus = new FileStatus(); ScanPageStatus scanPageStatus = new ScanPageStatus(); FileProcessor fileProcessor = new FileProcessor(); //fileStatus.rc = 0; while (fileStatus.rc <= 0) { fileStatus = fileProcessor.CheckNextFile(); // If the file is incorrect it will be moved to error directory automatically GPA *** move all functions to the same place! if (CheckFileStatus(fileStatus)) { // Scan the file reading in any data available if (ReadFileData(fileStatus.fileName)) { // If this is positive, then should have // - identified the company // - scanned in and returned the page with 'key' data (as a string) // Now need to interprit this data and write to the database for further checking / uploading fileProcessor.MoveFile(Path.GetFileName(fileStatus.fileName), "processed"); CheckAndReadScannedData(); } else { fileProcessor.MoveFile(Path.GetFileName(fileStatus.fileName), "error"); } } else { // Error - log message } } //FileProcessor.MoveFile() var invoices = db.Invoices.Include(i => i.Customer).Include(i => i.Supplier); return(View(invoices.ToList())); }