Ejemplo n.º 1
0
        static Dictionary <string, List <MPatient> > BuildPatientDictionary(List <VMS.TPS.Common.Model.API.PatientSummary> pats, int months)
        {
            // For the test purpose we are interesting in patient records created during the last 12 months
            DateTime now = DateTime.Now;
            Dictionary <string, List <MPatient> > dictPatientByMonth = new Dictionary <string, List <MPatient> >();

            for (int i = 1; i <= months; i++)
            {
                dictPatientByMonth.Add(i.ToString(), new List <MPatient>());
            }
            foreach (VMS.TPS.Common.Model.API.PatientSummary pat in pats)
            {
                if (pat.CreationDateTime.HasValue)
                {
                    int monthspan = (now.Month - pat.CreationDateTime.Value.Month + 12 * (now.Year - pat.CreationDateTime.Value.Year));
                    if (monthspan < months)
                    {
                        monthspan++;
                        for (int j = monthspan; j <= 12; j++)
                        {
                            dictPatientByMonth[j.ToString()].Add(MPatient.CreatePatient(pat));
                        }
                    }
                }
            }
            return(dictPatientByMonth);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns true if the specified patient exists in the
        /// repository, or false if it is not.
        /// </summary>
        public bool ContainsPatient(MPatient pat)
        {
            if (pat == null)
            {
                throw new ArgumentNullException("pat");
            }

            return(_origpatients.Contains(pat));
        }
Ejemplo n.º 3
0
        public MPatientViewModel(MPatient pat, PatientRepository patientRepository)
        {
            if (pat == null)
            {
                throw new ArgumentNullException("pat");
            }

            if (patientRepository == null)
            {
                throw new ArgumentNullException("patientRepository");
            }

            _patient           = pat;
            _patientRepository = patientRepository;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Places the specified patient into the repository.
        /// If the patient is already in the repository, an
        /// exception is not thrown.
        /// </summary>
        public void AddSelectedPatient(int level, MPatient pat)
        {
            if (pat == null)
            {
                throw new ArgumentNullException("pat");
            }
            if (!_dictfilterpatients.ContainsKey(level))
            {
                _dictfilterpatients.Add(level, new List <MPatient>());
            }

            if (!_dictfilterpatients[level].Contains(pat))
            {
                _dictfilterpatients[level].Add(pat);

                if (this.SelectedPatientAdded != null && !SuspendEvent)
                {
                    this.SelectedPatientAdded(this, new PatientAddedEventArgs(pat, level));
                }
            }
        }
 public PatientAddedEventArgs(MPatient newPat, int level)
 {
     this.NewPatient = newPat;
     this.Level      = level;
 }