Lots of updates
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
class Referral
|
||||
{
|
||||
APICredentials ApiCredentials;
|
||||
Patient PatientData;
|
||||
ReferToBox ReferTo;
|
||||
ReferFromBox ReferFrom;
|
||||
ReferralTypeBox ReferralType;
|
||||
|
||||
RichTextBox RemarksBox;
|
||||
CheckBox ContactBox;
|
||||
|
||||
public Referral(APICredentials apiCredentials, Patient patient, ReferralTypeBox referralType, ReferToBox referTo, ReferFromBox referFrom, RichTextBox remarksBox, CheckBox contactBox)
|
||||
{
|
||||
ApiCredentials = apiCredentials;
|
||||
PatientData = patient;
|
||||
ReferralType = referralType;
|
||||
ReferTo = referTo;
|
||||
ReferFrom = referFrom;
|
||||
RemarksBox = remarksBox;
|
||||
ContactBox = contactBox;
|
||||
}
|
||||
|
||||
public string ToJsonString()
|
||||
{
|
||||
|
||||
string RemarksText = new TextRange(RemarksBox.Document.ContentStart, RemarksBox.Document.ContentEnd).Text;
|
||||
|
||||
int contact = 0;
|
||||
if(ContactBox.IsChecked == true)
|
||||
{
|
||||
contact = 1;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return "\"{" + ApiCredentials.BuildJsonBodyContents() + "," +
|
||||
"'LName':'" + PatientData.LName + "'," +
|
||||
"'FName':'" + PatientData.FName + "'," +
|
||||
"'Birthday':'" + PatientData.DoB + "'," +
|
||||
"'Address':'" + PatientData.Address + "'," +
|
||||
"'Address2':'" + PatientData.Address2 + "'," +
|
||||
"'City':'" + PatientData.City + "'," +
|
||||
"'State':'" + PatientData.State + "'," +
|
||||
"'Zip':'" + PatientData.Zip + "'," +
|
||||
"'HmPhone':'" + PatientData.HomePhone + "'," +
|
||||
"'WkPhone':'" + PatientData.WorkPhone + "'," +
|
||||
"'WirelessPhone':'" + PatientData.WirelessPhone + "'," +
|
||||
"'Email':'" + PatientData.Email + "'," +
|
||||
"'ReferralType':'" + ReferralType.GetSelectedID() + "'," +
|
||||
"'SubmittedBy':'" + ReferFrom.GetSelectedID() + "'," +
|
||||
"'ToPracticeId':'" + ReferTo.GetSelectedPracticeID() + "'," +
|
||||
"'ToDoctorID':'" + ReferTo.GetSelectedDoctorID() + "'," +
|
||||
"'Attachments':'False'," +
|
||||
"'Remarks':'" + RemarksText + "'," +
|
||||
"'Contact':'" + contact + "'}\"";
|
||||
}
|
||||
catch (Source.DataObjects.ReferralTypeDefaultException)
|
||||
{
|
||||
MessageBox.Show("Please select a referral type");
|
||||
}
|
||||
catch(Source.DataObjects.ReferToDefaultException)
|
||||
{
|
||||
MessageBox.Show("Please select a refer to");
|
||||
}
|
||||
catch(Source.DataObjects.ReferFromDefaultException)
|
||||
{
|
||||
MessageBox.Show("Please select a refer from");
|
||||
}
|
||||
throw new InvalidReferalDataException();
|
||||
}
|
||||
|
||||
public class InvalidReferalDataException : Exception
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user