Beispiel #1
0
        private void UpdateAllRelatedGoals()
        {
            if (SelectedGoal == null)
            {
                AllRelatedGoals = new List <Goal>();
            }
            else
            {
                switch (SelectedGoal.GoalType)
                {
                case GoalType.LongTerm:
                    AllRelatedGoals = Goals.Where(x => x.GoalType == GoalType.OneYear).ToList();
                    break;

                case GoalType.OneYear:
                    AllRelatedGoals = Goals.Where(x => x.GoalType == GoalType.ShortTerm).ToList();
                    break;

                case GoalType.ShortTerm:
                    AllRelatedGoals = Goals.Where(x => x.GoalType == GoalType.InitiativesOne).ToList();
                    break;

                case GoalType.InitiativesOne:
                    AllRelatedGoals = new List <Goal>();
                    break;
                }

                SelectedGoal.RelatesGoals.ForEach(x => AllRelatedGoals.RemoveAll(y => y.Id == x));
                var relatedGoals = new List <Goal>();
                SelectedGoal.RelatesGoals.ForEach(x => relatedGoals.Add(Goals.FirstOrDefault(y => y.Id == x)));
                RelatedGoals = relatedGoals;
            }
        }