Exemplo n.º 1
0
        public static Owner getFullOwner(string email)
        {
            OwnerDB ownDB = new OwnerDB();
            Owner   own   = new Owner();

            try
            {
                own = fillBox(ownDB.listOwnersDB(email).Tables["hvk_owner"].Rows[0]);
            }
            catch (Exception e) {
                return(null);
            }

            own.petList         = Pet.listPets(own.ownerNumber);
            own.reservationList = Reservation.listReservations(own.ownerNumber);

            ReservedService rs = new ReservedService();

            own.reservationList.ForEach(delegate(Reservation res) {
                res.petReservationList.ForEach(delegate(PetReservation pres) {
                    List <ReservedService> ser = rs.listReservedService(pres.petResNumber);
                    if (ser.Count != 0)
                    {
                        pres.serviceList = rs.listReservedService(pres.petResNumber);
                    }
                });
            });

            return(own);
        }
Exemplo n.º 2
0
        public static Reservation getReservation(int resNum)
        {
            ReservationDB db  = new ReservationDB();
            DataSet       ds  = db.getReservationDB(resNum);
            Reservation   res = fillReservationModified(ds)[0];

            ReservedService rs = new ReservedService();

            res.petReservationList.ForEach(delegate(PetReservation pres) {
                List <ReservedService> ser = rs.listReservedService(pres.petResNumber);
                if (ser.Count != 0)
                {
                    pres.serviceList = rs.listReservedService(pres.petResNumber);
                }
            });
            return(res);
        }
Exemplo n.º 3
0
        private ReservedService fillReservedService(DataRow row)
        {
            ReservedService resServ = new ReservedService();

            try
            {
                resServ.frequency             = row["SERVICE_FREQUENCY"] is DBNull ? 0 : Convert.ToInt16(row["SERVICE_FREQUENCY"].ToString());
                resServ.service.serviceNumber = Convert.ToInt16(row["SERVICE_NUMBER"].ToString());
                resServ.service.descripion    = row["SERVICE_DESCRIPTION"].ToString();
            }
            catch (Exception e)
            {
                Console.Write(e);
            }

            return(resServ);
        }
Exemplo n.º 4
0
        public static List <Reservation> listReservations()
        {
            ReservationDB db = new ReservationDB();
            DataSet       ds = db.listResevationsDB();

            List <Reservation> reservationList = fillReservationModified(ds);

            ReservedService rs = new ReservedService();

            reservationList.ForEach(delegate(Reservation res) {
                res.petReservationList.ForEach(delegate(PetReservation pres) {
                    List <ReservedService> ser = rs.listReservedService(pres.petResNumber);
                    if (ser.Count != 0)
                    {
                        pres.serviceList = rs.listReservedService(pres.petResNumber);
                    }
                });
            });

            return(reservationList);
        }
Exemplo n.º 5
0
 public bool removeService(ReservedService service)
 {
     return(this.serviceList.Remove(service));
 }
Exemplo n.º 6
0
 public bool addService(ReservedService service)
 {
     this.serviceList.Add(service);
     return(true);
 }