Ejemplo n.º 1
0
        public string Charge(string robotName, int procedureTime)
        {
            IRobot robot = CheckIfRobotExists(robotName);

            procedureCharge.DoService(robot, procedureTime);
            return(String.Format(OutputMessages.ChargeProcedure, robotName));
        }
Ejemplo n.º 2
0
        public string Polish(string robotName, int procedureTime)
        {
            IRobot robot = CheckIfRobotExists(robotName);

            procedurePolish.DoService(robot, procedureTime);
            return(String.Format(OutputMessages.PolishProcedure, robotName));
        }
Ejemplo n.º 3
0
        public string Work(string robotName, int procedureTime)
        {
            IRobot robot = CheckIfRobotExists(robotName);

            procedureWork.DoService(robot, procedureTime);
            return(String.Format(OutputMessages.WorkProcedure, robotName, procedureTime));
        }
Ejemplo n.º 4
0
        public string Chip(string robotName, int procedureTime)
        {
            this.CheckIfRobotExists(robotName);

            chipProcedure.DoService(this.garage.Robots[robotName], procedureTime);

            return(String.Format(OutputMessages.ChipProcedure, robotName));
        }
Ejemplo n.º 5
0
 private void MakeProcedure(int procedureTime, IAnimal animal, IProcedure procedure)
 {
     if (!this.procedures.ContainsKey(procedure.GetType().Name))
     {
         this.procedures.Add(procedure.GetType().Name, new List <IAnimal>());
     }
     procedure.DoService(animal, procedureTime);
     this.procedures[procedure.GetType().Name].Add(animal);
 }
Ejemplo n.º 6
0
        public string Work(string robotName, int procedureTime)
        {
            IRobot currRobot = IsExist(robotName);

            procedure = procedures["Work"];
            procedure.DoService(currRobot, procedureTime);

            return(string.Format(OutputMessages.WorkProcedure, robotName, procedureTime));
        }
Ejemplo n.º 7
0
        private string DoService(string robotName, int procedureTime, ProcedureType procedureType, string autotemplate)
        {
            IRobot     robot     = GetRobotByName(robotName);
            IProcedure procedure = procedures[procedureType];

            procedure.DoService(robot, procedureTime);
            string message = String.Format(autotemplate, robotName);

            return(message);
        }
Ejemplo n.º 8
0
        private string DoService(string robotName, int procedureTime, ProcedureType procedureType, string outputTemplate)
        {
            IRobot     robot     = this.GetRobotByName(robotName);
            IProcedure procedure = this.procedures[procedureType];

            procedure.DoService(robot, procedureTime);
            string outputMsg = string.Format(outputTemplate, robot.Name);

            return(outputMsg);
        }
Ejemplo n.º 9
0
        public string Work(string robotName, int procedureTime)
        {
            IRobot     robot     = this.GetRobotByName(robotName);
            IProcedure procedure = this.procedures[ProcedureType.Work];

            procedure.DoService(robot, procedureTime);

            string outputMsg = string.Format(OutputMessages.WorkProcedure, robotName, procedureTime);

            return(outputMsg);
        }
Ejemplo n.º 10
0
        public string Work(string robotName, int procedureTime)
        {
            if (!garage.Robots.ContainsKey(robotName))
            {
                throw new ArgumentException(String.Format(ExceptionMessages.InexistingRobot, robotName));
            }
            IRobot currRobot = garage.Robots[robotName];

            procedureWork.DoService(currRobot, procedureTime);
            return(String.Format(OutputMessages.WorkProcedure, robotName, procedureTime));
        }
Ejemplo n.º 11
0
        public string Polish(string robotName, int procedureTime)
        {
            this.CheckIfRobotExists(robotName);
            IRobot robot = this.GetRobot(robotName);

            IProcedure procedure = this.procedures[nameof(this.Polish)];

            procedure.DoService(robot, procedureTime);

            return(string.Format(OutputMessages.PolishProcedure, robotName));
        }
        public string DentalCare(string name, int procedureTime)
        {
            if (IsAnimalExisting(name))
            {
                dentalCareProcedure.DoService(this.hotel.Animals[name], procedureTime);

                return($"{name} had dental care procedure");
            }
            else
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
        }
        public string Fitness(string name, int procedureTime)
        {
            if (IsAnimalExisting(name))
            {
                fitnessProcedure.DoService(this.hotel.Animals[name], procedureTime);

                return($"{name} had fitness procedure");
            }
            else
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
        }
        public string Play(string name, int procedureTime)
        {
            if (IsAnimalExisting(name))
            {
                playProcedure.DoService(this.hotel.Animals[name], procedureTime);

                return($"{name} was playing for {procedureTime} hours");
            }
            else
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }
        }
Ejemplo n.º 15
0
        public string Chip(string robotName, int procedureTime)
        {
            if (!garage.Robots.ContainsKey(robotName))
            {
                throw new ArgumentException($"Robot {robotName} does not exist");
            }
            IRobot currentRobot = garage.Robots.GetValueOrDefault(robotName);

            chip.DoService(currentRobot, procedureTime);
            string result = $"{currentRobot.Name} had chip procedure";

            return(result);
        }
