Example #1
0
        // return:
        //      -1  出错
        //      0   没有找到
        //      1   找到
        public int GetRecord(
            OpacApplication app,
            SessionInfo sessioninfo,
            LibraryChannel channel_param,
            string strRecPath,
            out string strXml,
            out byte[] timestamp,
            out string strError)
        {
            strError = "";
            timestamp = null;
            strXml = "";

            LibraryChannel channel = null;

            if (channel_param != null)
                channel = channel_param;
            else
                channel = sessioninfo.GetChannel(true);
            try
            {
                string strOutputPath = "";
                string strBiblio = "";
                string strBiblioRecPath = "";
                // return:
                //      -1  出错
                //      0   没有找到
                //      1   找到
                //      >1  命中多于1条
                long lRet = // sessioninfo.Channel.
                    channel.GetCommentInfo(
    null,
    "@path:" + strRecPath,
                    // null,
    "xml", // strResultType
    out strXml,
    out strOutputPath,
    out timestamp,
    "recpath",  // strBiblioType
    out strBiblio,
    out strBiblioRecPath,
    out strError);
                if (lRet == -1)
                {
                    strError = "获取评注记录 '" + strRecPath + "' 时出错: " + strError;
                    return -1;
                }
                if (lRet == 0)
                {
                    strError = "评注记录 '" + strRecPath + "' 没有找到";
                    return 0;
                }

                m_strXml = strXml;
                m_timestamp = timestamp;
                return 1;
            }
            finally
            {
                if (channel_param == null)
                    sessioninfo.ReturnChannel(channel);
            }
        }
Example #2
0
     public static long GetServerResultCount(
 SessionInfo sessioninfo,
 string strResultsetName)
     {
         LibraryChannel channel = sessioninfo.GetChannel(true);
         try
         {
             string strError = "";
             Record[] searchresults = null;
             long lRet = // sessioninfo.Channel.
                 channel.GetSearchResult(
                 null,
                 strResultsetName,
                 0,
                 0,
                 "id",
                 "zh",
                 out searchresults,
                 out strError);
             return lRet;
         }
         finally
         {
             sessioninfo.ReturnChannel(channel);
         }
     }