public string Charge(string robotName, int procedureTime) { IRobot robot = CheckIfRobotExists(robotName); procedureCharge.DoService(robot, procedureTime); return(String.Format(OutputMessages.ChargeProcedure, robotName)); }
public string Polish(string robotName, int procedureTime) { IRobot robot = CheckIfRobotExists(robotName); procedurePolish.DoService(robot, procedureTime); return(String.Format(OutputMessages.PolishProcedure, robotName)); }
public string Work(string robotName, int procedureTime) { IRobot robot = CheckIfRobotExists(robotName); procedureWork.DoService(robot, procedureTime); return(String.Format(OutputMessages.WorkProcedure, robotName, procedureTime)); }
public string Chip(string robotName, int procedureTime) { this.CheckIfRobotExists(robotName); chipProcedure.DoService(this.garage.Robots[robotName], procedureTime); return(String.Format(OutputMessages.ChipProcedure, robotName)); }
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); }
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)); }
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); }
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); }
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); }
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)); }
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"); } }
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); }
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"); }
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); }
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"); }
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"); }
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}"); }
public string Play(string name, int procedureTime) { CheckIfExists(name); play.DoService(this.hotel.Animals[name], procedureTime); return($"{name} was playing for {procedureTime} hours"); }
public string NailTrim(string name, int procedureTime) { CheckIfExists(name); nailTrim.DoService(this.hotel.Animals[name], procedureTime); return($"{name} had nail trim procedure"); }
public string DentalCare(string name, int procedureTime) { CheckIfExists(name); dentailCare.DoService(this.hotel.Animals[name], procedureTime); return($"{name} had dental care procedure"); }
public string Chip(string name, int procedureTime) { CheckIfExists(name); chip.DoService(this.hotel.Animals[name], procedureTime); return($"{name} had chip procedure"); }
public string Fitness(string name, int procedureTime) { CheckIfExists(name); fitness.DoService(this.hotel.Animals[name], procedureTime); return($"{name} had fitness procedure"); }
public string Vaccinate(string name, int procedureTime) { CheckIfExists(name); vaccinate.DoService(this.hotel.Animals[name], procedureTime); return($"{name} had vaccination procedure"); }