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 Create(string classfRootFolderPath)
        {
            FilePath <FileNameSimple> dest =
                FileUtilities.UniqueFileName(AssembleFileNameNoExt(Environment.UserName, "Pdf Classfications {0:D3}"),
                                             "xml", classfRootFolderPath + FilePathUtil.PATH_SEPARATOR + Environment.UserName);

            if (dest == null)
            {
                return(null);
            }

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

            df.Configure(dest.FolderPath, dest.FileNameNoExt, dest.FileExtensionNoSep);
            df.Admin.Read();
            df.Info.Description = "This file holds the PDF sheet classification information";
            df.Info.Notes       = Environment.UserName + " created this file on " + DateTime.Now;

            df.Admin.Write();

            return(new ClassificationFile(dest.FullFilePath));
        }