Example #1
0
        public Procedure CreateProcedure(string type)
        {
            Procedure procedure = null;

            switch (type)
            {
            case "Chip":
                procedure = new Chip();
                break;

            case "DentalCare":
                procedure = new DentalCare();
                break;

            case "Fitness":
                procedure = new Fitness();
                break;

            case "NailTrim":
                procedure = new NailTrim();
                break;

            case "Play":
                procedure = new Play();
                break;

            case "Vaccinate":
                procedure = new Vaccinate();
                break;
            }

            return(procedure);
        }
Example #2
0
        public string DentalCare(string name, int procedureTime)
        {
            IAnimal    animal    = GetAnimal(name);
            IProcedure procedure = new DentalCare();

            MakeProcedure(procedureTime, animal, procedure);
            return($"{name} had dental care procedure");
        }
Example #3
0
 private void InitializeProcedures()
 {
     procedures["Chip"]       = new Chip();
     procedures["DentalCare"] = new DentalCare();
     procedures["Fitness"]    = new Fitness();
     procedures["NailTrim"]   = new NailTrim();
     procedures["Play"]       = new Play();
     procedures["Vaccinate"]  = new Vaccinate();
 }
Example #4
0
 public AnimalCentre()
 {
     this.animalHotel = new Hotel();
     this.chip        = new Chip();
     this.fitness     = new Fitness();
     this.dentalCare  = new DentalCare();
     this.nailTrim    = new NailTrim();
     this.play        = new Play();
     this.vaccinate   = new Vaccinate();
 }
 public AnimalCentre()
 {
     hotel     = new Hotel();
     Adopted   = new Dictionary <string, List <IAnimal> >();
     chip      = new Chip();
     dental    = new DentalCare();
     fitness   = new Fitness();
     nailTrim  = new NailTrim();
     play      = new Play();
     vaccinate = new Vaccinate();
 }
Example #6
0
 public AnimalCentre()
 {
     this.chip            = new Chip();
     this.vaccinate       = new Vaccinate();
     this.fitness         = new Fitness();
     this.play            = new Play();
     this.dentalCare      = new DentalCare();
     this.nailTrim        = new NailTrim();
     this.addoptedAnimals = new Dictionary <string, List <IAnimal> >();
     this.hotel           = new Hotel();
 }
Example #7
0
        public string DentalCare(string name, int procedureTime)
        {
            DentalCare dentalCare = new DentalCare();

            var animal = this.hotel.Animals[name];

            dentalCare.DoService(animal, procedureTime);

            this.proceduresAndItsAnimals["DentalCare"].Add(animal);

            return($"{name} had dental care procedure");
        }
Example #8
0
        public AnimalCentre()
        {
            this.hotel         = new Hotel();
            this.animalFactory = new AnimalFactory();

            this.chipped     = new Chip();
            this.dentalCared = new DentalCare();
            this.fitnessed   = new Fitness();
            this.nailTrimmed = new NailTrim();
            this.played      = new Play();
            this.vaccineted  = new Vaccinate();
        }
Example #9
0
        public AnimalCentre(Hotel hotel, Dictionary <string, List <IAnimal> > owners)
        {
            this.owners = owners;
            this.hotel  = hotel;

            this.chip       = new Chip();
            this.vaccinate  = new Vaccinate();
            this.play       = new Play();
            this.nailTrim   = new NailTrim();
            this.dentalCare = new DentalCare();
            this.fitness    = new Fitness();
        }
        public string DentalCare(string name, int procedureTime)
        {
            IAnimal    animal     = GetAnimal(name, procedureTime);
            DentalCare dentalCare = new DentalCare();

            dentalCare.DoService(animal, procedureTime);

            AddToHistory(dentalCare.GetType().Name, animal);

            string result = $"{animal.Name} had dental care procedure";

            return(result);
        }
