예제 #1
0
        private static IEngineer CreateEngineer(string[] cmdArgs, int id, string firstName, string lastName, decimal salary, string corps)
        {
            IEngineer engineer = new Engineer(id, firstName, lastName, salary, corps);

            string[] repairArgs = cmdArgs.Skip(6).ToArray();

            for (int i = 0; i < repairArgs.Length; i += 2)
            {
                string partName    = repairArgs[i];
                int    hoursWorked = int.Parse(repairArgs[i + 1]);

                IRepair repair = new Repair(partName, hoursWorked);

                engineer.AddRepair(repair);
            }

            return(engineer);
        }
예제 #2
0
        public void ReadEngineer(string[] cmdArgs, List <Soldier> allSoldiers)
        {
            var id        = cmdArgs[1];
            var firstName = cmdArgs[2];
            var lastName  = cmdArgs[3];
            var salary    = decimal.Parse(cmdArgs[4]);
            var corps     = cmdArgs[5];

            try
            {
                var engineer = new Engineer(id, firstName, lastName, salary, corps);
                var repair   = new Repair();
                engineer.repairs = new List <Repair>();
                engineer.repairs = repair.ReadRepairs(cmdArgs).ToList();
                allSoldiers.Add(engineer);
            }
            catch (ArgumentException)
            {
            }
        }
예제 #3
0
 public void AddRepair(Repair repairToAdd)
 {
     this.repairs.Add(repairToAdd);
 }
예제 #4
0
 public void AddRepair(Repair repair)
 {
     this.repairs.Add(repair);
 }
예제 #5
0
 public void AddRepair(Repair repairPart)
 {
     this.Repairs.Add(repairPart);
 }