示例#1
0
        public Photo(Dictionary<string, object> jsonDictionary)
            : base(jsonDictionary)
        {
            Sizes = new List<PhotoSize>();
            jsonDictionary = Helpers.ExtractDictionary(jsonDictionary, "response:photo");
            Id = jsonDictionary["id"].ToString();
            CreatedAt = jsonDictionary["createdAt"].ToString();
            Url = jsonDictionary["url"].ToString();

            if (jsonDictionary.ContainsKey("sizes"))
                foreach (var sizeObj in (object[]) Helpers.ExtractDictionary(jsonDictionary, "sizes")["items"])
                    Sizes.Add(new PhotoSize((Dictionary<string, object>) sizeObj));

            if (jsonDictionary.ContainsKey("source"))
            {
                Source = new Source((Dictionary<string,object>) jsonDictionary["source"]);
            }

            if (jsonDictionary.ContainsKey("user"))
                User = new User((Dictionary<string, object>) jsonDictionary["user"]);

            if (jsonDictionary.ContainsKey("venue"))
                Venue = new Venue((Dictionary<string, object>) jsonDictionary["venue"]);

            if (jsonDictionary.ContainsKey("tip"))
            {
                Tip = new Tip((Dictionary<string, object>)jsonDictionary["tip"]);
            }

            if (jsonDictionary.ContainsKey("checkin"))
                Checkin = new Checkin((Dictionary<string, object>) jsonDictionary["checkin"]);
        }
示例#2
0
 public Comment(Dictionary<string, object> jsonDictionary)
     : base(jsonDictionary)
 {
     jsonDictionary = Helpers.ExtractDictionary(jsonDictionary, "response:comment");
     Id = jsonDictionary["id"].ToString();
     CreatedAt = jsonDictionary["createdAt"].ToString();
     User = new User((Dictionary<string, object>)jsonDictionary["user"]);
     Text = jsonDictionary["text"].ToString();
 }
示例#3
0
 public Overlaps(Dictionary<string, object> jsonDictionary)
 {
     Json = Helpers.JsonSerializer(jsonDictionary);
     Id = jsonDictionary["id"].ToString();
     CreatedAt = jsonDictionary["createdAt"].ToString();
     Type = jsonDictionary["type"].ToString();
     TimeZone = jsonDictionary["timeZone"].ToString();
     User = new User((Dictionary<string, object>)jsonDictionary["user"]);
 }
示例#4
0
        public Mayorship(Dictionary<string, object> jsonDictionary)
        {
            Json = Helpers.JsonSerializer(jsonDictionary);

            Type = Helpers.GetDictionaryValue(jsonDictionary, "type");
            Checkins = Helpers.GetDictionaryValue(jsonDictionary, "count");

            if (jsonDictionary.ContainsKey("user"))
                User = new User((Dictionary<string, object>) jsonDictionary["user"]);
        }
示例#5
0
        public Tip(Dictionary<string, object> jsonDictionary)
            : base(jsonDictionary)
        {
            Photo = "";
            Todocount = 0;
            Done = "";
            if (jsonDictionary.ContainsKey("response"))
                jsonDictionary = Helpers.ExtractDictionary(jsonDictionary, "response");
            jsonDictionary = Helpers.ExtractDictionary(jsonDictionary, "tip");
            Id = Helpers.GetDictionaryValue(jsonDictionary, "id");
            Text = Helpers.GetDictionaryValue(jsonDictionary, "text");
            CreatedAt = Helpers.GetDictionaryValue(jsonDictionary, "createdAt");
            Status = Helpers.GetDictionaryValue(jsonDictionary, "status");
            Url = Helpers.GetDictionaryValue(jsonDictionary, "url");

            if (jsonDictionary.ContainsKey("photo"))
            {
                //throw new Exception("To Do Item for this class");
                //todo
            }

            if (jsonDictionary.ContainsKey("user"))
                User = new User((Dictionary<string, object>) jsonDictionary["user"]);
            if (jsonDictionary.ContainsKey("venue"))
                Venue = new Venue((Dictionary<string, object>) jsonDictionary["venue"]);
            if (jsonDictionary.ContainsKey("todo"))
                if (((int) ((Dictionary<string, object>) jsonDictionary["todo"])["count"]) > 0)
                    Todocount = ((int) ((Dictionary<string, object>) jsonDictionary["todo"])["count"]);
            if (jsonDictionary.ContainsKey("done"))
            {
                if (((Dictionary<string, object>)jsonDictionary["done"]).ContainsKey("groups"))
                {
                    //throw new Exception("To Do Item for this class");
                    //todo
                }
                if (((Dictionary<string, object>)jsonDictionary["done"]).ContainsKey("friends"))
                {
                    //throw new Exception("To Do Item for this class");
                    //todo
                }
            }
        }
 public LeaderboardItem(Dictionary<string, object> jsonDictionary)
 {
     RankThisWeek = Int32.Parse(jsonDictionary["rank"].ToString());
     LeaderBoardUser = new User((Dictionary<string, object>)jsonDictionary["user"]);
     ScoreThisWeek = new Score((Dictionary<string, object>)jsonDictionary["scores"]);
 }