예제 #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="patronBarcode"></param>
        /// <param name="itemBarcode"></param>
        /// <param name="error"></param>
        /// <returns>
        /// 1 续借成功
        /// 0 续借失败
        /// -1 出错
        /// -2 尚未登录,需要自动测试中断
        /// </returns>
        public int Renew(string patronBarcode,
                         string itemBarcode,
                         out RenewResponse_30 response30,
                         out string responseText,
                         out string error)
        {
            error = "";
            int nRet = 0;

            responseText = "";
            response30   = null;

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

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

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

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

            response30 = response as RenewResponse_30;
            if (response30 == null)
            {
                error = "返回的不是30消息";
                return(-1);
            }

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

            if (response30.Ok_1 == "0")
            {
                return(0);
            }

            return(1);
        }
예제 #2
0
파일: SipChannel.cs 프로젝트: zgren/dp2
        // 续借
        // return.Value
        //      -1  出错
        //      0   请求失败
        //      1   请求成功
        public async Task <RenewResult> RenewAsync(string patronBarcode,
                                                   string itemBarcode)
        {
            Renew_29 request = new Renew_29()
            {
                TransactionDate_18    = SIPUtility.NowDateTime,
                AO_InstitutionId_r    = SIPConst.AO_Value,
                AA_PatronIdentifier_r = patronBarcode,
                AB_ItemIdentifier_o   = itemBarcode,
            };

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

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

            var result = await SendAndRecvAsync(requestText);

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

            var response30 = result.Response as RenewResponse_30;

            if (response30 == null)
            {
                return(new RenewResult
                {
                    Value = -1,
                    ErrorInfo = "返回的不是30消息"
                });
            }

            return(new RenewResult
            {
                Value = response30.Ok_1 == "0" ? 0 : 1,
                ErrorInfo = response30.AF_ScreenMessage_o,
                Result = response30
            });
        }