Beispiel #1
0
        public static bool Duplicate(FilePath <FileNameUserAndId> source, string newFileId)
        {
            FilePath <FileNameUserAndId> dest =
                ClassificationFileAssist.AssembleClassfFilePath(newFileId, source.FolderPath);

            if (!ValidateProposedClassfFile(dest,
                                            false, "Duplicate a Classification File", "already exists"))
            {
                return(false);
            }

            if (!FileUtilities.CopyFile(source.FullFilePath, dest.FullFilePath))
            {
                return(false);
            }

            BaseDataFile <ClassificationFileData> df =
                new BaseDataFile <ClassificationFileData>();

            // df.Configure(dest.FolderPath, dest.FileName);
            df.Configure(dest.FolderPath, dest.FileNameNoExt, dest.FileExtensionNoSep);
            df.Admin.Read();

            if (!df.Info.Description.IsVoid())
            {
                df.Info.Description = "COPY OF " + df.Info.Description;
            }
            else
            {
                df.Info.Description = "This file holds the PDF sheet classification information";
            }

            if (!df.Info.Notes.IsVoid())
            {
                df.Info.Notes = "COPY OF " + df.Info.Notes;
            }
            else
            {
                df.Info.Notes = dest.FileNameObject.UserName + " created this file on " + DateTime.Now;
            }

            df.Admin.Write();

            df = null;

            return(true);
        }
Beispiel #2
0
 public static ClassificationFile GetUserClassfFile(string fileId)
 {
     return(new ClassificationFile(ClassificationFileAssist.AssembleClassfFilePath(fileId,
                                                                                   SettingsSupport.UserClassifFolderPath.FullFilePath).FullFilePath));
 }