Ejemplo n.º 1
0
        public MedicalRecord Read(uint id)
        {
            List <string[]> data = Persistence.ReadEntryByPrimaryKey(path, id.ToString());

            if (data.Count == 1)
            {
                uint            mrID        = uint.Parse(data[0][0]);
                uint            patID       = uint.Parse(data[0][1]);
                string          insuranceID = data[0][2];
                InsurancePolicy policy      = InsurancePolicyRepository.GetInstance().Read(insuranceID);
                if (policy != null)
                {
                    Patient            patient = (Patient)PeopleRepository.GetInstance().Read(patID);
                    List <Examination> exams   = new List <Examination>();


                    string[] examIDs = data[0][3].Split(' ');
                    foreach (string exID in examIDs)
                    {
                        if (exID.Equals(""))
                        {
                            break;
                        }
                        Examination e = ExaminationRepository.GetInstance().Read(uint.Parse(exID));
                        exams.Add(e);
                    }

                    MedicalRecord ret = new MedicalRecord(policy, exams, patient);
                    ret.SetId(mrID);
                    return(ret);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
 public static InsurancePolicyRepository GetInstance()
 {
     if (instance == null)
     {
         instance = new InsurancePolicyRepository();
     }
     return(instance);
 }