Exemplo n.º 1
0
 private GeneratedDocumentDomain GenerateRegularDocument(DocumentTypeDomain inputDocType, DocumentTypeDomain outputDocTypeDomain,
                                                         string inputContent, GeneratedDocumentDomain generatedDoc)
 {
     if (CompareDocTypes(inputDocType, outputDocTypeDomain, DocumentTypeEnum.Html, DocumentTypeEnum.Pdf))
     {
         generatedDoc.ByteContent = _pdfGenerator.GeneratePdfFromHtml(inputContent);
     }
     else if (CompareDocTypes(inputDocType, outputDocTypeDomain, DocumentTypeEnum.Json, DocumentTypeEnum.Pdf))
     {
         generatedDoc.ByteContent = _pdfGenerator.GeneratePdfFromJson(inputContent);
     }
     else if (CompareDocTypes(inputDocType, outputDocTypeDomain, DocumentTypeEnum.Html, DocumentTypeEnum.Odt))
     {
         generatedDoc.ByteContent = _odtGenerator.GenerateOdtFromHtml(inputContent);
     }
     else if (CompareDocTypes(inputDocType, outputDocTypeDomain, DocumentTypeEnum.Html, DocumentTypeEnum.Docx))
     {
         generatedDoc.ByteContent = _docxGenerator.GenerateDocxFromHtml(inputContent);
     }
     else if (CompareDocTypes(inputDocType, outputDocTypeDomain, DocumentTypeEnum.Json, DocumentTypeEnum.Html))
     {
         generatedDoc.Content = _htmlGenerator.GenerateHtmlFromJson(inputContent, generatedDoc.Name);
     }
     else
     {
         generatedDoc.Success = false;
         generatedDoc.Content = DocumentMessages.ArgumentInvalidDocType;
         generatedDoc.Name    = DocumentMessages.UndefinedDocumentName;
     }
     return(generatedDoc);
 }