Exemple #1
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            string strError = "";

            OperLogFilenames.Clear();

            string strStartDate = "";

            if (this.dateControl_start.IsValueNull() == false)
            {
                strStartDate = DateTimeUtil.DateTimeToString8(this.dateControl_start.Value);
            }

            string strEndDate = "";

            if (this.dateControl_end.IsValueNull() == false)
            {
                strEndDate = DateTimeUtil.DateTimeToString8(this.dateControl_end.Value);
            }

            if (String.IsNullOrEmpty(strEndDate) == true &&
                String.IsNullOrEmpty(strStartDate) == true)
            {
                strError = "尚未指定时间";
                goto ERROR1;
            }

            if (String.IsNullOrEmpty(strEndDate) == true)
            {
                OperLogFilenames.Add(strStartDate + ".log");
                goto END1;
            }

            if (String.IsNullOrEmpty(strStartDate) == true)
            {
                OperLogFilenames.Add(strEndDate + ".log");
                goto END1;
            }

            string        strWarning   = "";
            List <string> LogFileNames = null;
            // 根据日期范围,发生日志文件名
            // parameters:
            //      strStartDate    起始日期。8字符
            //      strEndDate  结束日期。8字符
            // return:
            //      -1  错误
            //      0   成功
            int nRet = OperLogLoader.MakeLogFileNames(strStartDate,
                                                      strEndDate,
                                                      true,
                                                      out LogFileNames,
                                                      out strWarning,
                                                      out strError);

            if (nRet == -1)
            {
                goto ERROR1;
            }

            if (String.IsNullOrEmpty(strWarning) == false)
            {
                MessageBox.Show(this, strWarning);
            }

            this.OperLogFilenames = LogFileNames;

