Example #1
0
        private void AddSkillsToProfile(
         PlayerProfile playerProfile,
         ProfileSkillPriority goalkeeping,
         ProfileSkillPriority defending,
         ProfileSkillPriority passing,
         ProfileSkillPriority speed,
         ProfileSkillPriority shooting,
         ProfileSkillPriority heading,
         ProfileSkillPriority tactics,
         ProfileSkillPriority fitness,
         ProfileSkillPriority talent,
         ProfileSkillPriority technique,
         ProfileSkillPriority form,
         ProfileSkillPriority confidence)
        {
            playerProfile.PlayerProfileSkills = new List<PlayerProfileSkill>();

             // Note: in the order the skills are added here also causes the order of skills for the player.

             using (var playerSkillRepository = new RepositoryFactory().CreatePlayerSkillRepository())
             {
            // Add Goalkeeping skill.
            var playerSkill = playerSkillRepository.GetGoalkeeping();
            var profileSkill = new PlayerProfileSkill(playerSkill, goalkeeping);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Defending skill.
            playerSkill = playerSkillRepository.GetDefending();
            profileSkill = new PlayerProfileSkill(playerSkill, defending);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Passing skill.
            playerSkill = playerSkillRepository.GetPassing();
            profileSkill = new PlayerProfileSkill(playerSkill, passing);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Speed skill.
            playerSkill = playerSkillRepository.GetSpeed();
            profileSkill = new PlayerProfileSkill(playerSkill, speed);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Technique skill.
            playerSkill = playerSkillRepository.GetTechnique();
            profileSkill = new PlayerProfileSkill(playerSkill, technique);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Shooting skill.
            playerSkill = playerSkillRepository.GetShooting();
            profileSkill = new PlayerProfileSkill(playerSkill, shooting);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Heading skill.
            playerSkill = playerSkillRepository.GetHeading();
            profileSkill = new PlayerProfileSkill(playerSkill, heading);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Tactics skill.
            playerSkill = playerSkillRepository.GetTactics();
            profileSkill = new PlayerProfileSkill(playerSkill, tactics);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Talent skill.
            playerSkill = playerSkillRepository.GetTalent();
            profileSkill = new PlayerProfileSkill(playerSkill, talent);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Fitness skill.
            playerSkill = playerSkillRepository.GetFitness();
            profileSkill = new PlayerProfileSkill(playerSkill, fitness);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Form skill.
            playerSkill = playerSkillRepository.GetForm();
            profileSkill = new PlayerProfileSkill(playerSkill, form);
            playerProfile.PlayerProfileSkills.Add(profileSkill);

            // Add Confidence skill.
            playerSkill = playerSkillRepository.GetConfidence();
            profileSkill = new PlayerProfileSkill(playerSkill, confidence);
            playerProfile.PlayerProfileSkills.Add(profileSkill);
             }
        }
Example #2
0
 public PlayerProfileSkill(PlayerSkill playerSkill, ProfileSkillPriority profileSkillPriority)
 {
     Skill = playerSkill;
      SkillPriority = profileSkillPriority;
 }