コード例 #1
0
ファイル: Engine.cs プロジェクト: PetarKostadinov/Softuni
        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
ファイル: Engineer.cs プロジェクト: DeyanDanailov/SoftUni-OOP
        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
ファイル: Engineer.cs プロジェクト: ntabakov/CSharp-Learning
 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);
 }