public void SortFilesInStageDBData() { StageDB stageDB = new StageDB(); List <ImageInfo> imageInfos = new List <ImageInfo>(); imageInfos = stageDB.GetAllImageInfos(); FileMover fileMover = new FileMover(); decimal isCigDecider = new decimal(0.70); decimal isNonCigDecider = new decimal(0.70); foreach (ImageInfo imageInfo in imageInfos) { //{ LessThan = -1, Equals = 0, GreaterThan = 1 } if (Decimal.Compare(imageInfo.IsCig, isCigDecider) == 1 || Decimal.Compare(imageInfo.IsCig, isCigDecider) == 0) { ImageFile imageFile = stageDB.GetImageFile(imageInfo.ImageFileID); fileMover.MoveImageFile(imageFile, @"C:\TrashDetector\Data\StageDBData\cigarettes\"); imageFile.FilePath = @"C:\TrashDetector\Data\StageDBData\cigarettes\" + imageFile.FileName; stageDB.UpdateImageFilePath(imageFile); } else if (Decimal.Compare(imageInfo.IsNotCig, isNonCigDecider) == 1 || Decimal.Compare(imageInfo.IsCig, isNonCigDecider) == 0) { ImageFile imageFile = stageDB.GetImageFile(imageInfo.ImageFileID); fileMover.MoveImageFile(imageFile, @"C:\TrashDetector\Data\StageDBData\non_cigarettes\"); imageFile.FilePath = @"C:\TrashDetector\Data\StageDBData\non_cigarettes\" + imageFile.FileName; stageDB.UpdateImageFilePath(imageFile); } else { ImageFile imageFile = stageDB.GetImageFile(imageInfo.ImageFileID); fileMover.MoveImageFile(imageFile, @"C:\TrashDetector\Data\StageDBData\uncertain\"); imageFile.FilePath = @"C:\TrashDetector\Data\StageDBData\uncertain\" + imageFile.FileName; stageDB.UpdateImageFilePath(imageFile); } } }
public void LoadDataFromStageDBtoResultDB() { List <ImageFile> imageFiles = new List <ImageFile>(); List <ImageInfo> imageInfos = new List <ImageInfo>(); StageDB stageDB = new StageDB(); ResultDB resultDB = new ResultDB(); imageFiles = stageDB.GetAllImageFiles(); imageInfos = stageDB.GetAllImageInfos(); foreach (ImageFile imageFile in imageFiles) { imageFile.FilePath.Replace("StageDBData", "ResultDBData"); resultDB.InsertImageFile(imageFile); } foreach (ImageInfo imageInfo in imageInfos) { resultDB.InsertImageInfo(imageInfo); } }