public static void processSnapshot(int snapshotId) { CcsServerEntities ctx = new CcsServerEntities(); //Grab docs from context var docs = ctx.documents .Where(d => d.snapshot_id == snapshotId); //Pipeline Debug.WriteLine("Beginning Pipeline for snapshot id " + snapshotId); Console.WriteLine("Beginning Pipeline for snapshot id " + snapshotId); var count = 1; foreach (var doc in docs) { //Initialize byte array list List <FileBytes> fbList = new List <FileBytes>(); if (doc.exception_code == null && doc.exclusion_code == null) { Operations.updateName(doc); } if (doc.exception_code == null && doc.exclusion_code == null) { //Operations.updateFilePath(doc); } if (doc.exception_code == null && doc.exclusion_code == null) { Operations.getSbFileType(doc, fbList); } count++; if (count % 1000 == 0) { Console.WriteLine(count + " Docs processed for snapshot id " + snapshotId); Debug.WriteLine(count + " Docs processed for snapshot id " + snapshotId); } } Console.WriteLine("Pipleine has completed for snapshot id " + snapshotId); Debug.WriteLine("Pipleine has completed for snapshot id " + snapshotId); Debug.WriteLine("Creating DIP for for snapshot id: " + snapshotId); var mappingIndex = getMappingIndex(); CcsFunctions.createDipFile(ctx, mappingIndex, snapshotId); Debug.WriteLine("Done creating DIP file"); ctx.SaveChanges(); }
public static void getSbFileType(document doc, List <FileBytes> fbList) { var snow = new Snowbnd(); foreach (var file in doc.files) { var bytes = CcsFunctions.readFile(file, fbList, doc); if (doc.exception_code == null) { var sbFileType = snow.CIMGLOW_get_filetype_mem(bytes); CcsServerEntities ctx = new CcsServerEntities(); var fileType = ctx.file_type .Where(f => f.sb_file_type == sbFileType) .FirstOrDefault(); file.file_type_id = fileType.id; file.sb_file_type = fileType.sb_file_type; } } }