Example #11
0
        public string DentalCare(string name, int procedureTime)
        {
            if (IsExistInHotel(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
            Procedure procedure = new DentalCare();

            procedure.DoService(animalsInHotel[name], procedureTime);
            procedures.Add(procedure);
            string result = $"{name} had dental care procedure";

            return(result);
        }
Example #12
0
        public string DentalCare(string name, int procedureTime)
        {
            CheckForAnimal(name);
            DentalCare dentalCare = new DentalCare();
            Animal     animal     = hotel.Animals.Values.FirstOrDefault(x => x.Name == name);

            dentalCare.DoService(animal, procedureTime);
            if (!history.ContainsKey("DentalCare"))
            {
                history.Add("DentalCare", new List <Animal>());
            }
            history["DentalCare"].Add(animal);
            return($"{name} had dental care procedure");
        }
Example #13
0
        public string DentalCare(string name, int procedureTime)
        {
            string dental = "DentalCare";

            CheckAnimalExist(name);
            DentalCare dentalCare = new DentalCare();

            IAnimal animal = GetAnimal(name);

            dentalCare.DoService(animal, procedureTime);
            AddHistory(animal, dental);

            return($"{name} had dental care procedure");
        }
Example #14
0
        public string DentalCare(string name, int procedureTime)
        {
            AnimalDoesntExist(name);

            IAnimal animal = TakeAnimal(name);

            IProcedure dentalCare = new DentalCare();

            dentalCare.DoService(animal, procedureTime);

            AddTypeProcedure(dentalCare);

            return(string.Format(
                       ConstantMessages.HadProcedure,
                       animal.Name,
                       "dental care"));
        }
Example #15
0
        public AnimalCentre()
        {
            this.hotel   = new Hotel();
            this.factory = new AnimalFactory();
            this.chip    = new Chip();
            this.care    = new DentalCare();
            this.fitness = new Fitness();
            this.trim    = new NailTrim();
            this.play    = new Play();
            this.vac     = new Vaccinate();

            this.procedures = new List <Procedure>()
            {
                chip, care, fitness, trim, play, vac
            };

            this.allAddoptedAnimals = new Dictionary <string, List <string> >();
        }
Example #16
0
 public AnimalCentre(IHotel hotel,
                     IProcedure procedure,
                     Chip chip,
                     DentalCare dentalcare,
                     Fitness fitness,
                     NailTrim nailtrim,
                     Play play,
                     Vaccinate vaccinate)
 {
     this.hotel     = hotel;
     this.procedure = procedure;
     chip           = new Chip();
     dentalcare     = new DentalCare();
     fitness        = new Fitness();
     nailtrim       = new NailTrim();
     play           = new Play();
     vaccinate      = new Vaccinate();
 }
Example #17
0
        public string DentalCare(string name, int procedureTime)
        {
            this.DoesExist(name);

            var animal = hotel.GetAnimal(name);

            if (this.procedures.Any(p => p.GetType().Name == "DentalCare"))
            {
                this.procedures.First(p => p.GetType().Name == "DentalCare")
                .DoService(animal, procedureTime);
            }
            else
            {
                Procedure procedure = new DentalCare();
                procedure.DoService(animal, procedureTime);
                this.procedures.Add(procedure);
            }

            return($"{name} had dental care procedure");
        }
Example #18
0
        public string DentalCare(string name, int procedureTime)
        {
            if (!this.hotel.Animals.ContainsKey(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }

            var animal = this.hotel.Animals.First(x => x.Value.Name == name).Value;

            if (this.procedures.Any(x => x.GetType() == typeof(DentalCare)))
            {
                this.procedures.First(x => x.GetType() == typeof(DentalCare)).DoService(animal, procedureTime);
            }

            else
            {
                var dentalCare = new DentalCare();
                dentalCare.DoService(animal, procedureTime);
                this.procedures.Add(dentalCare);
            }

            return($"{animal.Name} had dental care procedure");
        }
Example #19
0
        public Procedure CreateProcedure(string procedureType)
        {
            Procedure procedure = null;

            switch (procedureType)
            {
            case "Chip":
                procedure = new Chip();
                break;

            case "DentalCare":
                procedure = new DentalCare();
                break;

            case "Fitness":
                procedure = new Fitness();
                break;

            case "NailTrim":
                procedure = new NailTrim();
                break;

            case "Play":
                procedure = new Play();
                break;

            case "Vaccinate":
                procedure = new Vaccinate();
                break;

            default:
                throw new InvalidOperationException("Invalid procedure!");
            }

            return(procedure);
        }