END1:
            this.DialogResult = DialogResult.OK;
            this.Close();
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Exemple #2
0
        // const int INSERT_BATCH = 100;  // 300;



        // 根据日志文件创建本地 operlogxxx 表
        int DoCreateOperLogTable(
            long lProgressStart,
            string strStartDate,
            string strEndDate,
            out string strLastDate,
            out long lLastIndex,
            out string strError)
        {
            strError = "";
            strLastDate = "";
            lLastIndex = 0;

            int nRet = 0;

            // strEndDate 里面可能会包含 ":0-99" 这样的附加成分
            string strLeft = "";
            string strEndRange = "";
            StringUtil.ParseTwoPart(strEndDate,
                ":",
                out strLeft,
                out strEndRange);
            strEndDate = strLeft;

            string strStartRange = "";
            StringUtil.ParseTwoPart(strStartDate,
                ":",
                out strLeft,
                out strStartRange);
            strStartDate = strLeft;

            // TODO: start 和 end 都有 range,而且 start 和 end 是同一天怎么办?

            // 删除不必要的索引
            {
                this._connectionString = GetOperlogConnectionString();  //  SQLiteUtil.GetConnectionString(this.MainForm.UserDir, "operlog.bin");

                foreach (string type in OperLogTable.DbTypes)
                {
                    nRet = OperLogTable.DeleteAdditionalIndex(
                        type,
                        this._connectionString,
                        out strError);
                    if (nRet == -1)
                        return -1;
                }
            }

            List<string> filenames = null;

            string strWarning = "";

            // 根据日期范围,发生日志文件名
            // parameters:
            //      strStartDate    起始日期。8字符
            //      strEndDate  结束日期。8字符
            // return:
            //      -1  错误
            //      0   成功
            nRet = OperLogStatisForm.MakeLogFileNames(strStartDate,
                strEndDate,
                true,  // true,
                out filenames,
                out strWarning,
                out strError);
            if (nRet == -1)
                return -1;

            if (String.IsNullOrEmpty(strWarning) == false)
                MessageBox.Show(this, strWarning);

            if (filenames.Count > 0 && string.IsNullOrEmpty(strEndRange) == false)
            {
                filenames[filenames.Count - 1] = filenames[filenames.Count - 1] + ":" + strEndRange;
            }
            if (filenames.Count > 0 && string.IsNullOrEmpty(strStartRange) == false)
            {
                filenames[0] = filenames[0] + ":" + strStartRange;
            }

            this.Channel.Timeout = new TimeSpan(0, 1, 0);   // 一分钟

            using (SQLiteConnection connection = new SQLiteConnection(this._connectionString))
            {
                connection.Open();

                ProgressEstimate estimate = new ProgressEstimate();

                OperLogLoader loader = new OperLogLoader();
                loader.Channel = this.Channel;
                loader.Stop = this.Progress;
                // loader.owner = this;
                loader.estimate = estimate;
                loader.FileNames = filenames;
                loader.nLevel = 2;  //  this.MainForm.OperLogLevel;
                loader.AutoCache = false;
                loader.CacheDir = "";
                loader.Filter = "borrow,return,setReaderInfo,setBiblioInfo,setEntity,setOrder,setIssue,setComment,amerce,passgate,getRes";

                loader.ProgressStart = lProgressStart;

                loader.Prompt -= new MessagePromptEventHandler(loader_Prompt);
                loader.Prompt += new MessagePromptEventHandler(loader_Prompt);

                // List<OperLogLine> circu_lines = new List<OperLogLine>();
                MultiBuffer buffer = new MultiBuffer();
                buffer.Initial();
                OperLogLineBase.MainForm = this.MainForm;

                try
                {
                    int nRecCount = 0;
                    foreach (OperLogItem item in loader)
                    {
                        string strXml = item.Xml;

                        if (string.IsNullOrEmpty(strXml) == true)
                        {
                            nRecCount++;
                            continue;
                        }

                        {
                            XmlDocument dom = new XmlDocument();
                            try
                            {
                                dom.LoadXml(strXml);
                            }
                            catch (Exception ex)
                            {
                                strError = item.Date + " 中偏移为 " + item.Index.ToString() + " 的日志记录 XML 装载到 DOM 时出错: " + ex.Message;
                                DialogResult result = MessageBox.Show(this,
strError + "\r\n\r\n是否跳过此条记录继续处理?",
"ReportForm",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1);
                                if (result == DialogResult.No)
                                    return -1;
                                continue;
                            }

                            string strOperation = DomUtil.GetElementText(dom.DocumentElement, "operation");
#if NO
                                if (strOperation != "borrow" && strOperation != "return")
                                {
                                    nRecCount++;
                                    continue;
                                }
#endif
                            nRet = buffer.AddLine(
                                strOperation,
                                dom,
                                item.Date,
                                item.Index,
                                out strError);
                            if (nRet == -1)
                                return -1;
                            // -2 不要报错
                        }

                        bool bForce = false;
                        if (nRecCount >= 4000)
                            bForce = true;
                        nRet = buffer.WriteToDb(connection,
                            true,
                            bForce,
                            out strError);
                        if (bForce == true)
                        {
                            strLastDate = item.Date;
                            lLastIndex = item.Index + 1;
                            nRecCount = 0;
                        }
                        nRecCount++;
#if NO
                            if (circu_lines.Count >= INSERT_BATCH
    || (circu_lines.Count > 0 && nCircuRecCount >= 1000))
                            {
                                // 写入数据库一次
                                nRet = OperLogLine.AppendOperLogLines(
                                    connection,
                                    circu_lines,
                                    true,
                                    out strError);
                                if (nRet == -1)
                                    return -1;
                                circu_lines.Clear();

                                strLastDate = item.Date;
                                lLastIndex = item.Index + 1;
                                nCircuRecCount = 0;
                            }

                            nCircuRecCount++;
#endif

                    }
                }
                catch (Exception ex)
                {
                    strError = ExceptionUtil.GetDebugText(ex);
                    return -1;
                }

#if NO
                    if (circu_lines.Count > 0)
                    {
                        // 写入数据库一次
                        nRet = OperLogLine.AppendOperLogLines(
                            connection,
                            circu_lines,
                            true,
                            out strError);
                        if (nRet == -1)
                            return -1;

                        // 表示处理完成
                        strLastDate = "";
                        lLastIndex = 0;
                    }
#endif
                nRet = buffer.WriteToDb(connection,
                    true,
                    true,   // false,
                    out strError);
                if (nRet == -1)
                    return -1;

                // 表示处理完成
                strLastDate = "";
                lLastIndex = 0;
            }

            return 0;
        }
