/// <summary>
        ///   Gets all classifieds in the given region
        /// </summary>
        /// <param name = "regionName"></param>
        /// <returns></returns>
        public Classified[] GetClassifiedsInRegion(string regionName)
        {
            QueryFilter filter = new QueryFilter();

            filter.andFilters["SimName"] = regionName;
            List <string> retVal = GD.Query(new string[] { "*" }, "userclassifieds", filter, null, null, null);

            if (retVal.Count == 0)
            {
                return(new Classified[0] {
                });
            }

            List <Classified> Classifieds = new List <Classified>();
            Classified        classified;

            for (int i = 0; i < retVal.Count; i += 6)
            {
                classified = new Classified();
                //Pull the classified out of OSD
                classified.FromOSD((OSDMap)OSDParser.DeserializeJson(retVal[i + 5]));
                Classifieds.Add(classified);
            }
            return(Classifieds.ToArray());
        }
Beispiel #2
0
        public Classified GetClassified(UUID queryClassifiedID)
        {
            if (m_doRemoteOnly)
            {
                object remoteValue = DoRemote(queryClassifiedID);
                return(remoteValue != null ? (Classified)remoteValue : null);
            }

            QueryFilter filter = new QueryFilter();

            filter.andFilters ["ClassifiedUUID"] = queryClassifiedID;

            List <string> query = genData.Query(new [] { "*" }, m_userClassifiedsTable, filter, null, null, null);

            if (query.Count < 9)
            {
                return(null);
            }

            Classified classified = new Classified();

            classified.FromOSD((OSDMap)OSDParser.DeserializeJson(query [6]));

            return(classified);
        }
Beispiel #3
0
        public List <Classified> GetClassifieds(UUID ownerID)
        {
            object remoteValue = DoRemote(ownerID);

            if (remoteValue != null || m_doRemoteOnly)
            {
                return((List <Classified>)remoteValue);
            }

            QueryFilter filter = new QueryFilter();

            filter.andFilters["OwnerUUID"] = ownerID;

            List <string> query = GD.Query(new[] { "*" }, "userclassifieds", filter, null, null, null);

            List <Classified> classifieds = new List <Classified>();

            for (int i = 0; i < query.Count; i += 9)
            {
                Classified classified = new Classified();
                classified.FromOSD((OSDMap)OSDParser.DeserializeJson(query[i + 6]));
                classifieds.Add(classified);
            }
            return(classifieds);
        }
