Exemplo n.º 1
0
        public static List<ClassDataFile> CompileFileList(string pickUpLocation, ref ClassImportInfoDataTable infoTable, bool useAuditFile)
        {
            List<ClassDataFile> fileList = new List<ClassDataFile>();
            String[] filePaths = Directory.GetFiles(pickUpLocation);
            ClassDataFile[] datFiles = new ClassDataFile[filePaths.Count()];
            int count = 0;

            if (useAuditFile)
            {
                string auditFileLocation = Properties.Settings.Default.AuditFileLocation;
                ClassAuditFile auditFile = new ClassAuditFile(auditFileLocation);
                DataTables.ClassAuditEntriesDataTable auditEntriesTable = new DataTables.ClassAuditEntriesDataTable();
                auditEntriesTable = DataTables.ClassAuditEntriesDataTable.FillEntriesTable(auditFile);

                if (auditEntriesTable.entriesTable.Rows.Count >= 1)
                {
                    foreach (String fileLoc in filePaths)
                    {
                        datFiles[count] = new ClassDataFile(filePaths[count]);
                        infoTable.AddNewRow(datFiles[count], ref infoTable);
                        string message = string.Empty;

                        message = ClassAuditing.SelfCheck(datFiles[count]);
                        infoTable.UpdateRow(datFiles[count], "Self_Check_Result", message, ref infoTable);

                        message = ClassAuditing.AuditFileCheck(datFiles[count], auditEntriesTable);
                        infoTable.UpdateRow(datFiles[count], "AuditFile_Check_Result", message, ref infoTable);

                        //• ONLY ADD FILE TO LIST IF AUDIT PASSED
                        if ((datFiles[count].PassedSelfCheck == true) && (datFiles[count].PassedAuditFileCheck == true))
                            fileList.Add(datFiles[count]);

                        count++;
                    }

                }
            }
            else
            {
                foreach (String fileLoc in filePaths)
                {
                    datFiles[count] = new ClassDataFile(filePaths[count]);
                    infoTable.AddNewRow(datFiles[count], ref infoTable);
                    string message = string.Empty;

                    message = ClassAuditing.SelfCheck(datFiles[count]);
                    infoTable.UpdateRow(datFiles[count], "Self_Check_Result", message, ref infoTable);

                    //• ONLY ADD FILE TO LIST IF AUDIT PASSED
                    if (datFiles[count].PassedSelfCheck == true)
                        fileList.Add(datFiles[count]);

                    count++;
                }
            }
            return fileList;
        }
Exemplo n.º 2
0
        public static void UpdateInCompleteAudits(DataTable table, ClassAuditEntriesDataTable entriesTable, ref ClassImportInfoDataTable infoTable, string connectionString)
        {
            string message;
            foreach (DataRow dataRow in table.Rows)
            {
                ClassDataFile datFile = new ClassDataFile(dataRow);
                infoTable.AddNewRow(datFile, ref infoTable);
                message = ClassGatherInfo.VerifyFileIntact(datFile, entriesTable);

                message = AuditFileCheck(datFile, entriesTable);
                infoTable.UpdateRow(datFile, "AuditFile_Check_Result", message, ref infoTable);

                //• ONLY UPDATE THE ENTRY IF AUDIT PASSED
                if (datFile.PassedAuditFileCheck)
                    ClassSQLAccess.UpdateIncompleteAudit(datFile, connectionString);
            }
        }