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

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