Exemple #3
0
        // 对每个日志文件,每个日志记录进行循环
        // return:
        //      0   普通返回
        //      1   要全部中断
        int DoLoop(
            OperLogForm.Delegate_doRecord procDoRecord,
            out string strError)
        {
            strError = "";
            int nRet = 0;
            // long lRet = 0;

            List <string> LogFileNames = null;

            // TODO: 是否需要检查起止日期是否为空值?空值是警告还是就当作今天?

            string strStartDate = DateTimeUtil.DateTimeToString8(this.dateControl_start.Value);
            string strEndDate   = DateTimeUtil.DateTimeToString8(this.dateControl_end.Value);

            string strWarning = "";

            // 根据日期范围,发生日志文件名
            // parameters:
            //      strStartDate    起始日期。8字符
            //      strEndDate  结束日期。8字符
            // return:
            //      -1  错误
            //      0   成功
            nRet = OperLogLoader.MakeLogFileNames(strStartDate,
                                                  strEndDate,
                                                  true,
                                                  out LogFileNames,
                                                  out strWarning,
                                                  out strError);
            if (nRet == -1)
            {
                return(-1);
            }

            if (String.IsNullOrEmpty(strWarning) == false)
            {
                MessageBox.Show(this, strWarning);
            }

            string strStyle = "";

            if (Program.MainForm.AutoCacheOperlogFile == true)
            {
                strStyle = "autocache";
            }

            ProgressEstimate estimate = new ProgressEstimate();

            nRet = OperLogForm.ProcessFiles(this,
                                            stop,
                                            estimate,
                                            Channel,
                                            LogFileNames,
                                            Program.MainForm.OperLogLevel,
                                            strStyle,
                                            "",           // strFilter
                                            Program.MainForm.OperLogCacheDir,
                                            null,         // param,
                                            procDoRecord, // DoRecord,
                                            out strError);
            if (nRet == -1)
            {
                return(-1);
            }

            return(nRet);
        }
