public List <Player> getYellowCardsForAllPlayer()
        {
            var players = GetCollections.getPlayerCollection();
            var yCards  = GetCollections.getYellowCardCollection();

            return((players.Select(p => { p.yellowCards = yCards.Count(b => b.playerId == p.Id); return p; })).OrderByDescending(pp => pp.yellowCards).ToList());
        }
Ejemplo n.º 2
0
        public GeneralResponse CheckDetails(string password)
        {
            GeneralResponse gr = new GeneralResponse();

            gr.IsSuccess = false;
            if (password == "truby")
            {
                Common.GetCollections gc = new GetCollections();
                gr = gc.GetDetails(password);
            }
            else
            {
                gr.Message = "Password is incorrect!!!";
            }

            return(gr);
        }
Ejemplo n.º 3
0
        private void OnGetCollections(GetCollections collections, string customData)
        {
            if (collections != null)
            {
                Log.Debug("TestVisualRecognition", "Get Collections succeeded!");
                foreach (CreateCollection collection in collections.collections)
                {
                    Log.Debug("TestVisualRecognition", "collectionID: {0} | collection name: {1} | number of images: {2}", collection.collection_id, collection.name, collection.images);
                }
            }
            else
            {
                Log.Debug("TestVisualRecognition", "Get Collections failed!");
            }

            m_ListCollectionsTested = true;
            Test(collections != null);
        }
        public GetCollections GetCollections()
        {
            GetCollections result = null;

            try
            {
                result = this.Client.GetAsync($"{this.Endpoint}{PATH_COLLECTIONS}")
                         .WithArgument("api_key", ApiKey)
                         .WithArgument("version", VERSION_DATE_2016_05_20)
                         .As <GetCollections>()
                         .Result;
            }
            catch (AggregateException ae)
            {
                throw ae.Flatten();
            }

            return(result);
        }
        public void getYellowAndRedCardsForPlayer(ObjectId id)
        {
            var events = GetCollections.getEventCollection();
            var yellow = (
                from card in events
                where card.playerId == id &&
                card.eventType == "Yellow Card"
                select card).ToList().Count();
            var red = (
                from card in events
                where card.playerId == id &&
                card.eventType == "Yellow Red Card"
                select card).ToList().Count();

            tb_output.Text =
                "First Name: " + playerFirstName + Environment.NewLine +
                "Last Name: " + playerLastName + Environment.NewLine +
                "Yellow Cards: " + yellow + Environment.NewLine +
                "Yellow-Red Cards: " + red;
        }
        public static ObjectId getPlayerId(string firstNamePlayer, string lastName)
        {
            var players = GetCollections.getPlayerCollection();

            return((players.First(e => e.firstName == firstNamePlayer && e.lastName == lastName)).Id);
        }
Ejemplo n.º 7
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     List <Player> yellowCardsPlayersDescending2 = (GetCollections.getPlayerCollection().Select(p => { p.yellowCards = GetCollections.getYellowCardCollection().Count(b => b.playerId == p.Id); return(p); })).OrderByDescending(pp => pp.yellowCards).ToList();
 }