Beispiel #1
0
        public List <Strategy> GetStrategiesById(List <string> idList)
        {
            List <Strategy> strategies = _strategyRepository.Get(idList);

            //check if strategie are complete
            if (strategies != null && strategies.Any())
            {
                for (int i = 0; i < strategies.Count; i++)
                {
                    if (strategies[i].Moves != null && strategies[i].Moves.Any())
                    {
                        for (int j = 0; j < strategies[i].Moves.Count; j++)
                        {
                            //calculate total depth and priority if none
                            if (strategies[i].Moves[j].TotalDepth == 0 && strategies[i].Moves[j].Conditions != null)
                            {
                                strategies[i].Moves[j].TotalDepth = strategies[i].Moves[j].Conditions.Max(c => c.Depth);
                            }
                            if (strategies[i].Moves[j].Priority == 0)
                            {
                                strategies[i].Moves[j].Priority = strategies[i].Moves[j].TotalDepth;
                            }
                        }
                    }
                }
            }
            return(strategies);
        }
Beispiel #2
0
        public Strategy[] GetStrategies()
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                IStrategyRepository strategyRepository = _DataRepositoryFactory.GetDataRepository <IStrategyRepository>();
                IEnumerable <Strategy> strategies = strategyRepository.Get();

                return strategies.ToArray();
            }));
        }
Beispiel #3
0
 public StrategyToken GetStrategy(string id)
 {
     return(_strategyRepository.Get(id).AsToken());
 }