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); }
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) { } }
public void AddRepair(Repair repairToAdd) { this.repairs.Add(repairToAdd); }
public void AddRepair(Repair repair) { this.repairs.Add(repair); }
public void AddRepair(Repair repairPart) { this.Repairs.Add(repairPart); }