Пример #1
0
        public string SearchWorldCatMulti(string[] query, oclc_api_search.Query_Type[] qtype, string sconditional)
        {
            string sindex = "";
            //http://www.worldcat.org/webservices/catalog/search/sru?query=srw.su%3D%22globalization%22&sortKeys=Date,,0&wskey=[key]

            for (int x = 0; x < query.Length; x++)
            {
                switch (qtype[x])
                {
                    case Query_Type.keyword:
                        sindex += "srw.kw=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                    case Query_Type.author:
                        sindex += "srw.au=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                    case Query_Type.subject:
                        sindex += "srw.su=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                    case Query_Type.title:
                        sindex += "srw.ti=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                    case Query_Type.isbn:
                        sindex += "srw.bn=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                    case Query_Type.issn:
                        sindex += "srw.in=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                    case Query_Type.oclc:
                        sindex += "srw.no=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                    default:
                        sindex += "srw.kw=\"" + query[x] + "\" " + sconditional + " ";
                        break;
                }
            }

            sindex = sindex.Substring(0, sindex.Length - (" " + sconditional + " ").Length);
            sindex = System.Uri.EscapeDataString(sindex);
            string url = OCLC_WORLDCAT_URL.Replace("{query}", sindex).Replace("{wskey}", wskey);

            string xml = helpers.MakeOpenHTTPRequest(url, SetProxy, "GET");
            if (xml == null || xml == "")
            {
                return null;
            }
            else
            {
                return xml;
            }
        }
Пример #2
0
        public string SearchWorldCat(string query, oclc_api_search.Query_Type qtype)
        {
            string sindex = "srw.keyword";
            //http://www.worldcat.org/webservices/catalog/search/sru?query=srw.su%3D%22globalization%22&sortKeys=Date,,0&wskey=[key]
            switch (qtype)
            {
                case Query_Type.keyword:
                    sindex = System.Uri.EscapeDataString("srw.kw=\"" + query + "\"");
                    break;
                case Query_Type.author:
                    sindex = System.Uri.EscapeDataString("srw.au=\"" + query + "\"");
                    break;
                case Query_Type.subject:
                    sindex = System.Uri.EscapeDataString("srw.su=\"" + query + "\"");
                    break;
                case Query_Type.title:
                    sindex = System.Uri.EscapeDataString("srw.ti=\"" + query + "\"");
                    break;
                case Query_Type.isbn:
                    sindex = System.Uri.EscapeDataString("srw.bn=\"" + query + "\"");
                    break;
                case Query_Type.issn:
                    sindex = System.Uri.EscapeDataString("srw.in=\"" + query + "\"");
                    break;
                case Query_Type.oclc:
                    sindex = System.Uri.EscapeDataString("srw.no=\"" + query + "\"");
                    break;
                default:
                    sindex = System.Uri.EscapeDataString("srw.kw=\"" + query + "\"");
                    break;
            }

            string url = OCLC_WORLDCAT_URL.Replace("{query}", sindex).Replace("{wskey}", wskey);
            string xml = helpers.MakeHTTPRequest(url, SetProxy);
            if (xml == null || xml == "")
            {
                return null;
            }
            else
            {
                return xml;
            }
        }