Fixed issue with attachment tokens. Changed how attachments are handled to be more modular. Added support for PNG files.

This commit is contained in:
2024-02-09 19:02:09 -05:00
parent 40f9db3ea4
commit f31302438d
10 changed files with 410 additions and 74 deletions
@@ -0,0 +1,53 @@
using PWAPPv2.Source.DataObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PWAPPv2.Source.Attachments
{
public class AttachmentFactory
{
public static PWAttachment BuildAttachment(APICredentials credentials, string token, PWImage image)
{
PWAttachment attachment = new PWAttachment();
attachment.UserID = credentials.UserID;
attachment.Password = credentials.Password;
attachment.PracticeId = credentials.PracticeId;
attachment.APIid = credentials.APIid;
attachment.UserNum = "API";
attachment.AttToken = token.Replace("\"", "");
attachment.ThumbExists = "1";
attachment.ZoomExists = "1";
attachment.FileDate = "";
attachment.FileName = image.ShortFileName();
attachment.FileType = image.FileType;
attachment.Base64FileContents = image.GetBase64String();
attachment.Base64ThumbContents = image.GetBase64ThumbString();
attachment.Base64ZoomContents = image.GetBase64ZoomString();
return attachment;
}
public static PWAttachment BuildAttachment(APICredentials credentials, string token, PWPdf pdf)
{
PWAttachment attachment = new PWAttachment();
attachment.UserID = credentials.UserID;
attachment.Password = credentials.Password;
attachment.PracticeId = credentials.PracticeId;
attachment.APIid = credentials.APIid;
attachment.UserNum = "API";
attachment.AttToken = token.Replace("\"", "");
attachment.ThumbExists = "0";
attachment.ZoomExists = "0";
attachment.FileDate = "";
attachment.FileName = pdf.ShortFileName();
attachment.FileType = "application/pdf";
attachment.Base64FileContents = pdf.GetBase64String();
attachment.Base64ThumbContents = "";
attachment.Base64ZoomContents = "";
return attachment;
}
}
}