Esempio n. 1
0
        public static void SaveFileToTransitoAttachLocalPath(DocumentAttach attach, Byte[] content)
        {
            if (attach == null)
            {
                throw new Exceptions.DocumentNotFound_Exception("SaveFileToTransitoAttachLocalPath : document is null");
            }

            if (attach.Document == null)
            {
                throw new Exceptions.DocumentNotFound_Exception("SaveFileToTransitoAttachLocalPath : referrer document is null");
            }

            if (attach.Document.Archive == null || attach.Document.Archive.IdArchive == Guid.Empty)
            {
                throw new Exceptions.Archive_Exception("SaveFileToTransitoAttachLocalPath : document archive is null");
            }

            if (string.IsNullOrWhiteSpace(attach.Document.Archive.PathTransito))
            {
                attach.Document.Archive = ArchiveService.GetArchive(attach.Document.Archive.IdArchive);
                if (attach.Document.Archive == null || string.IsNullOrWhiteSpace(attach.Document.Archive.PathTransito))
                {
                    throw new Exceptions.Archive_Exception("SaveFileToTransitoAttachLocalPath : document archive transit's path is not valid");
                }
            }

            if (!Directory.Exists(attach.Document.Archive.PathTransito))
            {
                Directory.CreateDirectory(attach.Document.Archive.PathTransito);
            }

            File.WriteAllBytes(Path.Combine(attach.Document.Archive.PathTransito, attach.Document.IdDocument + "_" + attach.IdDocumentAttach + Path.GetExtension(attach.Name)), content);
        }
Esempio n. 2
0
 public static void SaveFileToTransitoLocalPath(Document Document, Byte[] content)
 {
     if (string.IsNullOrEmpty(Document.Archive.PathTransito))
     {
         Document.Archive = ArchiveService.GetArchive(Document.Archive.IdArchive);
     }
     if (!Directory.Exists(Document.Archive.PathTransito))
     {
         Directory.CreateDirectory(Document.Archive.PathTransito);
     }
     File.WriteAllBytes(Path.Combine(Document.Archive.PathTransito, Document.IdDocument + Path.GetExtension(Document.Name)), content);
 }