Example #1
0
        public Classified[] GetClassifiedsInRegion(string regionName)
        {
            Dictionary <string, object> sendData = new Dictionary <string, object>();

            sendData["REGIONNAME"] = regionName;
            sendData["METHOD"]     = "findclassifiedsinregion";

            string            reqString   = WebUtils.BuildQueryString(sendData);
            List <Classified> Classifieds = new List <Classified>();

            try
            {
                List <string> m_ServerURIs =
                    m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI");
                foreach (string m_ServerURI in m_ServerURIs)
                {
                    string reply = SynchronousRestFormsRequester.MakeRequest("POST",
                                                                             m_ServerURI,
                                                                             reqString);
                    if (reply != string.Empty)
                    {
                        Dictionary <string, object> replyData = WebUtils.ParseXmlResponse(reply);

                        foreach (object f in replyData)
                        {
                            KeyValuePair <string, object> value = (KeyValuePair <string, object>)f;
                            if (value.Value is Dictionary <string, object> )
                            {
                                Dictionary <string, object> valuevalue = value.Value as Dictionary <string, object>;
                                Classified classified = new Classified();
                                classified.FromKVP(valuevalue);
                                Classifieds.Add(classified);
                            }
                        }
                    }
                }
                return(Classifieds.ToArray());
            }
            catch (Exception e)
            {
                MainConsole.Instance.DebugFormat("[AuroraRemoteDirectoryServiceConnector]: Exception when contacting server: {0}", e);
            }
            return(Classifieds.ToArray());
        }