Exemple #4
0
        // 对每个日志文件,每个日志记录进行循环
        // return:
        //      0   普通返回
        //      1   要全部中断
        int DoTask1Loop(out string strError)
        {
            strError = "";
            int nRet = 0;
            // long lRet = 0;

            List<string> LogFileNames = null;

            // TODO: 是否需要检查起止日期是否为空值?空值是警告还是就当作今天?

            string strStartDate = DateTimeUtil.DateTimeToString8(this.dateControl_start.Value);
            string strEndDate = DateTimeUtil.DateTimeToString8(this.dateControl_end.Value);

            string strWarning = "";

            // 根据日期范围,发生日志文件名
            // parameters:
            //      strStartDate    起始日期。8字符
            //      strEndDate  结束日期。8字符
            // return:
            //      -1  错误
            //      0   成功
            nRet = MakeLogFileNames(strStartDate,
                strEndDate,
                true,
                out LogFileNames,
                out strWarning,
                out strError);
            if (nRet == -1)
                return -1;

            if (String.IsNullOrEmpty(strWarning) == false)
                MessageBox.Show(this, strWarning);

#if NO
            string strStyle = "";
            if (this.MainForm.AutoCacheOperlogFile == true)
                strStyle = "autocache";
#endif

            ProgressEstimate estimate = new ProgressEstimate();

#if NO
            nRet = OperLogForm.ProcessFiles(this,
stop,
estimate,
Channel,
LogFileNames,
this.MainForm.OperLogLevel,
strStyle,
this.MainForm.OperLogCacheDir,
null,   // param,
procDoRecord,   // DoRecord,
out strError);
            if (nRet == -1)
                return -1;
#endif

            OperLogLoader loader = new OperLogLoader();
            loader.Channel = this.Channel;
            loader.Stop = this.Stop;
            loader.owner = this;
            loader.estimate = estimate;
            loader.FileNames = LogFileNames;
            loader.nLevel = this.MainForm.OperLogLevel;
            loader.AutoCache = false;
            loader.CacheDir = "";


            List<OperLogLine> lines = new List<OperLogLine>();

            foreach (OperLogItem item in loader)
            {
                string strXml = item.Xml;

                if (string.IsNullOrEmpty(strXml) == true)
                    continue;

                {
                    XmlDocument dom = new XmlDocument();
                    try
                    {
                        dom.LoadXml(strXml);
                    }
                    catch (Exception ex)
                    {
                        strError = "Load Xml to DOM error: " + ex.Message;
                        return -1;
                    }

                    string strOperation = DomUtil.GetElementText(dom.DocumentElement, "operation");
                    if (strOperation != "borrow" && strOperation != "return")
                        continue;

                    string strAction = DomUtil.GetElementText(dom.DocumentElement, "action");
                    string strOperator = DomUtil.GetElementText(dom.DocumentElement, "operator");

#if NO
                    XmlNode nodeItem = null;
                    string strItemXml = DomUtil.GetElementText(dom.DocumentElement,
                            "itemRecord", out nodeItem);
                    string strItemRecPath = "";
                    if (nodeItem != null)
                        strItemRecPath = DomUtil.GetAttr(nodeItem, "recPath");

                    // 册记录相关的书目记录路径,这个后面统一提取,就不用日志记录中的数据了

#endif
                    XmlNode nodeReader = null;
                    string strReaderXml = DomUtil.GetElementText(dom.DocumentElement,
                            "readerRecord", out nodeReader);
                    string strReaderRecPath = DomUtil.GetAttr(nodeReader, "recPath");
                    string strReaderDbName = Global.GetDbName(strReaderRecPath);
                    // TODO: 根据读者库名获得馆代码
                    string strLibraryCode = "";

                    string strItemBarcode = DomUtil.GetElementText(dom.DocumentElement,
                        "itemBarcode");
                    string strReaderBarcode = DomUtil.GetElementText(dom.DocumentElement,
                        "readerBarcode");
                    string strOperTime = DomUtil.GetElementText(dom.DocumentElement,
                        "operTime");

                    OperLogLine line = new OperLogLine();
                    line.ItemBarcode = strItemBarcode;
                    // 馆藏地点需要另行获得
                    line.ReaderBarcode = strReaderBarcode;
                    line.OperTime = strOperTime;
                    line.LibraryCode = strLibraryCode;

                    lines.Add(line);

                }


                if (lines.Count > 300)
                {
                    // 写入数据库一次

                    lines.Clear();
                }

            }

            if (lines.Count > 0)
            {
                // 写入数据库一次
            }

            return nRet;
        }
