Lots of updates

This commit is contained in:
Matthew Burke 2023-07-26 22:26:54 -04:00
parent 42794b6284
commit 1b65e9bb83
24 changed files with 1305 additions and 28 deletions

View File

@ -1,6 +1,46 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <configuration>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup> </startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.IdentityModel.Abstractions" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.24.0.0" newVersion="6.24.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Identity.Client" publicKeyToken="0a613f4dd989e8ae" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.47.2.0" newVersion="4.47.2.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration> </configuration>

View File

@ -2,7 +2,8 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:PWAPPv2" xmlns:local="clr-namespace:PWAPPv2"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml"
Startup="app_Startup">
<Application.Resources> <Application.Resources>
</Application.Resources> </Application.Resources>

View File

@ -13,5 +13,13 @@ namespace PWAPPv2
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
public static string[] Args;
void app_Startup(object sender, StartupEventArgs e)
{
if(e.Args.Length > 0)
{
Args = e.Args;
}
}
} }
} }

View File

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Config> <Config>
<ODhost>10.0.1.107</ODhost>
<ODuser>root</ODuser>
<ODpassword></ODpassword>
<pwuserid>testdoctor</pwuserid> <pwuserid>testdoctor</pwuserid>
<pwpassword>testdoctor</pwpassword> <pwpassword>testdoctor</pwpassword>
<pwpracticeid>210</pwpracticeid> <pwpracticeid>210</pwpracticeid>

View File

