Beispiel #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);
        }
Beispiel #2
0
        public string NailTrim(string name, int procedureTime)
        {
            IAnimal    animal    = GetAnimal(name);
            IProcedure procedure = new NailTrim();

            MakeProcedure(procedureTime, animal, procedure);
            return($"{name} had nail trim procedure");
        }
 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();
 }
Beispiel #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();
 }
Beispiel #5
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();
 }
 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();
 }
        public string NailTrim(string name, int procedureTime)
        {
            NailTrim nailTrim = new NailTrim();

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

            nailTrim.DoService(animal, procedureTime);

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

            return($"{name} had nail trim procedure");
        }
Beispiel #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();
        }
Beispiel #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();
        }
Beispiel #10
0
        public string NailTrim(string name, int procedureTime)
        {
            string nail = "NailTrim";

            CheckAnimalExist(name);
            IAnimal  animal   = GetAnimal(name);
            NailTrim nailTrim = new NailTrim();

            nailTrim.DoService(animal, procedureTime);
            AddHistory(animal, nail);
            return($"{name} had nail trim procedure");
        }
        public string NailTrim(string name, int procedureTime)
        {
            IAnimal  animal   = GetAnimal(name, procedureTime);
            NailTrim nailTrim = new NailTrim();

            nailTrim.DoService(animal, procedureTime);

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

            string result = $"{animal.Name} had nail trim procedure";

            return(result);
        }
        public string NailTrim(string name, int procedureTime)
        {
            CheckForAnimal(name);
            NailTrim nailTrim = new NailTrim();
            Animal   animal   = hotel.Animals.Values.FirstOrDefault(x => x.Name == name);

            nailTrim.DoService(animal, procedureTime);
            if (!history.ContainsKey("NailTrim"))
            {
                history.Add("NailTrim", new List <Animal>());
            }
            history["NailTrim"].Add(animal);
            return($"{name} had nail trim procedure");
        }
Beispiel #13
0
        public string NailTrim(string name, int procedureTime)
        {
            if (IsExistInHotel(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
            Procedure procedure = new NailTrim();

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

            return(result);
        }
Beispiel #14
0
        public string NailTrim(string name, int procedureTime)
        {
            AnimalDoesntExist(name);

            IAnimal animal = TakeAnimal(name);

            IProcedure nailTrim = new NailTrim();

            nailTrim.DoService(animal, procedureTime);

            AddTypeProcedure(nailTrim);

            return(string.Format(
                       ConstantMessages.HadProcedure,
                       animal.Name,
                       "nail trim"));
        }
Beispiel #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> >();
        }
Beispiel #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();
 }
Beispiel #17
0
        public string NailTrim(string name, int procedureTime)
        {
            this.DoesExist(name);

            var animal = hotel.GetAnimal(name);

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

            return($"{name} had nail trim procedure");
        }
Beispiel #18
0
        public string NailTrim(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(NailTrim)))
            {
                this.procedures.First(x => x.GetType() == typeof(NailTrim)).DoService(animal, procedureTime);
            }

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

            return($"{animal.Name} had nail trim procedure");
        }
Beispiel #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);
        }