Exemple #5
0
        int LoadOperLogs(List<string> dates,
            out string strError)
        {
            strError = "";

            _operLogItems = new List<OperLogData>();
            _operLogTable = new Hashtable();

            EnableControls(false);
            stop.Style = StopStyle.EnableHalfStop;
            stop.OnStop += new StopEventHandler(this.Channel.DoStop);
            stop.Initial("正在装载日志记录 ...");
            stop.BeginLoop();
            try
            {
                ProgressEstimate estimate = new ProgressEstimate();

                OperLogLoader loader = new OperLogLoader();
                loader.Channel = this.Channel;
                loader.Stop = this.Progress;
                loader.estimate = estimate;
                loader.FileNames = dates;
                loader.Level = 2;  // this.MainForm.OperLogLevel;
                loader.AutoCache = false;
                loader.CacheDir = "";

                loader.Prompt -= new MessagePromptEventHandler(loader_Prompt);
                loader.Prompt += new MessagePromptEventHandler(loader_Prompt);

                foreach (OperLogItem item in loader)
                {
                    if (stop != null && stop.State != 0)
                    {
                        strError = "用户中断";
                        return 0;
                    }

                    if (stop != null)
                        stop.SetMessage("正在获取 " + item.Date + " " + item.Index.ToString() + " " + estimate.Text + "...");

                    if (string.IsNullOrEmpty(item.Xml) == true)
                        continue;


                    XmlDocument dom = new XmlDocument();
                    try
                    {
                        dom.LoadXml(item.Xml);
                    }
                    catch (Exception ex)
                    {
                        strError = "日志记录 " + item.Date + " " + item.Index.ToString() + " XML 装入 DOM 的时候发生错误: " + ex.Message;
                        DialogResult result = MessageBox.Show(this,
    strError + "\r\n\r\n是否跳过此条记录继续处理?",
    "ReportForm",
    MessageBoxButtons.YesNo,
    MessageBoxIcon.Question,
    MessageBoxDefaultButton.Button1);
                        if (result == System.Windows.Forms.DialogResult.No)
                            return -1;

                        // 记入日志,继续处理
                        // this.GetErrorInfoForm().WriteHtml(strError + "\r\n");
                        continue;
                    }

                    string strOperation = DomUtil.GetElementText(dom.DocumentElement, "operation");
                    if (strOperation != "borrow" && strOperation != "return")
                        continue;
                    string strAction = DomUtil.GetElementText(dom.DocumentElement,
        "action");
                    string strOperator = DomUtil.GetElementText(dom.DocumentElement,
        "operator");
                    string strOperTime = DomUtil.GetElementText(dom.DocumentElement,
        "operTime");
                    string strItemBarcode = DomUtil.GetElementText(dom.DocumentElement,
"itemBarcode");
                    string strItemRecPath = "";
                    XmlNode node = dom.DocumentElement.SelectSingleNode("itemRecord/@recPath");
                    if (node == null)
                    {
                        strError = "缺乏 itemRecord 元素的 recPath 属性";
                        continue;
                    }
                    else
                        strItemRecPath = node.Value;

                    OperLogData data = (OperLogData)_operLogTable[strItemRecPath];
                    if (data == null)
                    {
                        data = new OperLogData();
                        data.ItemRecPath = strItemRecPath;
                        _operLogItems.Add(data);
                        _operLogTable[strItemRecPath] = data;
                    }

                    data.ItemBarcode = strItemBarcode;
                    data.Action = strAction;
                    data.Operator = strOperator;
                    data.OperTime = SQLiteUtil.GetLocalTime(strOperTime);
                    data.OperCount++;
                }

                return 0;
            }
            catch (Exception ex)
            {
                strError = "获取日志记录的过程中出现异常: " + ex.Message;
                return -1;
            }
            finally
            {
                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.Channel.DoStop);
                stop.Initial("");
                stop.Style = StopStyle.None;

                EnableControls(true);
            }

        }
        // 对每个日志文件,每个日志记录进行循环
        // return:
        //      -1  出错
        //      0   普通返回
        //      1   要全部中断
        int DoLoop(
            OperLogForm.Delegate_doRecord procDoRecord,
            out string strError)
        {
            strError = "";
            int nRet = 0;
            // long lRet = 0;

            List <string> LogFileNames = null;

            // TODO: 是否需要检查起止日期是否为空值?空值是警告还是就当作今天?

            string strStartDate = DateTimeUtil.DateTimeToString8(this.dateControl_start.Value);
            string strEndDate   = DateTimeUtil.DateTimeToString8(this.dateControl_end.Value);


            // 根据日期范围,发生日志文件名
            // parameters:
            //      strStartDate    起始日期。8字符
            //      strEndDate  结束日期。8字符
            // return:
            //      -1  错误
            //      0   成功
            nRet = OperLogLoader.MakeLogFileNames(strStartDate,
                                                  strEndDate,
                                                  true,
                                                  out LogFileNames,
                                                  out string strWarning,
                                                  out strError);
            if (nRet == -1)
            {
                return(-1);
            }

            if (String.IsNullOrEmpty(strWarning) == false)
            {
                MessageBox.Show(this, strWarning);
            }

            string strStyle = "";

            if (Program.MainForm.AutoCacheOperlogFile == true)
            {
                strStyle = "autocache";
            }

            ProgressEstimate estimate = new ProgressEstimate();

            LibraryChannel channel     = this.GetChannel();
            TimeSpan       old_timeout = channel.Timeout;

            channel.Timeout = TimeSpan.FromSeconds(10);
            try
            {
#if NO
                nRet = OperLogForm.ProcessFiles(this,
                                                stop,
                                                estimate,
                                                channel,
                                                LogFileNames,
                                                Program.MainForm.OperLogLevel,
                                                strStyle,
                                                "",           // strFilter
                                                Program.MainForm.OperLogCacheDir,
                                                null,         // param,
                                                procDoRecord, // DoRecord,
                                                out strError);
                if (nRet == -1)
                {
                    return(-1);
                }

                return(nRet);
#endif
                bool bAccessLog = StringUtil.IsInList("accessLog", strStyle);

                OperLogLoader loader = new OperLogLoader();
                loader.Channel   = channel;
                loader.Stop      = this.Progress;
                loader.Estimate  = estimate;
                loader.Dates     = LogFileNames;
                loader.Level     = Program.MainForm.OperLogLevel;
                loader.AutoCache = StringUtil.IsInList("autocache", strStyle);    // false;
                loader.CacheDir  = Program.MainForm.OperLogCacheDir;
                loader.LogType   = bAccessLog ? LogType.AccessLog : LogType.OperLog;
                // loader.Filter = "borrow,return";

                loader.Prompt -= new MessagePromptEventHandler(loader_Prompt);
                loader.Prompt += new MessagePromptEventHandler(loader_Prompt);

                foreach (OperLogItem item in loader)
                {
                    if (stop != null && stop.State != 0)
                    {
                        strError = "用户中断";
                        return(1);
                    }

                    if (stop != null)
                    {
                        stop.SetMessage("正在获取 " + item.Date + " " + item.Index.ToString() + " " + estimate.Text + "...");
                    }

                    if (string.IsNullOrEmpty(item.Xml) == true)
                    {
                        continue;
                    }

                    nRet = procDoRecord(item.Date + ".log",
                                        item.Xml,
                                        false, // bInCacheFile,
                                        0,
                                        item.Index,
                                        item.AttachmentLength,
                                        null,
                                        out strError);
                    if (nRet == -1)
                    {
                        return(-1);
                    }
                }

                return(0);
            }
            catch (InterruptException ex)
            {
                strError = ex.Message;
                return(1);
            }
            finally
            {
                channel.Timeout = old_timeout;
                this.ReturnChannel(channel);
            }
        }
