PWAPP/PWAPPv2/Source/Attachments/AttachmentFactory.cs

54 lines
2.1 KiB
C#

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;
}
}
}