Ejemplo n.º 16
0
        public string Work(string robotName, int procedureTime)
        {
            var currentRobot = this.garage.Robots.FirstOrDefault(x => x.Key == robotName).Value;

            if (currentRobot is null)
            {
                throw new ArgumentException($"Robot {robotName} does not exist");
            }


            work.DoService(currentRobot, procedureTime);

            return($"{robotName} was working for {procedureTime} hours");
        }
Ejemplo n.º 17
0
        public string Chip(string robotName, int procedureTime)
        {
            var currentRobot = this.garage.Robots.FirstOrDefault(x => x.Key == robotName).Value;

            if (currentRobot is null)
            {
                throw new ArgumentException($"Robot {robotName} does not exist");
            }


            chip.DoService(currentRobot, procedureTime);

            return($"{robotName} had chip procedure");
        }
Ejemplo n.º 18
0
        private string ExecuteProcedure(string robotName, int procedureTime, string message, string outputMessage, RobotProcedures robotProcedure)
        {
            var msg = string.Format(message, robotName);

            Validate(robotName, msg);

            IRobot     robot     = this.garage.Robots[robotName];
            IProcedure procedure = this.procedures[robotProcedure];

            procedure.DoService(robot, procedureTime);

            var outputMsg = string.Format(outputMessage, robotName);

            return(outputMsg);
        }
Ejemplo n.º 19
0
        public string Work(string robotName, int procedureTime)
        {
            var msg = string.Format(ExceptionMessages.InexistingRobot, robotName);

            Validate(robotName, msg);

            IRobot     robot     = this.garage.Robots[robotName];
            IProcedure procedure = this.procedures[RobotProcedures.Work];

            procedure.DoService(robot, procedureTime);

            var outputMsg = string.Format(OutputMessages.WorkProcedure, robotName, procedureTime);

            return(outputMsg);
        }
Ejemplo n.º 20
0
        public string Play(string name, int procedureTime)
        {
            if (!hotel.Animals.ContainsKey(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }

            IAnimal    currentAnimal = hotel.Animals.First(x => x.Key == name).Value;
            IProcedure play          = procedureFactory.CreateProcedure("Play");

            play.DoService(currentAnimal, procedureTime);

            if (!procedures.ContainsKey("Play"))
            {
                procedures.Add("Play", new List <IAnimal>());
            }
            procedures["Play"].Add(currentAnimal);

            return($"{currentAnimal.Name} was playing for {procedureTime} hours");
        }
Ejemplo n.º 21
0
        public string Fitness(string name, int procedureTime)
        {
            if (!hotel.Animals.ContainsKey(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }

            IAnimal    currentAnimal = hotel.Animals.First(x => x.Key == name).Value;
            IProcedure fitness       = procedureFactory.CreateProcedure("Fitness");

            fitness.DoService(currentAnimal, procedureTime);

            if (!procedures.ContainsKey("Fitness"))
            {
                procedures.Add("Fitness", new List <IAnimal>());
            }
            procedures["Fitness"].Add(currentAnimal);

            return($"{currentAnimal.Name} had fitness procedure");
        }
Ejemplo n.º 22
0
        public string MoveProcedure(string name, int procedureTime, string type)
        {
            if (!this.hotel.Animals.ContainsKey(name))
            {
                throw new ArgumentException($"Animal {name} does not exist");
            }

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

            if (!this.list.ContainsKey(type))
            {
                Type classType = typeof(AnimalCentre).Assembly.GetTypes().FirstOrDefault(x => x.Name == type);

                IProcedure newProcedure = (IProcedure)Activator.CreateInstance(classType, new object[] { });

                this.list[type] = newProcedure;
            }

            IProcedure procedure = list[type];

            procedure.DoService(animal, procedureTime);

            return($"{animal.Name}");
        }
Ejemplo n.º 23
0
 public string Play(string name, int procedureTime)
 {
     CheckIfExists(name);
     play.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} was playing for {procedureTime} hours");
 }
Ejemplo n.º 24
0
 public string NailTrim(string name, int procedureTime)
 {
     CheckIfExists(name);
     nailTrim.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had nail trim procedure");
 }
Ejemplo n.º 25
0
 public string DentalCare(string name, int procedureTime)
 {
     CheckIfExists(name);
     dentailCare.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had dental care procedure");
 }
Ejemplo n.º 26
0
 public string Chip(string name, int procedureTime)
 {
     CheckIfExists(name);
     chip.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had chip procedure");
 }
Ejemplo n.º 27
0
 public string Fitness(string name, int procedureTime)
 {
     CheckIfExists(name);
     fitness.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had fitness procedure");
 }
Ejemplo n.º 28
0
 public string Vaccinate(string name, int procedureTime)
 {
     CheckIfExists(name);
     vaccinate.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had vaccination procedure");
 }