Exemple #7
0
        // 对每个日志文件,每个日志记录进行循环
        // return:
        //      0   普通返回
        //      1   要全部中断
        int DoTask1Loop(out string strError)
        {
            strError = "";
            int nRet = 0;
            // long lRet = 0;

            List <string> LogFileNames = null;

            // TODO: 是否需要检查起止日期是否为空值?空值是警告还是就当作今天?

            string strStartDate = DateTimeUtil.DateTimeToString8(this.dateControl_start.Value);
            string strEndDate   = DateTimeUtil.DateTimeToString8(this.dateControl_end.Value);

            string strWarning = "";

            // 根据日期范围,发生日志文件名
            // parameters:
            //      strStartDate    起始日期。8字符
            //      strEndDate  结束日期。8字符
            // return:
            //      -1  错误
            //      0   成功
            nRet = MakeLogFileNames(strStartDate,
                                    strEndDate,
                                    true,
                                    out LogFileNames,
                                    out strWarning,
                                    out strError);
            if (nRet == -1)
            {
                return(-1);
            }

            if (String.IsNullOrEmpty(strWarning) == false)
            {
                MessageBox.Show(this, strWarning);
            }

#if NO
            string strStyle = "";
            if (Program.MainForm.AutoCacheOperlogFile == true)
            {
                strStyle = "autocache";
            }
#endif

            ProgressEstimate estimate = new ProgressEstimate();

#if NO
            nRet = OperLogForm.ProcessFiles(this,
                                            stop,
                                            estimate,
                                            Channel,
                                            LogFileNames,
                                            Program.MainForm.OperLogLevel,
                                            strStyle,
                                            Program.MainForm.OperLogCacheDir,
                                            null,         // param,
                                            procDoRecord, // DoRecord,
                                            out strError);
            if (nRet == -1)
            {
                return(-1);
            }
#endif

            OperLogLoader loader = new OperLogLoader();
            loader.Channel   = this.Channel;
            loader.Stop      = this.Stop;
            loader.owner     = this;
            loader.estimate  = estimate;
            loader.FileNames = LogFileNames;
            loader.nLevel    = Program.MainForm.OperLogLevel;
            loader.AutoCache = false;
            loader.CacheDir  = "";


            List <OperLogLine> lines = new List <OperLogLine>();

            foreach (OperLogItem item in loader)
            {
                string strXml = item.Xml;

                if (string.IsNullOrEmpty(strXml) == true)
                {
                    continue;
                }

                {
                    XmlDocument dom = new XmlDocument();
                    try
                    {
                        dom.LoadXml(strXml);
                    }
                    catch (Exception ex)
                    {
                        strError = "Load Xml to DOM error: " + ex.Message;
                        return(-1);
                    }

                    string strOperation = DomUtil.GetElementText(dom.DocumentElement, "operation");
                    if (strOperation != "borrow" && strOperation != "return")
                    {
                        continue;
                    }

                    string strAction   = DomUtil.GetElementText(dom.DocumentElement, "action");
                    string strOperator = DomUtil.GetElementText(dom.DocumentElement, "operator");

#if NO
                    XmlNode nodeItem   = null;
                    string  strItemXml = DomUtil.GetElementText(dom.DocumentElement,
                                                                "itemRecord", out nodeItem);
                    string strItemRecPath = "";
                    if (nodeItem != null)
                    {
                        strItemRecPath = DomUtil.GetAttr(nodeItem, "recPath");
                    }

                    // 册记录相关的书目记录路径,这个后面统一提取,就不用日志记录中的数据了
#endif
                    XmlNode nodeReader   = null;
                    string  strReaderXml = DomUtil.GetElementText(dom.DocumentElement,
                                                                  "readerRecord", out nodeReader);
                    string strReaderRecPath = DomUtil.GetAttr(nodeReader, "recPath");
                    string strReaderDbName  = Global.GetDbName(strReaderRecPath);
                    // TODO: 根据读者库名获得馆代码
                    string strLibraryCode = "";

                    string strItemBarcode = DomUtil.GetElementText(dom.DocumentElement,
                                                                   "itemBarcode");
                    string strReaderBarcode = DomUtil.GetElementText(dom.DocumentElement,
                                                                     "readerBarcode");
                    string strOperTime = DomUtil.GetElementText(dom.DocumentElement,
                                                                "operTime");

                    OperLogLine line = new OperLogLine();
                    line.ItemBarcode = strItemBarcode;
                    // 馆藏地点需要另行获得
                    line.ReaderBarcode = strReaderBarcode;
                    line.OperTime      = strOperTime;
                    line.LibraryCode   = strLibraryCode;

                    lines.Add(line);
                }


                if (lines.Count > 300)
                {
                    // 写入数据库一次

                    lines.Clear();
                }
            }

            if (lines.Count > 0)
            {
                // 写入数据库一次
            }

            return(nRet);
        }