Exemple #1
0
        public static AdPair CreateFromDictionary(Dictionary <string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return(null);
                }

                var request = new AdPair();


                if (jsonMap.ContainsKey("adOne"))
                {
                    request.AdOne = Ad.CreateFromDictionary(jsonMap["adOne"] as Dictionary <string, object>);
                }

                if (jsonMap.ContainsKey("adTwo"))
                {
                    request.AdTwo = Ad.CreateFromDictionary(jsonMap["adTwo"] as Dictionary <string, object>);
                }

                return(request);
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }
Exemple #2
0
        public static AdPosition CreateFromDictionary(Dictionary <string, object> jsonMap)
        {
            try
            {
                if (jsonMap == null)
                {
                    return(null);
                }

                var request = new AdPosition();


                if (jsonMap.ContainsKey("ad"))
                {
                    request.Ad = Ad.CreateFromDictionary(jsonMap["ad"] as Dictionary <string, object>);
                }

                if (jsonMap.ContainsKey("xCoordinate"))
                {
                    request.XCoordinate = System.Convert.ToInt32(jsonMap["xCoordinate"]);
                }

                if (jsonMap.ContainsKey("yCoordinate"))
                {
                    request.YCoordinate = System.Convert.ToInt32(jsonMap["yCoordinate"]);
                }

                if (jsonMap.ContainsKey("width"))
                {
                    request.Width = System.Convert.ToInt32(jsonMap["width"]);
                }

                if (jsonMap.ContainsKey("height"))
                {
                    request.Height = System.Convert.ToInt32(jsonMap["height"]);
                }

                return(request);
            }
            catch (System.ApplicationException ex)
            {
                throw new AmazonException("Error encountered while creating Object from dicionary", ex);
            }
        }
 public void ExecuteSuccess(Dictionary <string, object> objectDictionary)
 {
     responseDelegate(Ad.CreateFromDictionary(objectDictionary));
 }