Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4a4bcc81e0 | ||
|
|
19153c9d02 |
@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.33529.622
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PWAPPv2", "PWAPPv2\PWAPPv2.csproj", "{45E26AF8-41D7-4308-A2C8-D55A0350DB47}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnitTests", "UnitTests\UnitTests.csproj", "{164B9220-F337-4E88-B619-0C52C502B9C4}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -15,6 +17,10 @@ Global
|
||||
{45E26AF8-41D7-4308-A2C8-D55A0350DB47}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{45E26AF8-41D7-4308-A2C8-D55A0350DB47}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{45E26AF8-41D7-4308-A2C8-D55A0350DB47}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{164B9220-F337-4E88-B619-0C52C502B9C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{164B9220-F337-4E88-B619-0C52C502B9C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{164B9220-F337-4E88-B619-0C52C502B9C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{164B9220-F337-4E88-B619-0C52C502B9C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
|
||||
namespace PWAPPv2
|
||||
{
|
||||
@@ -16,7 +10,7 @@ namespace PWAPPv2
|
||||
public static string[] Args;
|
||||
void app_Startup(object sender, StartupEventArgs e)
|
||||
{
|
||||
if(e.Args.Length > 0)
|
||||
if (e.Args.Length > 0)
|
||||
{
|
||||
Args = e.Args;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<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"/>
|
||||
</GroupBox>
|
||||
<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"/>
|
||||
<CheckBox x:Name="contact" Content="Contact Patient" 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="150" Margin="10,347,0,0" VerticalAlignment="Top" Width="309">
|
||||
<RichTextBox x:Name="fieldRemakrs" HorizontalAlignment="Left" Height="127" VerticalAlignment="Top" Width="299" Margin="0,0,-2,0">
|
||||
<FlowDocument>
|
||||
|
||||
@@ -1,19 +1,9 @@
|
||||
using System;
|
||||
using Microsoft.Win32;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.IO;
|
||||
using Microsoft.Win32;
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
@@ -43,36 +33,47 @@ namespace PWAPPv2
|
||||
|
||||
List<Source.DataObjects.PWImage> images;
|
||||
|
||||
string ConfigPath = "C:\\PWAPP\\Config\\Config.xml";
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
try
|
||||
{
|
||||
args = App.Args;
|
||||
}
|
||||
catch(Exception)
|
||||
catch (Exception)
|
||||
{ }
|
||||
try
|
||||
{
|
||||
images = new List<Source.DataObjects.PWImage>();
|
||||
|
||||
images = new List<Source.DataObjects.PWImage>();
|
||||
apiconfig.LoadConfig(ConfigPath);
|
||||
DataConfig = new Source.Database.DatabaseConfig(ConfigPath);
|
||||
Source.Database.DatabaseConnection dbcon = new Source.Database.DatabaseConnection(DataConfig);
|
||||
|
||||
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);
|
||||
|
||||
apiCreds = new Source.DataObjects.APICredentials(apiconfig);
|
||||
apiConnection = new Source.API.APIConnection("http://apipatientweb.azurewebsites.net/",
|
||||
apiCreds);
|
||||
|
||||
apiConnection = new Source.API.APIConnection("http://apipatientweb.azurewebsites.net/",
|
||||
apiCreds);
|
||||
InitializeComponent();
|
||||
|
||||
InitializeComponent();
|
||||
PopulateComboBoxes();
|
||||
|
||||
PopulateComboBoxes();
|
||||
patient = new Source.Patient();
|
||||
|
||||
patient = new Source.Patient();
|
||||
patient.BuildFromDatabase(dbcon, args[0]);
|
||||
|
||||
patient.BuildFromDatabase(dbcon, args[0]);
|
||||
|
||||
this.DataContext = new Source.PatientGUIAdapter(patient);
|
||||
this.DataContext = new Source.PatientGUIAdapter(patient);
|
||||
}
|
||||
catch(NullReferenceException)
|
||||
{
|
||||
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
MessageBox.Show(e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateComboBoxes()
|
||||
@@ -122,15 +123,15 @@ namespace PWAPPv2
|
||||
{
|
||||
TypeBox.GetSelectedID();
|
||||
}
|
||||
catch(Source.DataObjects.ReferralTypeDefaultException)
|
||||
catch (Source.DataObjects.ReferralTypeDefaultException)
|
||||
{
|
||||
|
||||
}
|
||||
catch(Source.DataObjects.InvalidReferralTypeException)
|
||||
catch (Source.DataObjects.InvalidReferralTypeException)
|
||||
{
|
||||
|
||||
}
|
||||
catch(NullReferenceException)
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -146,7 +147,7 @@ namespace PWAPPv2
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Source.DataObjects.Referral referral;
|
||||
if(images.Count == 0)
|
||||
if (images.Count == 0)
|
||||
{
|
||||
referral = new Source.DataObjects.Referral(apiCreds, patient,
|
||||
(Source.DataObjects.ReferralTypeBox)TypeBox,
|
||||
@@ -167,9 +168,9 @@ namespace PWAPPv2
|
||||
{
|
||||
string referralString = referral.ToJsonString();
|
||||
string result = apiConnection.SendPostRequestAsync("api/PWMakeReferral", referralString);
|
||||
if(images.Count > 0)
|
||||
if (images.Count > 0)
|
||||
{
|
||||
foreach(Source.DataObjects.PWImage im in images)
|
||||
foreach (Source.DataObjects.PWImage im in images)
|
||||
{
|
||||
Source.DataObjects.Attachment att = new Source.DataObjects.Attachment(apiCreds, im, result);
|
||||
string json = att.ToJsonString();
|
||||
@@ -183,7 +184,7 @@ namespace PWAPPv2
|
||||
}
|
||||
this.Close();
|
||||
}
|
||||
catch(Source.DataObjects.Referral.InvalidReferalDataException)
|
||||
catch (Source.DataObjects.Referral.InvalidReferalDataException)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -197,7 +198,7 @@ namespace PWAPPv2
|
||||
openFileDialog.Filter = "Image files (*.jpg,*.jpeg)|*.jpg;*.jpeg";
|
||||
openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
|
||||
|
||||
if(openFileDialog.ShowDialog() == true)
|
||||
if (openFileDialog.ShowDialog() == true)
|
||||
{
|
||||
foreach (string filename in openFileDialog.FileNames)
|
||||
{
|
||||
@@ -205,7 +206,7 @@ namespace PWAPPv2
|
||||
{
|
||||
images.Add(new Source.DataObjects.PWImage(filename));
|
||||
}
|
||||
catch(NullReferenceException)
|
||||
catch (NullReferenceException)
|
||||
{
|
||||
images = new List<Source.DataObjects.PWImage>();
|
||||
images.Add(new Source.DataObjects.PWImage(filename));
|
||||
@@ -222,7 +223,7 @@ namespace PWAPPv2
|
||||
ImageList.Items.Add(CreateImageGridItem(image));
|
||||
}
|
||||
}
|
||||
catch(NullReferenceException)
|
||||
catch (NullReferenceException)
|
||||
{ }
|
||||
|
||||
}
|
||||
@@ -230,7 +231,7 @@ namespace PWAPPv2
|
||||
private void Button_Click_3(object sender, RoutedEventArgs e)
|
||||
{
|
||||
int index = ImageList.SelectedIndex;
|
||||
if(index == -1)
|
||||
if (index == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -254,7 +255,6 @@ namespace PWAPPv2
|
||||
imageGrid.HorizontalAlignment = HorizontalAlignment.Left;
|
||||
imageGrid.VerticalAlignment = VerticalAlignment.Top;
|
||||
imageGrid.ShowGridLines = true;
|
||||
imageGrid.Background = new SolidColorBrush(Colors.LightSteelBlue);
|
||||
|
||||
ColumnDefinition imageColumn = new ColumnDefinition();
|
||||
imageColumn.Width = new GridLength(50);
|
||||
|
||||
@@ -210,7 +210,6 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="PwImage.cs" />
|
||||
<Compile Include="Source\API\APIConfig.cs" />
|
||||
<Compile Include="Source\API\APIConnection.cs" />
|
||||
<Compile Include="Source\API\APIRequestBuilder.cs" />
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
namespace PWAPPv2
|
||||
{
|
||||
internal class PwImage
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace PWAPPv2.Source
|
||||
{
|
||||
class APIConfig
|
||||
public class APIConfig
|
||||
{
|
||||
public string PWUserID;
|
||||
public string PWPassword;
|
||||
@@ -21,12 +17,12 @@ namespace PWAPPv2.Source
|
||||
{
|
||||
cfgDoc.Load(path);
|
||||
}
|
||||
catch(XmlException)
|
||||
catch (XmlException)
|
||||
{
|
||||
Console.WriteLine("An error has occured parsing the config file.");
|
||||
return;
|
||||
}
|
||||
catch(System.IO.FileNotFoundException)
|
||||
catch (System.IO.FileNotFoundException)
|
||||
{
|
||||
Console.WriteLine("Config file could not be found!");
|
||||
return;
|
||||
|
||||
@@ -1,17 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using System.Text;
|
||||
|
||||
namespace PWAPPv2.Source.API
|
||||
{
|
||||
class APIConnection
|
||||
public class APIConnection
|
||||
{
|
||||
private static string BaseURL;
|
||||
|
||||
@@ -56,39 +52,6 @@ namespace PWAPPv2.Source.API
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
@@ -100,7 +63,7 @@ namespace PWAPPv2.Source.API
|
||||
|
||||
var response = client.PostAsync(apiUri, contetnt).Result;
|
||||
|
||||
if(response.IsSuccessStatusCode)
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
return response.Content.ReadAsStringAsync().Result;
|
||||
}
|
||||
|
||||
@@ -1,11 +1,5 @@
|
||||
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;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
namespace PWAPPv2.Source.API
|
||||
{
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
class APICredentials
|
||||
public class APICredentials
|
||||
{
|
||||
public string UserID;
|
||||
public string Password;
|
||||
public string PracticeId;
|
||||
public string APIid;
|
||||
|
||||
public APICredentials()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public APICredentials(Source.APIConfig config)
|
||||
{
|
||||
UserID = config.PWUserID;
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
class Attachment
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
@@ -18,11 +15,11 @@ namespace PWAPPv2.Source.DataObjects
|
||||
public NumValList(string Content, char Delim)
|
||||
{
|
||||
string[] split = Content.Split(Delim);
|
||||
if((split.Length % 2) != 0)
|
||||
if ((split.Length % 2) != 0)
|
||||
{
|
||||
throw new UnevenValuesException();
|
||||
}
|
||||
for(int i = 0; i < split.Length; i++)
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
this.Add(int.Parse(split[i]), split[i + 1]);
|
||||
i++;
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
class NumValPair
|
||||
{
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Media.Imaging;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
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
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
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
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows;
|
||||
|
||||
namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
@@ -40,7 +36,7 @@ namespace PWAPPv2.Source.DataObjects
|
||||
string RemarksText = new TextRange(RemarksBox.Document.ContentStart, RemarksBox.Document.ContentEnd).Text;
|
||||
|
||||
int contact = 0;
|
||||
if(ContactBox.IsChecked == true)
|
||||
if (ContactBox.IsChecked == true)
|
||||
{
|
||||
contact = 1;
|
||||
}
|
||||
@@ -76,11 +72,11 @@ namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
MessageBox.Show("Please select a referral type");
|
||||
}
|
||||
catch(Source.DataObjects.ReferToDefaultException)
|
||||
catch (Source.DataObjects.ReferToDefaultException)
|
||||
{
|
||||
MessageBox.Show("Please select a refer to");
|
||||
}
|
||||
catch(Source.DataObjects.ReferFromDefaultException)
|
||||
catch (Source.DataObjects.ReferFromDefaultException)
|
||||
{
|
||||
MessageBox.Show("Please select a refer from");
|
||||
}
|
||||
|
||||
@@ -1,9 +1,5 @@
|
||||
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
|
||||
@@ -28,7 +24,7 @@ namespace PWAPPv2.Source.DataObjects
|
||||
TypeID.Add(id);
|
||||
|
||||
}
|
||||
catch(Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
throw new DataInvalidException();
|
||||
}
|
||||
@@ -36,7 +32,7 @@ namespace PWAPPv2.Source.DataObjects
|
||||
|
||||
}
|
||||
|
||||
foreach(string name in TypeName)
|
||||
foreach (string name in TypeName)
|
||||
{
|
||||
Add(name);
|
||||
}
|
||||
@@ -52,9 +48,9 @@ namespace PWAPPv2.Source.DataObjects
|
||||
{
|
||||
throw new ReferralTypeDefaultException();
|
||||
}
|
||||
for(int i = 0; i < TypeName.Count; i++)
|
||||
for (int i = 0; i < TypeName.Count; i++)
|
||||
{
|
||||
if(TypeName[i] == Selected)
|
||||
if (TypeName[i] == Selected)
|
||||
{
|
||||
return TypeID[i];
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace PWAPPv2.Source.Database
|
||||
@@ -22,12 +18,12 @@ namespace PWAPPv2.Source.Database
|
||||
{
|
||||
cfg.Load(path);
|
||||
}
|
||||
catch(XmlException)
|
||||
catch (XmlException)
|
||||
{
|
||||
Console.WriteLine("An error has occured parsing the config file.");
|
||||
return;
|
||||
}
|
||||
catch(System.IO.FileNotFoundException)
|
||||
catch (System.IO.FileNotFoundException)
|
||||
{
|
||||
Console.WriteLine("Config file could not be found!");
|
||||
}
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using MySqlConnector;
|
||||
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
|
||||
{
|
||||
@@ -28,7 +24,7 @@ namespace PWAPPv2.Source.Database
|
||||
{
|
||||
Connection.Open();
|
||||
}
|
||||
catch(Exception)
|
||||
catch (Exception)
|
||||
{
|
||||
throw new DatabaseConnectionException();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace PWAPPv2.Source
|
||||
{
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace PWAPPv2.Source
|
||||
namespace PWAPPv2.Source
|
||||
{
|
||||
class PatientGUIAdapter
|
||||
{
|
||||
|
||||
20
UnitTests/Properties/AssemblyInfo.cs
Normal file
20
UnitTests/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("UnitTests")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("UnitTests")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2023")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("164b9220-f337-4e88-b619-0c52c502b9c4")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
29
UnitTests/UnitTest1.cs
Normal file
29
UnitTests/UnitTest1.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using PWAPPv2.Source.API;
|
||||
using PWAPPv2.Source.DataObjects;
|
||||
|
||||
// System.Threading.Tasks.Task<TResult>.Result.get returned "\"1|Endo|2|Implant|3|Oral Surgery|4|Ortho|5|Pedo|6|Perio|7|Restore|8|Other \\n\"" string
|
||||
|
||||
namespace UnitTests
|
||||
{
|
||||
[TestClass]
|
||||
public class UnitTest1
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestV1Get()
|
||||
{
|
||||
APICredentials creds = new APICredentials();
|
||||
creds.UserID = "testdoctor";
|
||||
creds.Password = "testdoctor";
|
||||
creds.PracticeId = "210";
|
||||
creds.APIid = "12345678";
|
||||
|
||||
APIConnection conn = new APIConnection("http://apipatientweb.azurewebsites.net/", creds);
|
||||
|
||||
string res = conn.SendPostRequestAsync("api/PWReferralTypes");
|
||||
Assert.AreEqual("\"1|Endo|2|Implant|3|Oral Surgery|4|Ortho|5|Pedo|6|Perio|7|Restore|8|Other \\n\"", res);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
74
UnitTests/UnitTests.csproj
Normal file
74
UnitTests/UnitTests.csproj
Normal file
@@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{164B9220-F337-4E88-B619-0C52C502B9C4}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>UnitTests</RootNamespace>
|
||||
<AssemblyName>UnitTests</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MSTest.TestFramework.2.1.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="UnitTest1.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\PWAPPv2\PWAPPv2.csproj">
|
||||
<Project>{45e26af8-41d7-4308-a2c8-d55a0350db47}</Project>
|
||||
<Name>PWAPPv2</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.props'))" />
|
||||
<Error Condition="!Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.2.1.2\build\net45\MSTest.TestAdapter.targets')" />
|
||||
</Project>
|
||||
5
UnitTests/packages.config
Normal file
5
UnitTests/packages.config
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MSTest.TestAdapter" version="2.1.2" targetFramework="net472" />
|
||||
<package id="MSTest.TestFramework" version="2.1.2" targetFramework="net472" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user