Beispiel #4
0
 public Classified GetClassified(UUID queryClassifiedID)
 {
     try
     {
         List <string> serverURIs =
             m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI");
         foreach (string url in serverURIs)
         {
             OSDMap map = new OSDMap();
             map["Method"]         = "getclassified";
             map["ClassifiedUUID"] = queryClassifiedID;
             OSDMap response = WebUtils.PostToService(url + "osd", map, true, true);
             if (response["_Result"].Type == OSDType.Map)
             {
                 OSDMap     responsemap = (OSDMap)response["_Result"];
                 Classified info        = new Classified();
                 info.FromOSD(responsemap);
                 return(info);
             }
         }
     }
     catch (Exception e)
     {
         MainConsole.Instance.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e);
     }
     return(null);
 }
        public Classified GetClassified(UUID queryClassifiedID)
        {
            object remoteValue = DoRemote(queryClassifiedID);

            if (remoteValue != null || m_doRemoteOnly)
            {
                return((Classified)remoteValue);
            }

            QueryFilter filter = new QueryFilter();

            filter.andFilters["ClassifiedUUID"] = queryClassifiedID;

            List <string> query = GD.Query(new string[1] {
                "*"
            }, "userclassifieds", filter, null, null, null);

            if (query.Count < 6)
            {
                return(null);
            }
            Classified classified = new Classified();

            classified.FromOSD((OSDMap)OSDParser.DeserializeJson(query[5]));
            return(classified);
        }
        /// <summary>
        ///   Searches for classifieds
        /// </summary>
        /// <param name = "queryText"></param>
        /// <param name = "category"></param>
        /// <param name = "queryFlags"></param>
        /// <param name = "StartQuery"></param>
        /// <returns></returns>
        public DirClassifiedReplyData[] FindClassifieds(string queryText, string category, uint queryFlags, int StartQuery)
        {
            QueryFilter filter = new QueryFilter();

            if (int.Parse(category) != (int)DirectoryManager.ClassifiedCategories.Any) //Check the category
            {
                filter.andFilters["Category"] = category;
            }

            filter.andLikeFilters["Name"] = "%" + queryText + "%";

            List <string> retVal = GD.Query(new string[1] {
                "*"
            }, "userclassifieds", filter, null, (uint)StartQuery, 50);

            if (retVal.Count == 0)
            {
                return(new DirClassifiedReplyData[0] {
                });
            }

            List <DirClassifiedReplyData> Data = new List <DirClassifiedReplyData>();
            DirClassifiedReplyData        replyData;

            for (int i = 0; i < retVal.Count; i += 6)
            {
                //Pull the classified out of OSD
                Classified classified = new Classified();
                classified.FromOSD((OSDMap)OSDParser.DeserializeJson(retVal[i + 5]));

                replyData = new DirClassifiedReplyData
                {
                    classifiedFlags = classified.ClassifiedFlags,
                    classifiedID    = classified.ClassifiedUUID,
                    creationDate    = classified.CreationDate,
                    expirationDate  = classified.ExpirationDate,
                    price           = classified.PriceForListing,
                    name            = classified.Name
                };
                //Check maturity levels
                if ((replyData.classifiedFlags & (uint)DirectoryManager.ClassifiedFlags.Mature) == (uint)DirectoryManager.ClassifiedFlags.Mature)
                {
                    if ((queryFlags & (uint)DirectoryManager.ClassifiedQueryFlags.Mature) == (uint)DirectoryManager.ClassifiedQueryFlags.Mature)
                    {
                        Data.Add(replyData);
                    }
                }
                else
                { //Its PG, add all
                    Data.Add(replyData);
                }
            }
            return(Data.ToArray());
        }
        /// <summary>
        /// Searches for classifieds
        /// </summary>
        /// <param name="queryText"></param>
        /// <param name="category"></param>
        /// <param name="queryFlags"></param>
        /// <param name="StartQuery"></param>
        /// <returns></returns>
        public DirClassifiedReplyData[] FindClassifieds(string queryText, string category, string queryFlags, int StartQuery)
        {
            List <DirClassifiedReplyData> Data = new List <DirClassifiedReplyData>();

            string whereClause      = "";
            string classifiedClause = "";
            uint   cqf = uint.Parse(queryFlags);

            if (int.Parse(category) != (int)DirectoryManager.ClassifiedCategories.Any) //Check the category
            {
                classifiedClause = " and Category = '" + category + "'";
            }

            whereClause = " Name LIKE '%" + queryText + "%'" + classifiedClause + " LIMIT " + StartQuery.ToString() + ",50 ";
            List <string> retVal = GD.Query(whereClause, "userclassifieds", "*");

            if (retVal.Count == 0)
            {
                return(Data.ToArray());
            }

            DirClassifiedReplyData replyData = null;

            for (int i = 0; i < retVal.Count; i += 6)
            {
                //Pull the classified out of OSD
                Classified classified = new Classified();
                classified.FromOSD((OSDMap)OSDParser.DeserializeJson(retVal[i + 5]));

                replyData = new DirClassifiedReplyData();
                replyData.classifiedFlags = classified.ClassifiedFlags;
                replyData.classifiedID    = classified.ClassifiedUUID;
                replyData.creationDate    = classified.CreationDate;
                replyData.expirationDate  = classified.ExpirationDate;
                replyData.price           = classified.PriceForListing;
                replyData.name            = classified.Name;
                //Check maturity levels
                if ((replyData.classifiedFlags & (uint)DirectoryManager.ClassifiedFlags.Mature) == (uint)DirectoryManager.ClassifiedFlags.Mature)
                {
                    if ((cqf & (uint)DirectoryManager.ClassifiedQueryFlags.Mature) == (uint)DirectoryManager.ClassifiedQueryFlags.Mature)
                    {
                        Data.Add(replyData);
                    }
                }
                else //Its PG, add all
                {
                    Data.Add(replyData);
                }
            }
            return(Data.ToArray());
        }
        public byte[] AddClassified(OSDMap request)
        {
            Classified info = new Classified();

            info.FromOSD((OSDMap)request["Classified"]);

            ProfileConnector.AddClassified(info);

            string xmlString = OSDParser.SerializeJsonString(new OSDMap());
            //MainConsole.Instance.DebugFormat("[AuroraDataServerPostHandler]: resp string: {0}", xmlString);
            UTF8Encoding encoding = new UTF8Encoding();

            return(encoding.GetBytes(xmlString));
        }
        public Classified GetClassified(UUID queryClassifiedID)
        {
            List <string> query = GD.Query(new string[1] {
                "ClassifiedUUID"
            }, new object[1] {
                queryClassifiedID
            }, "userclassifieds", "*");

            if (query.Count < 6)
            {
                return(null);
            }
            Classified classified = new Classified();

            classified.FromOSD((OSDMap)OSDParser.DeserializeJson(query[5]));
            return(classified);
        }
        public List <Classified> GetClassifieds(UUID ownerID)
        {
            List <Classified> classifieds = new List <Classified> ();
            List <string>     query       = GD.Query(new string[1] {
                "OwnerUUID"
            }, new object[1] {
                ownerID
            }, "userclassifieds", "*");

            for (int i = 0; i < query.Count; i += 6)
            {
                Classified classified = new Classified();
                classified.FromOSD((OSDMap)OSDParser.DeserializeJson(query[i + 5]));
                classifieds.Add(classified);
            }
            return(classifieds);
        }
