示例#1
0
        public SetReaderInfoResult SetPatron(string libId,
                                             string userName,
                                             string opeType,
                                             string recPath,
                                             string timestamp,
                                             string weixinId,
                                             SimplePatron patron)
        {
            SetReaderInfoResult result = new SetReaderInfoResult();
            string strError            = "";

            string outputRecPath   = "";
            string outputTimestamp = "";

            WxUserItem userItem = null;
            int        nRet     = dp2WeiXinService.Instance.SetReaderInfo(libId,
                                                                          userName,
                                                                          opeType,
                                                                          recPath,
                                                                          timestamp,
                                                                          weixinId,
                                                                          patron,
                                                                          out outputRecPath,
                                                                          out outputTimestamp,
                                                                          out userItem,
                                                                          out strError);

            if (nRet == -1)
            {
                result.errorCode = -1;
                result.errorInfo = strError;
                return(result);
            }

            // 返回读者路径和时间戳
            result.recPath   = outputRecPath;
            result.timestamp = outputTimestamp;

            // 如果是读者自助注册过来的,需要把注册的这个帐户设置为当前帐户
            // reregister不需要设置活动帐户,因为当前帐户就是他本身。
            if (opeType == "register")
            {
                result.info = userItem.readerBarcode;

                nRet = ApiHelper.ActiveUser(userItem, out strError);
                if (nRet == -1)
                {
                    result.errorInfo = strError;
                    return(result);
                }
            }
            return(result);
        }
示例#2
0
        /// <summary>
        /// 获取读者信息
        /// </summary>
        /// <param name="libId">图书馆id</param>
        /// <param name="userName">用户名</param>
        /// <param name="patronBarcode">读者证条码</param>
        /// <returns></returns>
        public SetReaderInfoResult GetPatron(string libId,
                                             string userName,
                                             string patronBarcode)
        {
            SetReaderInfoResult result = new SetReaderInfoResult();

            string strError  = "";
            string recPath   = "";
            string timestamp = "";

            LoginInfo loginInfo = new LoginInfo(userName, false);

            string strXml = "";
            int    nRet   = dp2WeiXinService.Instance.GetPatronXml(libId,
                                                                   loginInfo,
                                                                   patronBarcode,
                                                                   "xml,timestamp",
                                                                   out recPath,
                                                                   out timestamp,
                                                                   out strXml,
                                                                   out strError);

            if (nRet == -1 || nRet == 0)
            {
                result.errorCode = -1;
                result.errorInfo = strError;
            }

            result.recPath   = recPath;
            result.timestamp = timestamp;

            int    showPhoto = 0;
            Patron patron    = dp2WeiXinService.Instance.ParsePatronXml(libId,
                                                                        strXml,
                                                                        recPath,
                                                                        showPhoto,
                                                                        true);

            result.obj = patron;

            return(result);
        }
示例#3
0
        public SetReaderInfoResult SetPatron(string libId,
                                             string userName,
                                             string action,
                                             string recPath,
                                             string timestamp,
                                             SimplePatron patron,
                                             bool bMergeInfo)
        {
            SetReaderInfoResult result = new SetReaderInfoResult();

            string strError = "";

            string outputRecPath   = "";
            string outputTimestamp = "";

            int nRet = dp2WeiXinService.Instance.SetReaderInfo(libId,
                                                               userName,
                                                               action,
                                                               recPath,
                                                               timestamp,
                                                               patron,
                                                               bMergeInfo,
                                                               out outputRecPath,
                                                               out outputTimestamp,
                                                               out strError);

            if (nRet == -1)
            {
                result.errorCode = -1;
                result.errorInfo = strError;
            }



            result.recPath   = outputRecPath;
            result.timestamp = outputTimestamp;


            return(result);
        }