예제 #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();
 }
예제 #2
0
파일: Game.cs 프로젝트: vannuysm/Leaguerly
 private IEnumerable <Goal> GetGoals(int teamId)
 {
     return(Goals
            .Where(goal =>
                   goal.Player.Teams.Select(team => team.Id).Contains(teamId)
                   ));
 }
예제 #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;
            }
        }
예제 #4
0
파일: Game.cs 프로젝트: vannuysm/Leaguerly
 private int GetScore(int teamId)
 {
     return(Goals
            .Where(goal =>
                   goal.Player.Teams.Select(team => team.Id).Contains(teamId)
                   )
            .Sum(goal => goal.Count));
 }
예제 #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);
        }
예제 #7
0
 public override string ToString()
 {
     return(HomeTeam + " (" + Goals.Where(goal => goal.Team == HomeTeam).ToString() + ") " + AwayTeam + " (" + Goals.Where(goal => goal.Team == AwayTeam).ToString() + ")");
 }
예제 #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();
 }
예제 #9
0
 public async Task SetAssignee(string goalId, string assigneeId)
 {
     await Goals.Where(o => o.Id == goalId)
     .Set(o => o.AssigneeId, assigneeId)
     .UpdateAsync();
 }
예제 #10
0
        //---------------------------------------------------------------------------------------------

        public async Task <IEnumerable <Goal> > GetGoalsAsync(int userId)
        {
            return(await Goals.Where(g => g.UserId == userId).ToListAsync());
        }
예제 #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)));
 }
예제 #12
0
 internal static IEnumerable <GoalItem> GetGoal(string groupKey)
 {
     return(Goals.Where(m => m.GroupKey == groupKey));
 }
예제 #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);
        }
예제 #14
0
 public async Task <string[]> GetIdsByState(GoalState state)
 {
     return(await Goals.Where(o => o.State == state)
            .Select(o => o.Id)
            .ToArrayAsync());
 }
예제 #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)));
 }
예제 #16
0
 internal void Init()
 {
     Goals.Where(x => !x.Completed).ToList().ForEach(x => x.Init());
 }
예제 #17
0
 public List <Goal> GameWeekGoals(int gameWeekId, bool cup = false)
 {
     return(Goals.Where(x => x.GameWeekId == gameWeekId && x.Cup == cup).ToList());
 }