예제 #1
0
        public string Charge(string robotName, int procedureTime)
        {
            IRobot robot = CheckIfRobotExists(robotName);

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

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

            procedureWork.DoService(robot, procedureTime);
            return(String.Format(OutputMessages.WorkProcedure, robotName, procedureTime));
        }
예제 #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));
        }
예제 #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);
 }
예제 #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));
        }
예제 #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);
        }
예제 #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);
        }
예제 #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);
        }
예제 #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));
        }
예제 #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");
            }
        }
예제 #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);
        }
예제 #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");
        }
예제 #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");
        }
        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);
        }
        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);
        }
예제 #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");
        }
예제 #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");
        }
예제 #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}");
        }
예제 #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");
 }
예제 #24
0
 public string NailTrim(string name, int procedureTime)
 {
     CheckIfExists(name);
     nailTrim.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had nail trim procedure");
 }
예제 #25
0
 public string DentalCare(string name, int procedureTime)
 {
     CheckIfExists(name);
     dentailCare.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had dental care procedure");
 }
예제 #26
0
 public string Chip(string name, int procedureTime)
 {
     CheckIfExists(name);
     chip.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had chip procedure");
 }
예제 #27
0
 public string Fitness(string name, int procedureTime)
 {
     CheckIfExists(name);
     fitness.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had fitness procedure");
 }
예제 #28
0
 public string Vaccinate(string name, int procedureTime)
 {
     CheckIfExists(name);
     vaccinate.DoService(this.hotel.Animals[name], procedureTime);
     return($"{name} had vaccination procedure");
 }