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
+4 -6
View File
@@ -1,6 +1,6 @@
namespace PWAPPv2.Source.DataObjects
{
class Attachment
public class Attachment
{
APICredentials Credentials;
public PWImage image { get; set; }
@@ -28,7 +28,7 @@
public string ToJsonString()
{
if (fileType == "image/jpeg")
if (image != null)
{
return "\"{" + Credentials.BuildJsonBodyContents() +
",'UserNum':'API'," +
@@ -37,10 +37,8 @@
"'ThumbExists':'1'," +
"'ZoomExists':'1'," +
"'FileDate':''," +
"'FileType':'" + fileType + "'," +
"'Base64FileContents':'" + image.GetBase64String() + "',\n" +
"'Base64ThumbContents':'" + image.GetBase64ThumbString() + "',\n" +
"'Base64ZoomContents':'" + image.GetBase64ZoomString() + "'}\"";
"'FileType':'" + image.FileType + "'," +
image.GetJsonContents() + "}\"";
}
else
{
+22
View File
@@ -12,6 +12,8 @@ namespace PWAPPv2.Source.DataObjects
private BitmapImage bitmap;
public string FileType { get; }
//private Bitmap bmp;
//private Bitmap thumb;
@@ -26,6 +28,17 @@ namespace PWAPPv2.Source.DataObjects
bitmap.DecodePixelWidth = 100;
bitmap.EndInit();
string extension = Path.GetExtension(path).ToLower();
if(extension == ".jpeg" || extension == ".jpg")
{
FileType = "image/jpeg";
}
else if(extension == ".png")
{
FileType = "image/png";
}
//bmp = (Bitmap)System.Drawing.Image.FromFile(ImagePath);
//thumb = resize(bmp, 50, 50);
//zoom = resize(bmp, bmp.Width, bmp.Height);
@@ -96,5 +109,14 @@ namespace PWAPPv2.Source.DataObjects
return ImagePath.Substring(ImagePath.LastIndexOf("\\") + 1);
}
public string GetJsonContents()
{
string str = "'Base64FileContents':'" + GetBase64String() + "',\n" +
"'Base64ThumbContents':'" + GetBase64ThumbString() + "',\n" +
"'Base64ZoomContents':'" + GetBase64ZoomString() + "'\n";
return str;
}
}
}
+58
View File
@@ -0,0 +1,58 @@
using System.Collections.Generic;
namespace PWAPPv2.Source
{
class Patient
{
public string PatNum;
public string FName;
public string MName;
public string LName;
public string Gender;
public string DoB;
public string SSN;
public string Address;
public string Address2;
public string City;
public string State;
public string Zip;
public string HomePhone;
public string WorkPhone;
public string WirelessPhone;
public string Email;
public static Patient GetPatient(Database.DatabaseConnection connection, string patNum)
{
Patient patient = new Patient();
patient.BuildFromDatabase(connection, patNum);
return patient;
}
public void BuildFromDatabase(Database.DatabaseConnection databaseConnection, string patNum)
{
List<string> result = databaseConnection.QueryDatabase("SELECT PatNum, LName, FName, MiddleI, Gender, Birthdate," +
"SSN, Address, Address2, City, State, Zip, HmPhone, WkPhone, WirelessPhone, Email FROM patient WHERE PatNum = " + patNum);
PatNum = result[0];
LName = result[1];
FName = result[2];
MName = result[3];
Gender = result[4];
DoB = result[5];
SSN = result[6];
Address = result[7];
Address2 = result[8];
City = result[9];
State = result[10];
Zip = result[11];
HomePhone = result[12];
WorkPhone = result[13];
WirelessPhone = result[14];
Email = result[15];
}
}
}
@@ -0,0 +1,24 @@
namespace PWAPPv2.Source
{
class PatientGUIAdapter
{
private Patient p;
public string txtFName { get { return p.FName; } }
public string txtLName { get { return p.LName; } }
public string txtMName { get { return p.MName; } }
public string txtDob { get { return p.DoB; } }
public string txtStreet { get { return p.Address; } }
public string txtCity { get { return p.City; } }
public string txtState { get { return p.State; } }
public string txtZip { get { return p.Zip; } }
public string txtHomePhone { get { return p.HomePhone; } }
public string txtWorkPhone { get { return p.WorkPhone; } }
public string txtWirelessPhone { get { return p.WirelessPhone; } }
public string txtEmail { get { return p.Email; } }
public PatientGUIAdapter(Patient patient)
{
p = patient;
}
}
}