Exemple #1
0
        private List <Pet> GetPets(DataTable data)
        {
            List <Pet>         list  = new List <Pet>();
            Vaccination        vacc  = new Vaccination();
            List <Vaccination> vaccs = vacc.ListVaccinations();

            foreach (DataRow r in data.Rows)
            {
                try {
                    Pet temp = new Pet(
                        (int)r[0],
                        (String)r[1],
                        r[2].ToString().ElementAt(0),
                        (String)r[3] == "T" ? true : false,
                        !r.IsNull(4) ? r[4].ToString() : "",
                        !r.IsNull(5) ? (DateTime)r[5] : new DateTime(),
                        !r.IsNull(6) ? (int)r[6] : -1,
                        !r.IsNull(7) ? (int)r[7] : -1,
                        !r.IsNull(8) ? r[8].ToString().ElementAt(0) : ' ',
                        !r.IsNull(9) ? r[9].ToString() : ""
                        );
                    //temp.vaccinations = vaccs.Where(v => v.petNumber == temp.number).ToList();
                    list.Add(temp);
                } catch { }
            }
            ;

            return(data != null ? list : null);
        }
Exemple #2
0
        //Warning functions
        public static bool vaccUnchecked(int petNum)
        {
            Vaccination vacc = new Vaccination();

            return(!vacc.ListVaccinations()
                   .FindAll(v => v.petNumber == petNum)
                   .All(v => v.checkedStatus == true));
        }
Exemple #3
0
 public override bool Equals(Object vac)
 {
     if (vac.GetType() == typeof(Vaccination))
     {
         Vaccination vac2 = (Vaccination)vac;
         return(this.number == vac2.number);
     }
     else
     {
         return(false);
     }
 }
Exemple #4
0
        private List <Vaccination> GetVaccinations(DataTable data1, DataTable data2)
        {
            List <Vaccination> list = new List <Vaccination>();

            foreach (DataRow petVacc in data1.Rows)
            {
                try {
                    Vaccination vacc = ListBasicVaccinations().Find(v => v.number == Convert.ToInt16(petVacc[1]));
                    list.Add(new Vaccination(vacc.number,               //Vacc number
                                             vacc.name,                 //vacc name
                                             (int)petVacc[2],           //pet number
                                             (string)petVacc[3] == "Y", //checked status
                                             (DateTime)petVacc[0]));    //exp date
                } catch { }
            }

            return(data1 != null?list.OrderBy(v => v.number).ToList() : null);
        }
Exemple #5
0
        public List <Vaccination> ListExpOrMissVaccs(int petNumber, DateTime byDate)
        {
            Vaccination        vac       = new Vaccination();
            List <Vaccination> list      = vac.ListVaccinations(petNumber);
            List <Vaccination> vaccs     = new List <Vaccination>();
            List <Vaccination> totalList = vac.ListBasicVaccinations();

            foreach (Vaccination v in list)
            {
                if (v.expiryDate <= byDate)
                {
                    vaccs.Add(v);
                }
                Vaccination vacc = totalList.Find(vv =>
                                                  vv.number == v.number);
                totalList.Remove(vacc);
            }

            vaccs.AddRange(totalList);
            return(vaccs);
        }
Exemple #6
0
        public void AddVaccinations()
        {
            Vaccination vacc = new Vaccination();

            vaccinations = vacc.ListVaccinations(this.number);
        }