protected void RepairIncompleteSessions() { ArchiveFileMgr.MoveAwayBadFiles(); string sArcPath = AppCfg.ArchivePath_Core; DirectoryInfo arcDi = new DirectoryInfo(sArcPath); FileInfo[] file_Arr = arcDi.GetFiles("*.cor*", SearchOption.TopDirectoryOnly).OrderBy(f => f.Name).ToArray(); //if (file_Arr.Length > 0) // throw new Exception("Error! .. Some incomplete sessions found!"); //Array.CreateInstance( SqlBatchMgr sbm1 = new SqlBatchMgr( SqlBatchMgr.ExecutionType.ExecNonQuery); sbm1.AddStatment(" Delete from Incomplete_CoreFiles "); CoreFile [] coreFile_Arr = new CoreFile[file_Arr.Length]; for (int i = 0; i < file_Arr.Length; i++) { string sName = file_Arr[i].Name; int nID = int.Parse(sName.Substring(0, 10)); coreFile_Arr[i] = new CoreFile { FileInfo = file_Arr[i], ID = nID }; string stmt = " INSERT INTO Incomplete_CoreFiles " + " (Incomplete_CoreFile_ID, Name) " + " VALUES " + " (%Incomplete_CoreFile_ID, '%Name') "; stmt = stmt.Replace("%Incomplete_CoreFile_ID", nID.ToString()); stmt = stmt.Replace("%Name", sName); sbm1.AddStatment(stmt); } sbm1.AddStatment(" exec Sp_FixLast_FileAddingSession "); sbm1.ExecuteNonQuery(); ArchiveFileMgr.MoveCoreTo_BackupFolders(); }
public void Proceed() { WriteMarkFiles_And_CopyFiles(); //WriteMarkFiles_To_OrgFolders(); //CopyFilesTo_Archive(); Finish_DB_Work(); ArchiveFileMgr.MoveAwayBadFiles( SearchOption.TopDirectoryOnly); DocArchiver.AddingFiles.ArchiveFileMgr.InspectDocs( SearchOption.TopDirectoryOnly); ArchiveFileMgr.MoveCoreTo_BackupFolders(); }