@ -5,14 +5,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PWAPPv2" xmlns:local="clr-namespace:PWAPPv2"
mc:Ignorable="d" mc:Ignorable="d"
Title="Quick Referral" Height="500" Width="800"> Title="Quick Referral" Height="537" Width="800">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="9*"/> <ColumnDefinition Width="9*"/>
<ColumnDefinition Width="13*"/> <ColumnDefinition Width="13*"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<GroupBox Header="Patient" HorizontalAlignment="Left" Height="226" Margin="10,10,0,0" VerticalAlignment="Top" Width="309"> <GroupBox Header="Patient" HorizontalAlignment="Left" Height="332" Margin="10,10,0,0" VerticalAlignment="Top" Width="309">
<Grid HorizontalAlignment="Left" Height="198" VerticalAlignment="Top" Width="289" Margin="0,0,0,-1"> <Grid HorizontalAlignment="Left" Height="307" VerticalAlignment="Top" Width="289">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/> <ColumnDefinition Width="1*"/>
@ -26,6 +26,11 @@
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/> <RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Label Content="Last Name:" HorizontalAlignment="Left" VerticalAlignment="Top"/> <Label Content="Last Name:" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label Content="First Name:" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top"/> <Label Content="First Name:" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top"/>
@ -35,6 +40,11 @@
<Label Content="Street Address:" HorizontalAlignment="Left" Grid.Row="4" VerticalAlignment="Top"/> <Label Content="Street Address:" HorizontalAlignment="Left" Grid.Row="4" VerticalAlignment="Top"/>
<Label Content="City:" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Top"/> <Label Content="City:" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Top"/>
<Label Content="Zip Code:" HorizontalAlignment="Left" Grid.Row="7" VerticalAlignment="Top"/> <Label Content="Zip Code:" HorizontalAlignment="Left" Grid.Row="7" VerticalAlignment="Top"/>
<Label Content="Home Phone" HorizontalAlignment="Left" Margin="1,0,0,0" Grid.Row="8" VerticalAlignment="Top"/>
<Label Content="Work Phone" HorizontalAlignment="Left" Margin="1,0,0,0" Grid.Row="9" VerticalAlignment="Top"/>
<Label Content="Wireless Phone" HorizontalAlignment="Left" Margin="1,0,0,0" Grid.Row="10" VerticalAlignment="Top"/>
<Label Content="Email" HorizontalAlignment="Left" Margin="1,0,0,0" Grid.Row="11" VerticalAlignment="Top"/>
<Label x:Name="txtLName" Content="{Binding Path=txtLName}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top"/> <Label x:Name="txtLName" Content="{Binding Path=txtLName}" Grid.Column="1" HorizontalAlignment="Left" VerticalAlignment="Top"/>
<Label x:Name="txtFName" Content="{Binding Path=txtFName}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top"/> <Label x:Name="txtFName" Content="{Binding Path=txtFName}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="1" VerticalAlignment="Top"/>
<Label x:Name="txtMName" Content="{Binding Path=txtMName}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="2" VerticalAlignment="Top"/> <Label x:Name="txtMName" Content="{Binding Path=txtMName}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="2" VerticalAlignment="Top"/>
@ -43,10 +53,15 @@
<Label x:Name="txtCity" Content="{Binding Path=txtCity}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Top"/> <Label x:Name="txtCity" Content="{Binding Path=txtCity}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="5" VerticalAlignment="Top"/>
<Label x:Name="txtState" Content="{Binding Path=txtState}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="6" VerticalAlignment="Top"/> <Label x:Name="txtState" Content="{Binding Path=txtState}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="6" VerticalAlignment="Top"/>
<Label x:Name="txtZip" Content="{Binding Path=txtZip}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="7" VerticalAlignment="Top"/> <Label x:Name="txtZip" Content="{Binding Path=txtZip}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="7" VerticalAlignment="Top"/>
<Label x:Name="txtHomePhone" Content="{Binding Path=txtHomePhone}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="8" VerticalAlignment="Top"/>
<Label x:Name="txtWorkPhone" Content="{Binding Path=txtWorkPhone}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="9" VerticalAlignment="Top"/>
<Label x:Name="txtWirelessPhone" Content="{Binding Path=txtWirelessPhone}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="10" VerticalAlignment="Top"/>
<Label x:Name="txtEmail" Content="{Binding Path=txtEmail}" Grid.Column="1" HorizontalAlignment="Left" Grid.Row="11" VerticalAlignment="Top"/>
</Grid> </Grid>
</GroupBox> </GroupBox>
<GroupBox Header="Referral Type" HorizontalAlignment="Left" Height="55" Margin="0,10,0,0" VerticalAlignment="Top" Width="458" Grid.Column="1"> <GroupBox Header="Referral Type" HorizontalAlignment="Left" Height="55" Margin="0,10,0,0" VerticalAlignment="Top" Width="458" Grid.Column="1">
<ComboBox x:Name="boxReferType" HorizontalAlignment="Left" Margin="0,10,-2,0" VerticalAlignment="Top" Width="448"/> <ComboBox x:Name="boxReferType" HorizontalAlignment="Left" Margin="0,10,-2,0" VerticalAlignment="Top" Width="448" SelectionChanged="boxReferType_SelectionChanged"/>
</GroupBox> </GroupBox>
<GroupBox Header="Refer From" HorizontalAlignment="Left" Height="55" Margin="0,65,0,0" VerticalAlignment="Top" Width="458" Grid.Column="1"> <GroupBox Header="Refer From" HorizontalAlignment="Left" Height="55" Margin="0,65,0,0" VerticalAlignment="Top" Width="458" Grid.Column="1">
<ComboBox x:Name="boxReferFrom" HorizontalAlignment="Left" Margin="0,10,-2,0" VerticalAlignment="Top" Width="448"/> <ComboBox x:Name="boxReferFrom" HorizontalAlignment="Left" Margin="0,10,-2,0" VerticalAlignment="Top" Width="448"/>
@ -54,9 +69,9 @@
<GroupBox Header="Refer To" HorizontalAlignment="Left" Height="55" Margin="0,120,0,0" VerticalAlignment="Top" Width="458" Grid.Column="1"> <GroupBox Header="Refer To" HorizontalAlignment="Left" Height="55" Margin="0,120,0,0" VerticalAlignment="Top" Width="458" Grid.Column="1">
<ComboBox x:Name="boxReferTo" HorizontalAlignment="Left" Margin="0,10,-2,0" VerticalAlignment="Top" Width="448"/> <ComboBox x:Name="boxReferTo" HorizontalAlignment="Left" Margin="0,10,-2,0" VerticalAlignment="Top" Width="448"/>
</GroupBox> </GroupBox>
<CheckBox Content="Contact Doctor" HorizontalAlignment="Left" Margin="0,175,0,0" VerticalAlignment="Top" Grid.Column="1" Checked="CheckBox_Checked" Height="15" Width="101"/> <CheckBox x:Name="contact" Content="Contact Doctor" HorizontalAlignment="Left" Margin="0,175,0,0" VerticalAlignment="Top" Grid.Column="1" Checked="CheckBox_Checked" Height="15" Width="101"/>
<GroupBox Header="Remarks" HorizontalAlignment="Left" Height="218" Margin="10,241,0,0" VerticalAlignment="Top" Width="309"> <GroupBox Header="Remarks" HorizontalAlignment="Left" Height="150" Margin="10,347,0,0" VerticalAlignment="Top" Width="309">
<RichTextBox x:Name="fieldRemakrs" HorizontalAlignment="Left" Height="198" VerticalAlignment="Top" Width="299" Margin="0,0,-2,-3"> <RichTextBox x:Name="fieldRemakrs" HorizontalAlignment="Left" Height="127" VerticalAlignment="Top" Width="299" Margin="0,0,-2,0">
<FlowDocument> <FlowDocument>
<Paragraph> <Paragraph>
<Run x:Name="fieldRemakrsText" Text=""/> <Run x:Name="fieldRemakrsText" Text=""/>
@ -64,13 +79,13 @@
</FlowDocument> </FlowDocument>
</RichTextBox> </RichTextBox>
</GroupBox> </GroupBox>
<Button Content="Send" HorizontalAlignment="Left" Margin="383,429,0,0" VerticalAlignment="Top" Width="75" Grid.Column="1" Height="20"/> <Button Content="Send" HorizontalAlignment="Left" Margin="383,476,0,0" VerticalAlignment="Top" Width="75" Grid.Column="1" Height="20" Click="Button_Click_1"/>
<Button Content="Cancel" HorizontalAlignment="Left" Margin="303,429,0,0" VerticalAlignment="Top" Width="75" Grid.Column="1" Height="20"/> <Button Content="Cancel" HorizontalAlignment="Left" Margin="303,476,0,0" VerticalAlignment="Top" Width="75" Grid.Column="1" Height="20" Click="Button_Click"/>
<GroupBox Header="Images" HorizontalAlignment="Left" Height="234" Margin="1,190,0,0" VerticalAlignment="Top" Width="457" Grid.Column="1"> <GroupBox Header="Images" HorizontalAlignment="Left" Height="281" Margin="1,190,0,0" VerticalAlignment="Top" Width="457" Grid.Column="1">
<Grid HorizontalAlignment="Left" Height="210" VerticalAlignment="Top" Width="447" Margin="0,0,-2,0"> <Grid HorizontalAlignment="Left" Height="258" VerticalAlignment="Top" Width="447" Margin="0,0,-2,0">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="13*"/> <RowDefinition Height="4*"/>
<RowDefinition Height="92*"/> <RowDefinition Height="39*"/>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid HorizontalAlignment="Left" Height="21" VerticalAlignment="Top" Width="447" RenderTransformOrigin="0.486,2.034"> <Grid HorizontalAlignment="Left" Height="21" VerticalAlignment="Top" Width="447" RenderTransformOrigin="0.486,2.034">

