// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public int SaveContract(ContractInsertRequest model) { int id = 0; try { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Contract_Insert" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@quoteRequestId", model.QuoteRequestId); paramCollection.AddWithValue("@quoteId", model.QuoteId); SqlParameter p = new SqlParameter("@id", System.Data.SqlDbType.Int); p.Direction = System.Data.ParameterDirection.Output; paramCollection.Add(p); }, returnParameters : delegate(SqlParameterCollection param) { int.TryParse(param["@Id"].Value.ToString(), out id); }); } catch (Exception ex) { throw ex; } return(id); }
public void CreateContract(Document document, ContractInsertRequest model) { Section section = document.AddSection(); // Add content to address frame Paragraph paragraph = section.AddParagraph(); paragraph.AddText(model.ContractTerms); }
public Document CreateContractDocument(ContractInsertRequest model) { Document document = new Document(); document.Info.Title = "Contract"; document.Info.Subject = "Genera Contract"; document.Info.Author = "QuoteMule"; try { DefineContractStyles(document, model); } catch (Exception ex) { throw ex; } return(document); }
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ public bool UpdateContractURL(ContractInsertRequest model) { bool isSuccess = false; try { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Contract_UpdateURL" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@id", model.ContractId); paramCollection.AddWithValue("@url", model.URL); isSuccess = true; }); } catch (Exception ex) { throw ex; } return(isSuccess); }
// FOR CONTRACTS public string GenerateContractDocument(ContractInsertRequest model) { Document document = CreateContractDocument(model); document.UseCmykColor = true; const bool unicode = false; const PdfFontEmbedding embedding = PdfFontEmbedding.Always; DocumentRenderer renderer = new DocumentRenderer(document); PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(unicode, embedding); pdfRenderer.Document = document; pdfRenderer.RenderDocument(); MemoryStream stream = new MemoryStream(); pdfRenderer.PdfDocument.Save(stream, false); S3Request s3Request = new S3Request(); s3Request.NewFileName = Guid.NewGuid().ToString() + ".pdf"; s3Request.FileStream = stream; S3Handler s3Handler = new S3Handler(); string filename = s3Handler.UploadStream(s3Request); return(filename); //byte[] bytes = stream.ToArray(); //return bytes; }
public void DefineContractStyles(Document document, ContractInsertRequest model) { Style style = document.Styles["Normal"]; CreateContract(document, model); }