79 lines
3.1 KiB
C#
79 lines
3.1 KiB
C#
using Microsoft.Identity.Client;
|
|
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;
|
|
|
|
}
|
|
|
|
public static PWBaseAttachment BuildBaseAttachment(string token, PWImage image)
|
|
{
|
|
PWBaseAttachment attachment = new PWBaseAttachment();
|
|
attachment.AttToken = token.Replace("\"", "");
|
|
attachment.ThumbExists = true;
|
|
attachment.ZoomExists = true;
|
|
attachment.FileDate = "";
|
|
attachment.FileName = image.ShortFileName();
|
|
attachment.FileType = image.FileType;
|
|
return attachment;
|
|
}
|
|
|
|
public static PWBaseAttachment BuildBaseAttachment(string token, PWPdf pdf)
|
|
{
|
|
PWBaseAttachment attachment = new PWBaseAttachment();
|
|
attachment.AttToken = token.Replace("\"", "");
|
|
attachment.ThumbExists = false;
|
|
attachment.ZoomExists = true;
|
|
attachment.FileDate = "";
|
|
attachment.FileName = pdf.ShortFileName();
|
|
attachment.FileType = "application/pdf";
|
|
return attachment;
|
|
}
|
|
}
|
|
}
|