View File

@ -25,27 +25,76 @@ namespace PWAPPv2
/// </summary> /// </summary>
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
Source.APIConfig apiconfig = new Source.APIConfig(); static Source.APIConfig apiconfig = new Source.APIConfig();
static Source.Database.DatabaseConfig DataConfig;
static Source.API.APIConnection apiConnection;
Source.DataObjects.APICredentials apiCreds;
Source.DataObjects.ComboBoxData TypeBox;
Source.DataObjects.ComboBoxData ToBox;
Source.DataObjects.ComboBoxData FromBox;
string[] args;
Source.Patient patient;
public MainWindow() public MainWindow()
{ {
try
{
args = App.Args;
}
catch(Exception)
{ }
apiconfig.LoadConfig("./Config/Config.xml"); apiconfig.LoadConfig("./Config/Config.xml");
DataConfig = new Source.Database.DatabaseConfig("./Config/Config.xml");
Source.Database.DatabaseConnection dbcon = new Source.Database.DatabaseConnection(DataConfig);
apiCreds = new Source.DataObjects.APICredentials(apiconfig);
apiConnection = new Source.API.APIConnection("http://apipatientweb.azurewebsites.net/",
apiCreds);
InitializeComponent(); InitializeComponent();
Source.Patient patient = new Source.Patient(); PopulateComboBoxes();
patient.FName = "Matthew";
patient.MName = "Charles"; patient = new Source.Patient();
patient.LName = "Burke";
patient.DoB = "02/24/1999"; patient.BuildFromDatabase(dbcon, args[0]);
patient.Address = "33B N Earl St";
patient.City = "Shippensburg";
patient.State = "Pennsylvania";
patient.Zip = "17257";
this.DataContext = new Source.PatientGUIAdapter(patient); this.DataContext = new Source.PatientGUIAdapter(patient);
} }
private void PopulateComboBoxes()
{
PopulateReferTypesBox();
PopulateReferToBox();
PopulateReferFromBox();
}
private void PopulateReferTypesBox()
{
string ReferTypeString = apiConnection.SendPostRequestAsync("api/PWReferralTypes");
TypeBox = new Source.DataObjects.ReferralTypeBox(boxReferType, ReferTypeString);
}
private void PopulateReferToBox()
{
string ReferToString = apiConnection.SendPostRequestAsync("api/PWReferTo");
ToBox = new Source.DataObjects.ReferToBox(boxReferTo, ReferToString);
}
private void PopulateReferFromBox()
{
string ReferFromString = apiConnection.SendPostRequestAsync("api/PWReferFrom");
FromBox = new Source.DataObjects.ReferFromBox(boxReferFrom, ReferFromString);
}
private void RichTextBox_TextChanged(object sender, TextChangedEventArgs e) private void RichTextBox_TextChanged(object sender, TextChangedEventArgs e)
{ {
@ -60,5 +109,50 @@ namespace PWAPPv2
{ {
} }
private void boxReferType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
TypeBox.GetSelectedID();
}
catch(Source.DataObjects.ReferralTypeDefaultException)
{
}
catch(Source.DataObjects.InvalidReferralTypeException)
{
}
catch(NullReferenceException)
{
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
this.Close();
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
Source.DataObjects.Referral referral = new Source.DataObjects.Referral(apiCreds, patient,
(Source.DataObjects.ReferralTypeBox)TypeBox,
(Source.DataObjects.ReferToBox)ToBox,
(Source.DataObjects.ReferFromBox)FromBox,
fieldRemakrs, contact);
try
{
string referralString = referral.ToJsonString();
string result = apiConnection.SendPostRequestAsync("api/PWMakeReferral", referralString);
MessageBox.Show(result);
this.Close();
}
catch(Source.DataObjects.Referral.InvalidReferalDataException)
{
}
}
} }
} }

