示例#1
0
        public Venue
        (
            String ID,
            String Name,
            int PeopleBeenHere,
            int CheckinsNumber,
            VenueLocation VenueLoc,
            List <VenueCategory> VenueCategories = null,
            List <VenueTip> VenueTips            = null,
            List <String> VenueTags = null
        )
        {
            RelevantVenueTips = new List <VenueTip>();

            this.ID              = ID;
            this.Name            = Name;
            this.PeopleBeenHere  = PeopleBeenHere;
            this.CheckinsNumber  = CheckinsNumber;
            this.VenueLoc        = VenueLoc;
            this.VenueTips       = VenueTips;
            this.VenueTags       = VenueTags;
            this.VenueCategories = VenueCategories;

            if (this.VenueTips != null)
            {
                NoOfTips = this.VenueTips.Count;
            }

            //for (int i = 0; i < 100; i++)
            //    VenueTips.Add(new VenueTip() { TipText = i.ToString() });
        }
示例#2
0
        public Venue
            (
            String ID, 
            String Name, 
            int PeopleBeenHere, 
            int CheckinsNumber, 
            VenueLocation VenueLoc, 
            List<VenueCategory> VenueCategories = null,
            List<VenueTip> VenueTips = null,
            List<String> VenueTags = null
            )
        {
            RelevantVenueTips = new List<VenueTip>();

            this.ID = ID;
            this.Name = Name;
            this.PeopleBeenHere = PeopleBeenHere;
            this.CheckinsNumber = CheckinsNumber;
            this.VenueLoc = VenueLoc;
            this.VenueTips = VenueTips;
            this.VenueTags = VenueTags;
            this.VenueCategories = VenueCategories;

            if (this.VenueTips != null)
                NoOfTips = this.VenueTips.Count;

            //for (int i = 0; i < 100; i++)
            //    VenueTips.Add(new VenueTip() { TipText = i.ToString() });
        }
示例#3
0
        private void ParseDummyModel()
        {
            List<Venue> MiniVenues = App.AutoFacContainer.Resolve<VenuesRespository>().PreFilterVenues;
            FourSquareDataModel M = new FourSquareDataModel();

            for (int i = 0; i < M.VenuesWithTips.Count; i++)
            {
                try
                {
                    if (i != 57)
                    {
                        JsonObject MainDataObject = SimpleJson.SimpleJson.DeserializeObject(M.VenuesWithTips[i]) as JsonObject;
                        JsonObject ResponseObject = MainDataObject["response"] as JsonObject;
                        JsonObject V = ResponseObject["venue"] as JsonObject;


                        int CheckinsCount = 0;
                        int UsersCount = 0;

                        VenueLocation JsVenueLoc = new VenueLocation();
                        List<VenueCategory> JsVenueCategories = new List<VenueCategory>();
                        List<VenueTip> JsVenueTips = new List<VenueTip>();

                        if (Verifier.Verify(V, "tips"))
                        {
                            JsonObject TipsObject = V["tips"] as JsonObject;
                            JsonArray GroupsObject = TipsObject["groups"] as JsonArray;

                            foreach (JsonObject O in GroupsObject)
                            {
                                if (Verifier.Verify(O, "items"))
                                {
                                    JsonArray TipsItems = O["items"] as JsonArray;

                                    foreach (JsonObject T in TipsItems)
                                    {
                                        JsVenueTips.Add(new VenueTip() { TipText = T["text"] as String });
                                    }
                                }
                            }
                        }

                        if (Verifier.Verify(V, "stats"))
                        {
                            JsonObject Status = V["stats"] as JsonObject;
                            int.TryParse(Status["usersCount"] as String, out UsersCount);
                            int.TryParse(Status["checkinsCount"] as String, out CheckinsCount);
                        }

                        if (Verifier.Verify(V, "categories"))
                        {
                            JsonArray Categories = V["categories"] as JsonArray;

                            foreach (JsonObject C in Categories)
                            {
                                JsVenueCategories.Add(new VenueCategory()
                                {
                                    ID = C["id"] as String,
                                    Name = C["name"] as String,
                                    ShortName = C["shortName"] as String,
                                    LongName = C["pluralName"] as String
                                });
                            }
                        }

                        if (Verifier.Verify(V, "location"))
                        {
                            JsonObject Loc = V["location"] as JsonObject;

                            if (Verifier.Verify(V, "address"))
                                JsVenueLoc.Address = Loc["address"] as String;

                            JsVenueLoc.Latitude = (Double)Loc["lat"];
                            JsVenueLoc.Longitude = (Double)Loc["lng"];
                        }

                        Venue MV = new Venue(
                            V["id"] as String,
                            V["name"] as String,
                            UsersCount,
                            CheckinsCount,
                            JsVenueLoc,
                            JsVenueCategories,
                            JsVenueTips
                            );

                        MiniVenues.Add(MV);
                    }
                }
                catch (Exception E)
                {
                    Console.Write(E.Message);
                }
                finally
                { }
            }

            //MiniVenues = MiniVenues.Distinct(new VenuesComparer<Venue>()).ToList();
            FilterAllVenuesByTips();
        }
示例#4
0
        private void ParseMiniVenues(JsonArray VenuesData, List<Venue> MiniVenues)
        {
            foreach (JsonObject V in VenuesData)
            {
                int CheckinsCount = 0;
                int UsersCount = 0;

                VenueLocation JsVenueLoc = new VenueLocation();
                List<VenueCategory> JsVenueCategories = new List<VenueCategory>();

                if (Verifier.Verify(V, "stats"))
                {
                    JsonObject Status = V["stats"] as JsonObject;
                    int.TryParse(Status["usersCount"] as String, out UsersCount);
                    int.TryParse(Status["checkinsCount"] as String, out CheckinsCount);
                }

                if (Verifier.Verify(V, "categories"))
                {
                    JsonArray Categories = V["categories"] as JsonArray;

                    foreach (JsonObject C in Categories)
                    {

                        JsVenueCategories.Add(new VenueCategory()
                        {
                            ID = C["id"] as String,
                            Name = C["name"] as String,
                            ShortName = C["shortName"] as String,
                            LongName = C["pluralName"] as String
                        });
                    }
                }

                if (Verifier.Verify(V, "location"))
                {
                    JsonObject Loc = V["location"] as JsonObject;

                    if (Verifier.Verify(Loc, "address"))
                        JsVenueLoc.Address = Loc["address"] as String;

                    if (Verifier.Verify(Loc, "lat"))
                        JsVenueLoc.Latitude = (Double)Loc["lat"];

                    if (Verifier.Verify(Loc, "lng"))
                        JsVenueLoc.Longitude = (Double)Loc["lng"];
                }


                Venue MV = new Venue(
                    V["id"] as String,
                    V["name"] as String,
                    UsersCount,
                    CheckinsCount,
                    JsVenueLoc,
                    JsVenueCategories
                    );

                MiniVenues.Add(MV);
            }
        }