Exemplo n.º 1
0
 public async Task Update(string id, string title, string description)
 {
     await Goals.Where(o => o.Id == id)
     .Set(o => o.Title, title)
     .Set(o => o.Description, description)
     .UpdateAsync();
 }
Exemplo n.º 2
0
 private IEnumerable <Goal> GetGoals(int teamId)
 {
     return(Goals
            .Where(goal =>
                   goal.Player.Teams.Select(team => team.Id).Contains(teamId)
                   ));
 }
Exemplo n.º 3
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;
            }
        }
Exemplo n.º 4
0
 private int GetScore(int teamId)
 {
     return(Goals
            .Where(goal =>
                   goal.Player.Teams.Select(team => team.Id).Contains(teamId)
                   )
            .Sum(goal => goal.Count));
 }
Exemplo n.º 5
0
 public Data ToBase()
 {
     return(new Data()
     {
         gameFinished = GameFinished,
         Pieces = Pieces?.Where(q => q != null).Select(q => q.ToBase()).ToArray(),
         playerGuid = PlayerGUID,
         playerId = PlayerId,
         PlayerLocation = PlayerLocation?.ToBase(),
         TaskFields = Tasks?.Where(q => q != null).Select(q => q.ToBase()).ToArray(),
         GoalFields = Goals?.Where(q => q != null).Select(q => q.ToBase()).ToArray()
     });
 }
        /// <summary>
        /// Transforms from kh list to mental model
        /// </summary>
        /// <returns></returns>
        private List <MentalModel> TransformDOToMentalModel()
        {
            mentalProto = DecisionOptions.GroupBy(kh => kh.MentalModel).OrderBy(g => g.Key).Select(g =>
                                                                                                   new MentalModel(g.Key, Goals.Where(goal => MentalModel[g.Key.ToString()].AssociatedWith.Contains(goal.Name)).ToArray(),
                                                                                                                   g.GroupBy(kh => kh.DecisionOptionsLayer).OrderBy(g2 => g2.Key).
                                                                                                                   Select(g2 => new DecisionOptionLayer(MentalModel[g.Key.ToString()].Layer[g2.Key.ToString()], g2)))).ToList();

            return(mentalProto);
        }
Exemplo n.º 7
0
 public override string ToString()
 {
     return(HomeTeam + " (" + Goals.Where(goal => goal.Team == HomeTeam).ToString() + ") " + AwayTeam + " (" + Goals.Where(goal => goal.Team == AwayTeam).ToString() + ")");
 }
Exemplo n.º 8
0
 public async Task SetState(GoalState goalState, params string[] goalIds)
 {
     await Goals.Where(o => o.Id.In(goalIds))
     .Set(o => o.State, goalState)
     .UpdateAsync();
 }
Exemplo n.º 9
0
 public async Task SetAssignee(string goalId, string assigneeId)
 {
     await Goals.Where(o => o.Id == goalId)
     .Set(o => o.AssigneeId, assigneeId)
     .UpdateAsync();
 }
Exemplo n.º 10
0
        //---------------------------------------------------------------------------------------------

        public async Task <IEnumerable <Goal> > GetGoalsAsync(int userId)
        {
            return(await Goals.Where(g => g.UserId == userId).ToListAsync());
        }
Exemplo n.º 11
0
 internal static IEnumerable <PresentItem> GetGoalPresentation(string groupKey, string memberKey, string parentid)
 {
     return(Goals.Where(i => i.GroupKey == groupKey && i.MemberKey == memberKey && i.ParentId == parentid).Select(i => GoalToPresentation(groupKey, memberKey, i)));
 }
Exemplo n.º 12
0
 internal static IEnumerable <GoalItem> GetGoal(string groupKey)
 {
     return(Goals.Where(m => m.GroupKey == groupKey));
 }
Exemplo n.º 13
0
        /// <summary>
        /// Transforms from rule list to rule sets
        /// </summary>
        /// <returns></returns>
        private List <RuleSet> TransformRulesToRuleSets()
        {
            mentalProto = Rules.GroupBy(r => r.RuleSet).OrderBy(g => g.Key).Select(g =>
                                                                                   new RuleSet(g.Key, Goals.Where(goal => SetConfiguration[g.Key.ToString()].AssociatedWith.Contains(goal.Name)).ToArray(),
                                                                                               g.GroupBy(r => r.RuleLayer).OrderBy(g2 => g2.Key).
                                                                                               Select(g2 => new RuleLayer(SetConfiguration[g.Key.ToString()].Layer[g2.Key.ToString()], g2)))).ToList();

            return(mentalProto);
        }
Exemplo n.º 14
0
 public async Task <string[]> GetIdsByState(GoalState state)
 {
     return(await Goals.Where(o => o.State == state)
            .Select(o => o.Id)
            .ToArrayAsync());
 }
Exemplo n.º 15
0
 internal static IEnumerable <PresentItem> GetTodos(string groupKey, string memberKey, string parentid)
 {
     return(Goals.Where(i => i.GroupKey == groupKey && i.MemberKey == memberKey && !Goals.Any(g => g.ParentId == i.Id)).Select(i => GoalToPresentation2(groupKey, memberKey, i)));
 }
Exemplo n.º 16
0
 internal void Init()
 {
     Goals.Where(x => !x.Completed).ToList().ForEach(x => x.Init());
 }
Exemplo n.º 17
0
 public List <Goal> GameWeekGoals(int gameWeekId, bool cup = false)
 {
     return(Goals.Where(x => x.GameWeekId == gameWeekId && x.Cup == cup).ToList());
 }