public UnansweredVaccinations GenerateNewUnansweredVaccinations()
        {
            this._unansweredVaccinations = new Dictionary <VaccinationDueDate, List <int> >();

            // Generate empyty lists of milestone IDs for holding unanswered milestones for a Child.
            foreach (VaccinationDueDate dueDate in Enum.GetValues(typeof(VaccinationDueDate)))
            {
                List <int> vaccinesByAge = new List <int>();
                _unansweredVaccinations[dueDate] = vaccinesByAge;
            }

            // Populate Dictionary of unansweredMilestones questions with milestones separated by AgeRange.
            VaccineDatabaseAccess vaccineDatabaseAccess = new VaccineDatabaseAccess();

            vaccineDatabaseAccess.InitializeSync();
            List <Vaccine> vaccines = vaccineDatabaseAccess.GetAllVaccinesSync();

            foreach (Vaccine vaccine in vaccines)
            {
                List <int> vaccinesByAge = _unansweredVaccinations[(VaccinationDueDate)vaccine.VaccineDueDate];
                vaccinesByAge.Add(vaccine.ID);
            }
            vaccineDatabaseAccess.CloseSyncConnection();
            return(this);
        }
        /**
         * Record the milestone BinaryAnswer for the given milestone ID and then remove it from the unanswered milestones list.
         */
        public void RemoveFromVaccinationHistory(int vaccineID)
        {
            VaccineDatabaseAccess vaccineDatabaseAccess = new VaccineDatabaseAccess();

            vaccineDatabaseAccess.InitializeSync();
            Vaccine vaccine = vaccineDatabaseAccess.GetVaccineSync(vaccineID);

            VaccinationHistory.RemoveFromVaccineHistory(vaccineID);
            Boolean vaccineAddedToUnanswered = UnansweredVaccinations.AddVaccination(vaccine);

            vaccineDatabaseAccess.CloseSyncConnection();
        }
        /**
         * Record the milestone BinaryAnswer for the given milestone ID and then remove it from the unanswered milestones list.
         */
        public void AddOrUpdateVaccinationHistory(int vaccineID)
        {
            VaccineDatabaseAccess vaccineDatabaseAccess = new VaccineDatabaseAccess();

            vaccineDatabaseAccess.InitializeSync();
            Vaccine vaccine = vaccineDatabaseAccess.GetVaccineSync(vaccineID);

            VaccinationHistory.UpdateOrInsertToVaccineHistory(vaccineID);
            Boolean vaccineRemovedFromUnanswered = UnansweredVaccinations.RemoveVaccination(vaccine);

            vaccineDatabaseAccess.CloseSyncConnection();
        }
        /**
         * Retrieve a list of Vaccine objects from storage corresponding to the input list of vaccine ids.
         **/
        private List <Vaccine> GetVaccinationsByIds(List <int> ids)
        {
            VaccineDatabaseAccess vaccineDatabaseAccess = new VaccineDatabaseAccess();

            vaccineDatabaseAccess.InitializeSync();
            List <Vaccine> vaccines = new List <Vaccine>();

            if (ids != null && ids.Count > 0)
            {
                foreach (int vaccineID in ids)
                {
                    vaccines.Add(vaccineDatabaseAccess.GetVaccineSync(vaccineID));
                }
            }
            vaccineDatabaseAccess.CloseSyncConnection();
            Vaccine.SortVaccineListByDueDate(vaccines);
            return(vaccines);
        }