View File

@ -14,6 +14,8 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
@ -35,14 +37,167 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Azure.Core, Version=1.25.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>..\packages\Azure.Core.1.25.0\lib\net461\Azure.Core.dll</HintPath>
</Reference>
<Reference Include="Azure.Identity, Version=1.7.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8, processorArchitecture=MSIL">
<HintPath>..\packages\Azure.Identity.1.7.0\lib\netstandard2.0\Azure.Identity.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.7.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Data.SqlClient, Version=5.0.0.0, Culture=neutral, PublicKeyToken=23ec7fc2d6eaa4a5, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Data.SqlClient.5.1.1\lib\net462\Microsoft.Data.SqlClient.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Identity.Client, Version=4.47.2.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Identity.Client.4.47.2\lib\net461\Microsoft.Identity.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Identity.Client.Extensions.Msal, Version=2.19.3.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Identity.Client.Extensions.Msal.2.19.3\lib\net45\Microsoft.Identity.Client.Extensions.Msal.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Abstractions, Version=6.24.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Abstractions.6.24.0\lib\net472\Microsoft.IdentityModel.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.JsonWebTokens, Version=6.24.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.JsonWebTokens.6.24.0\lib\net472\Microsoft.IdentityModel.JsonWebTokens.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Logging, Version=6.24.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Logging.6.24.0\lib\net472\Microsoft.IdentityModel.Logging.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Protocols, Version=6.24.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Protocols.6.24.0\lib\net472\Microsoft.IdentityModel.Protocols.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect, Version=6.24.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Protocols.OpenIdConnect.6.24.0\lib\net472\Microsoft.IdentityModel.Protocols.OpenIdConnect.dll</HintPath>
</Reference>
<Reference Include="Microsoft.IdentityModel.Tokens, Version=6.24.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.IdentityModel.Tokens.6.24.0\lib\net472\Microsoft.IdentityModel.Tokens.dll</HintPath>
</Reference>
<Reference Include="MySqlConnector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=d33d3e53aa5f8c92, processorArchitecture=MSIL">
<HintPath>..\packages\MySqlConnector.2.2.7\lib\net471\MySqlConnector.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.ConfigurationManager, Version=6.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Configuration.ConfigurationManager.6.0.1\lib\net461\System.Configuration.ConfigurationManager.dll</HintPath>
</Reference>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Data.OracleClient" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.6.0.0\lib\net461\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Drawing" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.IdentityModel.Tokens.Jwt, Version=6.24.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\System.IdentityModel.Tokens.Jwt.6.24.0\lib\net472\System.IdentityModel.Tokens.Jwt.dll</HintPath>
</Reference>
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Memory.Data, Version=1.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.Data.1.0.2\lib\net461\System.Memory.Data.dll</HintPath>
</Reference>
<Reference Include="System.Net" />
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http.Extensions, Version=2.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting, Version=5.2.9.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.9\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Json, Version=7.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.Json.7.0.1\lib\net462\System.Net.Http.Json.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives, Version=4.2.29.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.WebRequest" />
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security" />
<Reference Include="System.Security.AccessControl, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.AccessControl.6.0.0\lib\net461\System.Security.AccessControl.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.ProtectedData, Version=4.0.5.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.ProtectedData.4.7.0\lib\net461\System.Security.Cryptography.ProtectedData.dll</HintPath>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Permissions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Permissions.6.0.0\lib\net461\System.Security.Permissions.dll</HintPath>
</Reference>
<Reference Include="System.Security.Principal.Windows, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Principal.Windows.5.0.0\lib\net461\System.Security.Principal.Windows.dll</HintPath>
</Reference>
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Text.Encodings.Web, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.7.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=7.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.7.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml"> <Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework> <RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference> </Reference>
@ -55,7 +210,20 @@
<Generator>MSBuild:Compile</Generator> <Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType> <SubType>Designer</SubType>
</ApplicationDefinition> </ApplicationDefinition>
<Compile Include="Source\APIConfig.cs" /> <Compile Include="Source\API\APIConfig.cs" />
<Compile Include="Source\API\APIConnection.cs" />
<Compile Include="Source\API\APIRequestBuilder.cs" />
<Compile Include="Source\Database\DatabaseConfig.cs" />
<Compile Include="Source\Database\DatabaseConnection.cs" />
<Compile Include="Source\DataObjects\APICredentials.cs" />
<Compile Include="Source\DataObjects\ComboBoxData.cs" />
<Compile Include="Source\DataObjects\Exceptions.cs" />
<Compile Include="Source\DataObjects\NumValList.cs" />
<Compile Include="Source\DataObjects\NumValPair.cs" />
<Compile Include="Source\DataObjects\ReferFromBox.cs" />
<Compile Include="Source\DataObjects\Referral.cs" />
<Compile Include="Source\DataObjects\ReferralTypeBox.cs" />
<Compile Include="Source\DataObjects\ReferToBox.cs" />
<Compile Include="Source\Patient.cs" /> <Compile Include="Source\Patient.cs" />
<Compile Include="Source\PatientGUIAdapter.cs" /> <Compile Include="Source\PatientGUIAdapter.cs" />
<Page Include="MainWindow.xaml"> <Page Include="MainWindow.xaml">
@ -89,6 +257,7 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings"> <None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator> <Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput> <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@ -101,7 +270,16 @@
<Resource Include="Config\Config.xml" /> <Resource Include="Config\Config.xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Folder Include="Source\API\" /> <Folder Include="Source\GUIData\" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets" Condition="Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Bcl.Build.1.0.21\build\Microsoft.Bcl.Build.targets'))" />
<Error Condition="!Exists('..\packages\Microsoft.Data.SqlClient.SNI.5.1.0\build\net462\Microsoft.Data.SqlClient.SNI.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Data.SqlClient.SNI.5.1.0\build\net462\Microsoft.Data.SqlClient.SNI.targets'))" />
</Target>
<Import Project="..\packages\Microsoft.Data.SqlClient.SNI.5.1.0\build\net462\Microsoft.Data.SqlClient.SNI.targets" Condition="Exists('..\packages\Microsoft.Data.SqlClient.SNI.5.1.0\build\net462\Microsoft.Data.SqlClient.SNI.targets')" />
</Project> </Project>

