public async Task <ResponseTOCContractDTO> GenerateDocumentTOC(InvestorInfo investorInfo) { if (investorInfo == null) { throw new ArgumentNullException(nameof(investorInfo)); } GeneratePDF generatePDF = new GeneratePDF(); string newDocumentFileName = generatePDF.GenerateInvestorDocument(investorInfo); ResponseTOCContractDTO response = new ResponseTOCContractDTO(); if (!string.IsNullOrWhiteSpace(newDocumentFileName)) { ContractInvestor contractInvestor = new ContractInvestor() { FileName = newDocumentFileName, Email = investorInfo.Email, FullName = string.Concat(investorInfo.FirstName, " ", investorInfo.LastName), DocNumber = investorInfo.DocumentNumber }; response = await _tocLogic.CreateContract(contractInvestor); } return(response); }
public ResultResponse postInvestorInfo(InvestorInfo inves) { ResultResponse res = new ResultResponse(); //VPSServices service = new VPSServices(); string json = JsonConvert.SerializeObject(inves); return(new ResultResponse { errorCode = null, errorMessage = null }); //return service.postInvestorInfo(json); }
public string GenerateInvestorDocument(InvestorInfo investorInfo) { string fullName = string.Concat(investorInfo.FirstName, " ", investorInfo.LastName); string filePath = @"Template_Investor\"; string fileNameExisting = @"TemplateInvestor.pdf"; string fileNameNew = @"InvestorContract_" + fullName.Replace(" ", "").Trim() + ".pdf"; string fullNewPath = filePath + fileNameNew; string fullExistingPath = filePath + fileNameExisting; using (var existingFileStream = new FileStream(fullExistingPath, FileMode.Open)) using (var newFileStream = new FileStream(fullNewPath, FileMode.Create)) { // Open existing PDF var pdfReader = new PdfReader(existingFileStream); // PdfStamper, which will create var stamper = new PdfStamper(pdfReader, newFileStream); AcroFields fields = stamper.AcroFields; fields.SetField("FULLNAME", fullName); fields.SetField("DOCNUMBER", investorInfo.DocumentNumber); fields.SetField("RUCNUMBER", investorInfo.RUCNumber); fields.SetField("FULLADDRESS", investorInfo.FullAddress); fields.SetField("SIGNATUREFULLNAME", fullName); fields.SetField("SIGNATUREDOCNUMBER", investorInfo.DocumentNumber); fields.SetField("SIGNATURERUCNUMBER", investorInfo.RUCNumber); // "Flatten" the form so it wont be editable/usable anymore stamper.FormFlattening = true; stamper.Close(); pdfReader.Close(); //return new FileStreamResult(newFileStream, "application/pdf"); return(fileNameNew); } }
public ResultResponse PostInvestorInfo([FromBody] InvestorInfo inves) { ResultResponse res = new ResultResponse(); return(investorRepository.postInvestorInfo(inves)); }