Beispiel #11
0
        public Classified GetClassified(UUID queryClassifiedID)
        {
            Dictionary <string, object> where = new Dictionary <string, object>(1);
            where["ClassifiedUUID"]           = queryClassifiedID;

            List <string> query = GD.Query(new string[1] {
                "*"
            }, "userclassifieds", new QueryFilter
            {
                andFilters = where
            }, null, null, null);

            if (query.Count < 6)
            {
                return(null);
            }
            Classified classified = new Classified();

            classified.FromOSD((OSDMap)OSDParser.DeserializeJson(query[5]));
            return(classified);
        }
        /// <summary>
        /// Gets all classifieds in the given region
        /// </summary>
        /// <param name="regionName"></param>
        /// <returns></returns>
        public Classified[] GetClassifiedsInRegion(string regionName)
        {
            List <Classified> Classifieds = new List <Classified>();
            List <string>     retVal      = GD.Query("SimName", regionName, "userclassifieds", "*");

            if (retVal.Count == 0)
            {
                return(Classifieds.ToArray());
            }

            Classified classified = new Classified();

            for (int i = 0; i < retVal.Count; i += 6)
            {
                //Pull the classified out of OSD
                classified.FromOSD((OSDMap)OSDParser.DeserializeJson(retVal[i + 5]));
                Classifieds.Add(classified);
                classified = new Classified();
            }
            return(Classifieds.ToArray());
        }
Beispiel #13
0
        public List <Classified> GetClassifieds(UUID ownerID)
        {
            Dictionary <string, object> where = new Dictionary <string, object>(1);
            where["OwnerUUID"] = ownerID;

            List <string> query = GD.Query(new string[1] {
                "*"
            }, "userclassifieds", new QueryFilter
            {
                andFilters = where
            }, null, null, null);

            List <Classified> classifieds = new List <Classified>();

            for (int i = 0; i < query.Count; i += 6)
            {
                Classified classified = new Classified();
                classified.FromOSD((OSDMap)OSDParser.DeserializeJson(query[i + 5]));
                classifieds.Add(classified);
            }
            return(classifieds);
        }
Beispiel #14
0
 public List <Classified> GetClassifieds(UUID ownerID)
 {
     try
     {
         List <string> serverURIs =
             m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf(ownerID.ToString(),
                                                                                     "RemoteServerURI");
         foreach (string url in serverURIs)
         {
             OSDMap map = new OSDMap();
             map["Method"]      = "getclassifieds";
             map["PrincipalID"] = ownerID;
             OSDMap response = WebUtils.PostToService(url + "osd", map, true, true);
             if (response["_Result"].Type == OSDType.Map)
             {
                 OSDMap responsemap = (OSDMap)response["_Result"];
                 if (responsemap.ContainsKey("Result"))
                 {
                     List <Classified> list  = new List <Classified>();
                     OSDArray          picks = (OSDArray)responsemap["Result"];
                     foreach (OSD o in picks)
                     {
                         Classified info = new Classified();
                         info.FromOSD((OSDMap)o);
                         list.Add(info);
                     }
                     return(list);
                 }
                 return(new List <Classified>());
             }
         }
     }
     catch (Exception e)
     {
         MainConsole.Instance.DebugFormat("[AuroraRemoteProfileConnector]: Exception when contacting server: {0}", e);
     }
     return(null);
 }
        public List<Classified> GetClassifieds(UUID ownerID)
        {
            object remoteValue = DoRemote(ownerID);
            if (remoteValue != null || m_doRemoteOnly)
                return (List<Classified>) remoteValue;

            QueryFilter filter = new QueryFilter();
            filter.andFilters["OwnerUUID"] = ownerID;

            List<string> query = GD.Query(new[] {"*"}, "userclassifieds", filter, null, null, null);

            List<Classified> classifieds = new List<Classified>();
            for (int i = 0; i < query.Count; i += 9)
            {
                Classified classified = new Classified();
                classified.FromOSD((OSDMap) OSDParser.DeserializeJson(query[i + 6]));
                classifieds.Add(classified);
            }
            return classifieds;
        }
        public Classified GetClassified(UUID queryClassifiedID)
        {
            object remoteValue = DoRemote(queryClassifiedID);
            if (remoteValue != null || m_doRemoteOnly)
                return (Classified) remoteValue;

            QueryFilter filter = new QueryFilter();
            filter.andFilters["ClassifiedUUID"] = queryClassifiedID;

            List<string> query = GD.Query(new[] {"*"}, "userclassifieds", filter, null, null, null);

            if (query.Count < 9)
            {
                return null;
            }
            Classified classified = new Classified();
            classified.FromOSD((OSDMap) OSDParser.DeserializeJson(query[6]));
            return classified;
        }