View File

@ -0,0 +1,128 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Http;
using System.Net.Http.Headers;
using System.IO;
using Newtonsoft.Json;
namespace PWAPPv2.Source.API
{
class APIConnection
{
private static string BaseURL;
public DataObjects.APICredentials Credentials;
private static bool ResponseReady = false;
private static string Response = "";
public APIConnection(string baseUrl, DataObjects.APICredentials credentials)
{
Credentials = credentials;
BaseURL = baseUrl;
}
public string GetResponse()
{
while (!ResponseReady) ;
return Response;
}
public static async void APIGet(string Call)
{
//WebRequest request = WebRequest.Create(BaseURL + Call);
//request.Method = "GET";
//request.ContentType = "application/json; charset=utf-8";
//var response = (HttpWebResponse)request.GetResponse();
//string text;
//using (var sr = new StreamReader(response.GetResponseStream()))
//{
// text = sr.ReadToEnd();
//}
//return text;
using (var client = new HttpClient())
{
client.BaseAddress = new Uri(BaseURL);
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
HttpResponseMessage response = await client.GetAsync(Call);
}
}
public string APIPost()
{
string text;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://apipatientweb.azurewebsites.net/api/PWReferralTypes");
request.Method = "POST";
request.ContentType = "application/json; charset=\"utf-8\"";
request.Accept = "application/json";
string postData = Source.API.APIRequestBuilder.BuildJsonBodyRequest(Credentials);
ASCIIEncoding encoding = new ASCIIEncoding();
byte[] data = encoding.GetBytes(postData);
request.ContentLength = data.Length;
Stream newStream = request.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
var response = (HttpWebResponse)request.GetResponse();
using (var sr = new StreamReader(response.GetResponseStream()))
{
text = sr.ReadToEnd();
}
}
catch(WebException wex)
{
text = new StreamReader(wex.Response.GetResponseStream()).ReadToEnd();
}
return text;
}
public string SendPostRequestAsync(string apiUri)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(BaseURL);
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
StringContent contetnt = new StringContent(Credentials.ToJsonString(), Encoding.UTF8, "application/json");
var response = client.PostAsync(apiUri, contetnt).Result;
if(response.IsSuccessStatusCode)
{
return response.Content.ReadAsStringAsync().Result;
}
return "";
}
public string SendPostRequestAsync(string apiUri, string PostData)
{
HttpClient client = new HttpClient();
client.BaseAddress = new Uri(BaseURL);
client.DefaultRequestHeaders.Accept.Add(
new MediaTypeWithQualityHeaderValue("application/json"));
StringContent contetnt = new StringContent(PostData, Encoding.UTF8, "application/json");
var response = client.PostAsync(apiUri, contetnt).Result;
if (response.IsSuccessStatusCode)
{
return response.Content.ReadAsStringAsync().Result;
}
return "";
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Serialization;
using Newtonsoft.Json;
namespace PWAPPv2.Source.API
{
class APIRequestBuilder
{
public static string BuildJsonBodyRequest(Object src)
{
return JsonConvert.SerializeObject(src);
}
}
}

View File

@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PWAPPv2.Source.DataObjects
{
class APICredentials
{
public string UserID;
public string Password;
public string PracticeId;
public string APIid;
public APICredentials(Source.APIConfig config)
{
UserID = config.PWUserID;
Password = config.PWPassword;
PracticeId = config.PWPracticeID;
APIid = config.PWApiID;
}
public string BuildJsonBodyContents()
{
return "'UserID':'" + UserID + "'," +
"'Password':'" + Password + "'," +
"'PracticeId':'" + PracticeId + "'," +
"'APIid':'" + APIid + "'";
}
public string ToJsonString()
{
return "\"{" + BuildJsonBodyContents() + "}\"";
}
}
}

View File

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
{
abstract class ComboBoxData
{
protected ComboBox Box;
public ComboBoxData(ComboBox box)
{
Box = box;
}
public void Add(string content)
{
Box.Items.Add(content);
}
public string GetSelectedData()
{
return Box.SelectedItem.ToString();
}
public abstract void Update();
public abstract int GetSelectedIndex(string content);
public abstract int GetSelectedID();
}
}

View File

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PWAPPv2.Source.DataObjects
{
class Exceptions
{
}
class DataInvalidException : Exception
{
}
}

View File

@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PWAPPv2.Source.DataObjects
{
class NumValList
{
private List<NumValPair> Pairs;
public NumValList()
{
}
public NumValList(string Content, char Delim)
{
string[] split = Content.Split(Delim);
if((split.Length % 2) != 0)
{
throw new UnevenValuesException();
}
for(int i = 0; i < split.Length; i++)
{
this.Add(int.Parse(split[i]), split[i + 1]);
i++;
}
}
public void Add(int Num, string Val)
{
Pairs.Add(new NumValPair(Num, Val));
}
public string GetValFromNum(int Num)
{
for (int i = 0; i < Pairs.Count; i++)
{
if (Pairs[i].Num == Num)
{
return Pairs[i].Value;
}
}
throw new NotFoundException();
}
public int GetNumFromVal(string Val)
{
for (int i = 0; i < Pairs.Count; i++)
{
if (Pairs[i].Value == Val)
{
return Pairs[i].Num;
}
}
throw new NotFoundException();
}
}
class NotFoundException : Exception
{
}
class UnevenValuesException : Exception
{
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PWAPPv2.Source.DataObjects
{
class NumValPair
{
public int Num;
public string Value;
public NumValPair(int N, string Val)
{
Num = N;
Value = Val;
}
}
}

View File

@ -0,0 +1,83 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
{
class ReferFromBox : ComboBoxData
{
List<string> DoctorName;
List<int> DoctorID;
public ReferFromBox(ComboBox box, string data) : base(box)
{
this.Add("Choose Refer From");
DoctorName = new List<string>();
DoctorID = new List<int>();
data = data.Replace("\\n", "");
data = data.Replace("\"", "");
string[] split = data.Split('|');
for (int i = 0; i < split.Length; i = i + 2)
{
try
{
int id = int.Parse(split[i]);
DoctorID.Add(id);
}
catch (Exception)
{
throw new DataInvalidException();
}
DoctorName.Add(split[i + 1]);
}
foreach (string name in DoctorName)
{
Add(name);
}
Box.SelectedItem = "Choose Refer From";
}
public override int GetSelectedID()
{
string Selected = GetSelectedData();
if (Selected == "Choose Refer From")
{
throw new ReferFromDefaultException();
}
for (int i = 0; i < DoctorName.Count; i++)
{
if (DoctorName[i] == Selected)
{
return DoctorID[i];
}
}
throw new InvalidReferralTypeException();
}
public override void Update()
{
throw new NotImplementedException();
}
public override int GetSelectedIndex(string content)
{
throw new NotImplementedException();
}
}
public class ReferFromDefaultException : Exception
{ }
public class InvalidDoctorException : Exception
{
}
}

View File

@ -0,0 +1,102 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
{
class ReferToBox : ComboBoxData
{
List<int> PractieID;
List<string> ToName;
List<int> DoctorID;
public ReferToBox(ComboBox box, string data) : base(box)
{
this.Add("Choose Refer To");
ToName = new List<string>();
DoctorID = new List<int>();
PractieID = new List<int>();
data = data.Replace("\\n", "");
data = data.Replace("\"", "");
string[] split = data.Split('|');
for (int i = 0; i < split.Length; i = i + 3)
{
try
{
PractieID.Add(int.Parse(split[i]));
ToName.Add(split[i + 1]);
DoctorID.Add(int.Parse(split[i + 2]));
}
catch (Exception)
{
throw new DataInvalidException();
}
}
foreach (string name in ToName)
{
this.Add(name);
}
Box.SelectedItem = "Choose Refer To";
}
public override void Update()
{
throw new NotImplementedException();
}
public override int GetSelectedID()
{
throw new NotImplementedException();
}
public int GetSelectedPracticeID()
{
string selected = GetSelectedData();
if (selected == "Choose Refer To")
{
throw new ReferToDefaultException();
}
for (int i = 0; i < ToName.Count; i++)
{
if (ToName[i] == selected)
{
return PractieID[i];
}
}
throw new InvalidReferToException();
}
public int GetSelectedDoctorID()
{
string selected = GetSelectedData();
if (selected == "Choose Refer To")
{
throw new ReferToDefaultException();
}
for (int i = 0; i < ToName.Count; i++)
{
if (ToName[i] == selected)
{
return DoctorID[i];
}
}
throw new InvalidReferToException();
}
public override int GetSelectedIndex(string content)
{
throw new NotImplementedException();
}
}
public class ReferToDefaultException : Exception
{ }
public class InvalidReferToException : Exception
{ }
}

View File

@ -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
{
}
}
}

View File

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
namespace PWAPPv2.Source.DataObjects
{
class ReferralTypeBox : ComboBoxData
{
List<string> TypeName;
List<int> TypeID;
public ReferralTypeBox(ComboBox box, string data) : base(box)
{
this.Add("Choose Referral Type");
TypeName = new List<string>();
TypeID = new List<int>();
data = data.Replace("\\n", "");
data = data.Replace("\"", "");
string[] split = data.Split('|');
for (int i = 0; i < split.Length; i = i + 2)
{
try
{
int id = int.Parse(split[i]);
TypeID.Add(id);
}
catch(Exception)
{
throw new DataInvalidException();
}
TypeName.Add(split[i + 1]);
}
foreach(string name in TypeName)
{
Add(name);
}
Box.SelectedItem = "Choose Referral Type";
}
public override int GetSelectedID()
{
string Selected = GetSelectedData();
if (Selected == "Choose Referral Type")
{
throw new ReferralTypeDefaultException();
}
for(int i = 0; i < TypeName.Count; i++)
{
if(TypeName[i] == Selected)
{
return TypeID[i];
}
}
throw new InvalidReferralTypeException();
}
public override void Update()
{
throw new NotImplementedException();
}
public override int GetSelectedIndex(string content)
{
throw new NotImplementedException();
}
}
public class InvalidReferralTypeException : Exception
{
}
public class ReferralTypeDefaultException : Exception
{ }
}

View File

@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
namespace PWAPPv2.Source.Database
{
class DatabaseConfig
{
public string host;
public string user;
public string password;
public string database;
public DatabaseConfig(string path)
{
XmlDocument cfg = new XmlDocument();
try
{
cfg.Load(path);
}
catch(XmlException)
{
Console.WriteLine("An error has occured parsing the config file.");
return;
}
catch(System.IO.FileNotFoundException)
{
Console.WriteLine("Config file could not be found!");
}
XmlNodeList XHost = cfg.GetElementsByTagName("ODhost");
XmlNodeList XUser = cfg.GetElementsByTagName("ODuser");
XmlNodeList XPassword = cfg.GetElementsByTagName("ODpassword");
XmlNodeList XDatabase = cfg.GetElementsByTagName("ODdatabase");
host = XHost[0].InnerText;
user = XUser[0].InnerText;
password = XPassword[0].InnerText;
database = XDatabase[0].InnerText;
}
}
}

View File

@ -0,0 +1,115 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Data.SqlClient;
using MySqlConnector;
namespace PWAPPv2.Source.Database
{
class DatabaseConnection
{
private MySqlConnection Connection;
private string SqlString;
DatabaseConfig Config;
public DatabaseConnection(DatabaseConfig config)
{
Config = config;
SqlString = "server=" + config.host + ";Uid=" + config.user + ";database=" + config.database + ";Pwd=" + config.password;
Connection = new MySqlConnection(SqlString);
}
public void Connect()
{
try
{
Connection.Open();
}
catch(Exception)
{
throw new DatabaseConnectionException();
}
}
public List<string> QueryDatabase(string query)
{
try
{
Connection.Open();
}
catch (Exception)
{
throw new CouldNotOpenConnectionException();
}
MySqlCommand Command = new MySqlCommand(query, Connection);
MySqlDataReader reader;
try
{
reader = Command.ExecuteReader();
}
catch (Exception)
{
Connection.Close();
throw new ReaderException();
}
List<string> result = new List<string>();
while (reader.Read())
{
int n = reader.VisibleFieldCount;
for (int i = 0; i < reader.VisibleFieldCount; i++)
{
var type = reader.GetFieldType(i);
if (type.Name == "Int64")
{
result.Add(reader.GetInt64(i).ToString());
}
if (type.Name == "Int32")
{
result.Add(reader.GetInt32(i).ToString());
}
if (type.Name == "String")
{
result.Add(reader.GetString(i));
}
if (type.Name == "Byte")
{
result.Add(reader.GetByte(i).ToString());
}
if (type.Name == "DateTime")
{
result.Add(reader.GetDateTime(i).ToString());
}
}
}
Connection.Close();
return result;
}
}
class DatabaseConfigurationException : Exception
{
}
class DatabaseConnectionException : Exception
{ }
class CouldNotOpenConnectionException : Exception
{
}
class ReaderException : Exception
{
}
}

View File

@ -8,13 +8,48 @@ namespace PWAPPv2.Source
{ {
class Patient class Patient
{ {
public string PatNum;
public string FName; public string FName;
public string MName; public string MName;
public string LName; public string LName;
public string Gender;
public string DoB; public string DoB;
public string SSN;
public string Address; public string Address;
public string Address2;
public string City; public string City;
public string State; public string State;
public string Zip; public string Zip;
public string HomePhone;
public string WorkPhone;
public string WirelessPhone;
public string Email;
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];
}
} }
} }

