Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 3
0
 public void ExecuteSuccess(Dictionary <string, object> objectDictionary)
 {
     responseDelegate(AdPosition.CreateFromDictionary(objectDictionary));
 }