Ejemplo n.º 1
0
        // the main tasks of an update
        public static void MainTasks(string year)
        {
            // download file
            DownloadFile dlf     = new DownloadFile(year);
            string       success = dlf.Download(); // returns null if no download or filename if success

            if (success != null)
            {
                Console.WriteLine("PPR file downloaded sucessfuly");
                Trace.TraceInformation("worker role: PPR file downloaded sucessfuly");
                List <Record> recordList = dlf.ConvertFile(success); // returns list of record objects for sorting
                if (recordList != null || recordList.Count > 0)      // list is null if has thrown exception or could be empty
                {
                    CleanUpRecords       cur            = new CleanUpRecords();
                    List <AlteredRecord> alteredRecords = cur.CleanRecords(recordList); // clean records and return an altered record list
                    AddToDatabase        atb            = new AddToDatabase();
                    atb.AddList(alteredRecords, dateTimeUpdatedTo);                     // send list of to be broken down into counties and added to database documents
                    AlterUpdateDates();                                                 // change the dates in the update document to the new dates
                }
            }
        }