示例#1
0
        // 2012/8/31
        //
        // return:
        //      -1  出错
        //      0   没有装载
        //      1   已经装载
        /// <summary>
        /// 装入订购记录
        /// </summary>
        /// <param name="strOrderRecPath">订购记录路径</param>
        /// <param name="strRefID">返回参考 ID</param>
        /// <param name="strError">返回出错信息</param>
        /// <returns>-1: 出错; 0: 没有装载; 1: 已经装载</returns>
        public int LoadOrderRecord(string strOrderRecPath,
                                   out string strRefID,
                                   out string strError)
        {
            strError = "";
            strRefID = "";

            this.ClearOrders();

            string strOutputBiblioRecPath = "";

            byte[] order_timestamp       = null;
            string strOutputOrderRecPath = "";
            string strResult             = "";
            string strBiblio             = "";

            long lRet = Channel.GetOrderInfo(
                Stop,
                "@path:" + strOrderRecPath,
                "xml",
                out strResult,
                out strOutputOrderRecPath,
                out order_timestamp,
                "recpath",
                out strBiblio,
                out strOutputBiblioRecPath,
                out strError);

            if (lRet == 0 || lRet == -1)
            {
                return(-1);
            }

            this.BiblioRecPath = strOutputBiblioRecPath;

            OneOrder order = new OneOrder();
            int      nRet  = order.LoadRecord(
                strOutputOrderRecPath,
                strResult,
                out strError);

            if (nRet == -1)
            {
                strError = "路径为 '" + strOutputOrderRecPath + "' 的订购记录用于初始化OneOrder对象时发生错误: " + strError;
                return(-1);
            }

            string strState = DomUtil.GetElementText(order.Dom.DocumentElement, "state");

            if (strState == "已订购" || strState == "已验收")
            {
            }
            else
            {
                strError = "订购记录 '" + strOutputOrderRecPath + "' 的状态不是 已订购 或 已验收,被跳过";
                return(0);
            }


            this.Orders.Add(order);

            strRefID = DomUtil.GetElementText(order.Dom.DocumentElement, "refID");
            return(1);
        }
示例#2
0
        // 装入订购记录
        // return:
        //      -1  出错
        //      0   没有装载
        //      1   已经装载
        public int LoadOrderRecords(string strBiblioRecPath,
                                    out string strError)
        {
            this.BiblioRecPath = strBiblioRecPath;
            this.ClearOrders();

            try
            {
                // string strHtml = "";
                long lStart       = 0;
                long lResultCount = 0;
                long lCount       = -1;

                // 2012/5/9 改写为循环方式
                for (; ;)
                {
                    EntityInfo[] orders = null;

                    long lRet = Channel.GetOrders(
                        stop,
                        strBiblioRecPath,
                        lStart,
                        lCount,
                        "",
                        "zh",
                        out orders,
                        out strError);
                    if (lRet == -1)
                    {
                        goto ERROR1;
                    }

                    if (lRet == 0)
                    {
                        return(0);
                    }

                    lResultCount = lRet;

                    Debug.Assert(orders != null, "");

                    for (int i = 0; i < orders.Length; i++)
                    {
                        if (orders[i].ErrorCode != ErrorCodeValue.NoError)
                        {
                            strError = "路径为 '" + orders[i].OldRecPath + "' 的订购记录装载中发生错误: " + orders[i].ErrorInfo;  // NewRecPath
                            return(-1);
                        }

                        OneOrder order = new OneOrder();
                        int      nRet  = order.LoadRecord(
                            orders[i].OldRecPath,
                            orders[i].OldRecord,
                            out strError);
                        if (nRet == -1)
                        {
                            strError = "路径为 '" + orders[i].OldRecPath + "' 的订购记录用于初始化OneOrder对象时发生错误: " + strError;
                            return(-1);
                        }

                        this.Orders.Add(order);
                    }

                    lStart += orders.Length;
                    if (lStart >= lResultCount)
                    {
                        break;
                    }
                }
            }
            finally
            {
                /*
                 * stop.EndLoop();
                 * stop.OnStop -= new StopEventHandler(this.DoStop);
                 * stop.Initial("");
                 * */
            }

            return(1);

ERROR1:
            return(-1);
        }