Пример #1
0
    public BiblosDS.Library.Common.Objects.DocumentContent GetPreservationCloseFile(Guid idPreservation, BiblosDS.Library.Common.Enums.DocumentContentFormat outputFormat)
    {
        logger.InfoFormat("GetPreservationCloseFile - id preservation {0}", idPreservation);
        try
        {
            var info = new PreservationService().GetPreservationClosingFileInfo(idPreservation);
            if (info == null)
            {
                throw new BiblosDS.Library.Common.Exceptions.DocumentNotFound_Exception("File di chiusura non trovato");
            }
            switch (outputFormat)
            {
            case BiblosDS.Library.Common.Enums.DocumentContentFormat.Binary:
                return(new BiblosDS.Library.Common.Objects.DocumentContent {
                    Blob = info.File, Description = info.FileName
                });

            case BiblosDS.Library.Common.Enums.DocumentContentFormat.ConformBinary:
                if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["BoblosDSConvWs.BiblosDSConv"]))
                {
                    BiblosDS.WCF.WCFServices.BoblosDSConvWs.BiblosDSConv wsStampaConforme = new BiblosDS.WCF.WCFServices.BoblosDSConvWs.BiblosDSConv();
                    wsStampaConforme.Url = ConfigurationManager.AppSettings["BoblosDSConvWs.BiblosDSConv"].ToString();
                    var conformDoc = wsStampaConforme.ToRaster(new BiblosDS.WCF.WCFServices.BoblosDSConvWs.stDoc {
                        Blob = Convert.ToBase64String(info.File), FileExtension = info.FileName
                    });
                    return(new BiblosDS.Library.Common.Objects.DocumentContent {
                        Description = ".pdf", Blob = Convert.FromBase64String(conformDoc.Blob)
                    });
                }
                else
                {
                    return(new BiblosDS.Library.Common.Objects.DocumentContent {
                        Blob = info.File, Description = info.FileName
                    });
                }

            default:
                throw new FormatException("Formato di output non supportato.");
            }
        }
        catch (Exception ex)
        {
            logger.Error(ex);
            if (ex is FaultException)
            {
                throw ex;
            }
            else
            {
                throw new FaultException <BiblosDsException>(new BiblosDsException(ex), new FaultReason(ex.Message));
            }
        }
        finally
        {
            logger.Info("GetPreservationCloseFile - END");
        }
    }
Пример #2
0
 public BiblosDS.Library.Common.Objects.DocumentContent GetPreservationAdEMark(Guid idPreservation, BiblosDS.Library.Common.Enums.DocumentContentFormat outputFormat)
 {
     try
     {
         throw new NotImplementedException();
     }
     catch (Exception ex)
     {
         logger.Error(ex);
         if (ex is FaultException)
         {
             throw ex;
         }
         else
         {
             throw new FaultException <BiblosDsException>(new BiblosDsException(ex), new FaultReason(ex.Message));
         }
     }
 }