public static ReferralRepository GetInstance() { if (instance == null) { instance = new ReferralRepository(); } return(instance); }
public Examination Read(uint id) { List <string[]> data = Persistence.ReadEntryByPrimaryKey(path, id.ToString()); if (data.Count == 1) { uint exID = uint.Parse(data[0][0]); long ticks = long.Parse(data[0][1]); DateTime date = new DateTime(ticks); uint docID = uint.Parse(data[0][2]); Doctor d = (Doctor)PeopleRepository.GetInstance().Read(docID); string diagnosis = data[0][3]; List <Prescription> presList = new List <Prescription>(); string[] presIDs = data[0][4].Split(' '); foreach (string presID in presIDs) { if (presID.Equals("")) { break; } Prescription p = PrescriptionRepository.GetInstance().Read(uint.Parse(presID)); presList.Add(p); } List <Referral> refList = new List <Referral>(); string[] refIDs = data[0][5].Split(' '); foreach (string refID in refIDs) { if (refID.Equals("")) { break; } Referral r = ReferralRepository.GetInstance().Read(uint.Parse(refID)); refList.Add(r); } Examination ret = new Examination(date, diagnosis, d, presList, refList); ret.SetId(exID); return(ret); } return(null); }