View File

@ -17,6 +17,10 @@ namespace PWAPPv2.Source
public string txtCity { get { return p.City; } } public string txtCity { get { return p.City; } }
public string txtState { get { return p.State; } } public string txtState { get { return p.State; } }
public string txtZip { get { return p.Zip; } } 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) public PatientGUIAdapter(Patient patient)
{ {

48
PWAPPv2/packages.config Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Azure.Core" version="1.25.0" targetFramework="net472" />
<package id="Azure.Identity" version="1.7.0" targetFramework="net472" />
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.9" targetFramework="net472" />
<package id="Microsoft.Bcl" version="1.1.10" targetFramework="net472" />
<package id="Microsoft.Bcl.AsyncInterfaces" version="7.0.0" targetFramework="net472" />
<package id="Microsoft.Bcl.Build" version="1.0.21" targetFramework="net472" />
<package id="Microsoft.Data.SqlClient" version="5.1.1" targetFramework="net472" />
<package id="Microsoft.Data.SqlClient.SNI" version="5.1.0" targetFramework="net472" />
<package id="Microsoft.Identity.Client" version="4.47.2" targetFramework="net472" />
<package id="Microsoft.Identity.Client.Extensions.Msal" version="2.19.3" targetFramework="net472" />
<package id="Microsoft.IdentityModel.Abstractions" version="6.24.0" targetFramework="net472" />
<package id="Microsoft.IdentityModel.JsonWebTokens" version="6.24.0" targetFramework="net472" />
<package id="Microsoft.IdentityModel.Logging" version="6.24.0" targetFramework="net472" />
<package id="Microsoft.IdentityModel.Protocols" version="6.24.0" targetFramework="net472" />
<package id="Microsoft.IdentityModel.Protocols.OpenIdConnect" version="6.24.0" targetFramework="net472" />
<package id="Microsoft.IdentityModel.Tokens" version="6.24.0" targetFramework="net472" />
<package id="Microsoft.Net.Http" version="2.2.29" targetFramework="net472" />
<package id="MySqlConnector" version="2.2.7" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Configuration.ConfigurationManager" version="6.0.1" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="6.0.0" targetFramework="net472" />
<package id="System.IdentityModel.Tokens.Jwt" version="6.24.0" targetFramework="net472" />
<package id="System.IO" version="4.3.0" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Memory.Data" version="1.0.2" targetFramework="net472" />
<package id="System.Net.Http" version="4.3.4" targetFramework="net472" />
<package id="System.Net.Http.Json" version="7.0.1" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime" version="4.3.1" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="System.Security.AccessControl" version="6.0.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net472" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.ProtectedData" version="4.7.0" targetFramework="net472" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net472" />
<package id="System.Security.Permissions" version="6.0.0" targetFramework="net472" />
<package id="System.Security.Principal.Windows" version="5.0.0" targetFramework="net472" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="7.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="7.0.3" targetFramework="net472" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
</packages>