예제 #1
0
        /// <summary>
        /// 获取读者信息
        /// </summary>
        /// <param name="patronBarcode"></param>
        /// <param name="error"></param>
        /// <returns>
        /// -1 出错
        /// 0 成功
        /// </returns>
        public int GetPatronInformation(string patronBarcode,
                                        out PatronInformationResponse_64 response64,
                                        out string responseText,
                                        out string error)
        {
            error = "";
            int nRet = 0;

            responseText = "";
            response64   = null;

            PatronInformation_63 request = new PatronInformation_63()
            {
                TransactionDate_18    = SIPUtility.NowDateTime,
                AO_InstitutionId_r    = SIPConst.AO_Value,
                AA_PatronIdentifier_r = patronBarcode,
            };

            request.SetDefaulValue();//设置其它默认值

            // 发送和接收消息
            string      requestText = request.ToText();
            BaseMessage response    = null;

            nRet = SendAndRecvMessage(requestText,
                                      out response,
                                      out responseText,
                                      out error);
            if (nRet == -1)
            {
                return(-1);
            }

            response64 = response as PatronInformationResponse_64;
            if (response64 == null)
            {
                error = "返回的不是64消息";
                return(-1);
            }

            //if (this.IsLogin == false)
            //{
            //    error = "尚未登录ASC系统";
            //    return -2;
            //}

            return(0);
        }
예제 #2
0
파일: SipChannel.cs 프로젝트: zgren/dp2
        public async Task <GetPatronInfoResult> GetPatronInfoAsync(string patronBarcode)
        {
            PatronInformation_63 request = new PatronInformation_63()
            {
                TransactionDate_18    = SIPUtility.NowDateTime,
                AO_InstitutionId_r    = SIPConst.AO_Value,
                AA_PatronIdentifier_r = patronBarcode,
            };

            request.SetDefaulValue();//设置其它默认值

            // 发送和接收消息
            string requestText = request.ToText();

            var result = await SendAndRecvAsync(requestText);

            if (result.Value == -1)
            {
                return(new GetPatronInfoResult
                {
                    Value = -1,
                    ErrorInfo = result.ErrorInfo,
                    ErrorCode = result.ErrorCode
                });
            }

            var response64 = result.Response as PatronInformationResponse_64;

            if (response64 == null)
            {
                return(new GetPatronInfoResult
                {
                    Value = -1,
                    ErrorInfo = "返回的不是64消息"
                });
            }

            return(new GetPatronInfoResult
            {
                Value = 0,
                Result = response64
            });
        }