Exemplo n.º 1
0
        private void toolStripMenuItem_moveRecord_Click(object sender, EventArgs e)
        {
            string strError = "";
            // int nRet = 0;
            string strTargetRecPath = "";

            if (string.IsNullOrEmpty(this.readerEditControl1.RecPath) == true)
            {
                strError = "当前记录的路径为空,无法进行移动操作";
                goto ERROR1;
            }

            if (this.ReaderXmlChanged == true
    || this.ObjectChanged == true)
            {
                // 警告尚未保存
                DialogResult result = MessageBox.Show(this,
"当前有信息被修改后尚未保存。若此时进行移动操作,现有未保存信息将丢失。\r\n\r\n确实要进行移动操作? ",
"ReaderInfoForm",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2);
                if (result != DialogResult.Yes)
                    return;   // cancelled

            }

            // 出现对话框,让用户可以选择目标库
            ReaderSaveToDialog saveto_dlg = new ReaderSaveToDialog();
            MainForm.SetControlFont(saveto_dlg, this.Font, false);
            saveto_dlg.Text = "移动读者记录";
            saveto_dlg.MessageText = "请选择要移动去的目标记录位置";
            saveto_dlg.MainForm = this.MainForm;
            saveto_dlg.RecPath = this.readerEditControl1.RecPath;
            saveto_dlg.RecID = "?";

            this.MainForm.AppInfo.LinkFormState(saveto_dlg, "readerinfoform_movetodialog_state");
            saveto_dlg.ShowDialog(this);
            this.MainForm.AppInfo.UnlinkFormState(saveto_dlg);

            if (saveto_dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return;

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在移动读者记录 " + this.readerEditControl1.RecPath + " 到 "+saveto_dlg.RecPath+"...");
            stop.BeginLoop();

            EnableControls(false);

            try
            {
                strTargetRecPath = saveto_dlg.RecPath;

                byte[] target_timestamp = null;
                long lRet = Channel.MoveReaderInfo(
    stop,
    this.readerEditControl1.RecPath,
    ref strTargetRecPath,
    out target_timestamp,
    out strError);
                if (lRet == -1)
                    goto ERROR1;

                Debug.Assert(string.IsNullOrEmpty(strTargetRecPath) == false, "");
            }
            finally
            {
                EnableControls(true);

                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
            }

            // 重新装载窗口内容
            Debug.Assert(string.IsNullOrEmpty(strTargetRecPath) == false, "");
            LoadRecordByRecPath(strTargetRecPath,
                "");

            MessageBox.Show(this, "移动成功。");
            return;
        ERROR1:
            MessageBox.Show(this, strError);
            return;
        }
Exemplo n.º 2
0
        // return:
        //      -1  error
        //      0   canceled
        //      1   succeed
        /// <summary>
        /// 保存记录
        /// </summary>
        /// <param name="strStyle">风格。为 displaysuccess/verifybarcode/changereaderbarcode 之一或者组合。缺省值为 displaysuccess,verifybarcode</param>
        /// <returns>-1: 出错; 0: 放弃; 1: 成功</returns>
        public int SaveRecord(string strStyle = "displaysuccess,verifybarcode")
        {
            string strError = "";
            int nRet = 0;

            if (this.readerEditControl1.Barcode == "")
            {
                strError = "尚未输入证条码号";
                goto ERROR1;
            }

            // 校验证条码号
            if (this.NeedVerifyBarcode == true
                && StringUtil.IsIdcardNumber(this.readerEditControl1.Barcode) == false)
            {
                // 形式校验条码号
                // return:
                //      -2  服务器没有配置校验方法,无法校验
                //      -1  error
                //      0   不是合法的条码号
                //      1   是合法的读者证条码号
                //      2   是合法的册条码号
                nRet = VerifyBarcode(
                    this.Channel.LibraryCodeList,
                    this.readerEditControl1.Barcode,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                // 输入的条码格式不合法
                if (nRet == 0)
                {
                    strError = "您输入的证条码 " + this.readerEditControl1.Barcode + " 格式不正确("+strError+")。";
                    goto ERROR1;
                }

                // 实际输入的是册条码号
                if (nRet == 2)
                {
                    strError = "您输入的条码号 " + this.readerEditControl1.Barcode + " 是册条码号。请输入读者证条码号。";
                    goto ERROR1;
                }

                /*
                // 对于服务器没有配置校验功能,但是前端发出了校验要求的情况,警告一下
                if (nRet == -2)
                    MessageBox.Show(this, "警告:前端开启了校验条码功能,但是服务器端缺乏相应的脚本函数,无法校验条码。\r\n\r\n若要避免出现此警告对话框,请关闭前端校验功能");
                 * */
            }

            // TODO: 保存时候的选项


            // 当 this.readerEditControl1.RecPath 为空的时候,需要出现对话框,让用户可以选择目标库
            string strTargetRecPath = this.readerEditControl1.RecPath;
            if (string.IsNullOrEmpty(this.readerEditControl1.RecPath) == true)
            {
                // 出现对话框,让用户可以选择目标库
                ReaderSaveToDialog saveto_dlg = new ReaderSaveToDialog();
                MainForm.SetControlFont(saveto_dlg, this.Font, false);
                saveto_dlg.MessageText = "请选择记录位置";
                saveto_dlg.MainForm = this.MainForm;
                saveto_dlg.RecPath = this.readerEditControl1.RecPath;
                saveto_dlg.RecID = "?";

                this.MainForm.AppInfo.LinkFormState(saveto_dlg, "readerinfoform_savetodialog_state");
                saveto_dlg.ShowDialog(this);
                this.MainForm.AppInfo.UnlinkFormState(saveto_dlg);

                if (saveto_dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                    return 0;

                strTargetRecPath = saveto_dlg.RecPath;
            }

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在保存读者记录 " + this.readerEditControl1.Barcode + " ...");
            stop.BeginLoop();

            EnableControls(false);

            try
            {
                string strNewXml = "";
                nRet = GetReaderXml(
            true,
            false,
            out strNewXml,
            out strError);
                if (nRet == -1)
                    goto ERROR1;

                ErrorCodeValue kernel_errorcode;

                byte[] baNewTimestamp = null;
                string strExistingXml = "";
                string strSavedXml = "";
                string strSavedPath = "";

                bool bChangeReaderBarcode = StringUtil.IsInList("changereaderbarcode", strStyle);
                string strAction = this.m_strSetAction;
                if (strAction == "change" && bChangeReaderBarcode)
                {
                    if (this.MainForm.ServerVersion < 2.51)
                    {
                        strError = "需要 dp2library 版本在 2.51 以上才能实现强制修改册条码号的功能。当前 dp2library 版本为 " + this.MainForm.ServerVersion;
                        goto ERROR1;
                    }
                    strAction = "changereaderbarcode";
                }

                // 调试
                // MessageBox.Show(this, "1 this.m_strSetAction='"+this.m_strSetAction+"'");

                long lRet = Channel.SetReaderInfo(
                    stop,
                    strAction,  // this.m_strSetAction,
                    strTargetRecPath,
                    strNewXml,
                    // 2007/11/5 changed
                    this.m_strSetAction != "new" ? this.readerEditControl1.OldRecord : null,
                    this.m_strSetAction != "new" ? this.readerEditControl1.Timestamp : null,

                    out strExistingXml,
                    out strSavedXml,
                    out strSavedPath,
                    out baNewTimestamp,
                    out kernel_errorcode,
                    out strError);
                if (lRet == -1)
                {
                    // Debug.Assert(false, "");

                    if (kernel_errorcode == ErrorCodeValue.TimestampMismatch)
                    {
                        CompareReaderForm dlg = new CompareReaderForm();
                        dlg.Initial(
                            this.MainForm,
                            this.readerEditControl1.RecPath,
                            strExistingXml,
                            baNewTimestamp,
                            strNewXml,
                            this.readerEditControl1.Timestamp,
                            "数据库中的记录在编辑期间发生了改变。请仔细核对,并重新修改窗口中的未保存记录,按确定按钮后可重试保存。");

                        dlg.StartPosition = FormStartPosition.CenterScreen;
                        dlg.ShowDialog(this);
                        if (dlg.DialogResult == DialogResult.OK)
                        {
                            nRet = this.readerEditControl1.SetData(dlg.UnsavedXml,
                                dlg.RecPath,
                                dlg.UnsavedTimestamp,
                                out strError);
                            if (nRet == -1)
                            {
                                MessageBox.Show(this, strError);
                            }
                            MessageBox.Show(this, "请注意重新保存记录");
                            return -1;
                        }
                    }

                    goto ERROR1;
                }

                /*
                this.Timestamp = baNewTimestamp;
                this.OldRecord = strSavedXml;
                this.RecPath = strSavedPath;
                 */

                if (lRet == 1)
                {
                    // 部分字段被拒绝
                    MessageBox.Show(this, strError);

                    if (Channel.ErrorCode == ErrorCode.PartialDenied)
                    {
                        // 提醒重新装载?
                        MessageBox.Show(this, "请重新装载记录, 检查哪些字段内容修改被拒绝。");
                    }
                }
                else
                {
                    this.binaryResControl1.BiblioRecPath = strSavedPath;
                    // 提交对象保存请求
                    // return:
                    //		-1	error
                    //		>=0 实际上载的资源对象数
                    nRet = this.binaryResControl1.Save(out strError);
                    if (nRet == -1)
                    {
                        MessageBox.Show(this, strError);
                    }
                    if (nRet >= 1)
                    {
                        // 重新获得时间戳
                        string[] results = null;
                        string strOutputPath = "";
                        lRet = Channel.GetReaderInfo(
                            stop,
                            "@path:" + strSavedPath,
                            "", // "xml,html",
                            out results,
                            out strOutputPath,
                            out baNewTimestamp,
                            out strError);
                        if (lRet == -1 || lRet == 0)
                        {
                            MessageBox.Show(this, strError);
                        }
                    }

                    // 重新装载记录到编辑器
                    nRet = this.readerEditControl1.SetData(strSavedXml,
                        strSavedPath,
                        baNewTimestamp,
                        out strError);
                    if (nRet == -1)
                        goto ERROR1;

                    // 刷新XML显示
                    /*
                    this.SetXmlToWebbrowser(this.webBrowser_xml,
                        strSavedXml);
                     * */
                    Global.SetXmlToWebbrowser(this.webBrowser_xml,
this.MainForm.DataDir,
"xml",
strSavedXml);
                    // 2007/11/12
                    this.m_strSetAction = "change";

                    // 装载记录到HTML
                    {
                        byte[] baTimestamp = null;
                        string strOutputRecPath = "";

                        string strBarcode = this.readerEditControl1.Barcode;

                        stop.SetMessage("正在装入读者记录 " + strBarcode + " ...");

                        string[] results = null;
                        lRet = Channel.GetReaderInfo(
                            stop,
                            strBarcode,
                            "html",
                            out results,
                            out strOutputRecPath,
                            out baTimestamp,
                            out strError);
                        if (lRet == -1)
                        {
                            strError = "保存记录已经成功,但在刷新HTML显示的时候发生错误: " + strError;
                            // Global.SetHtmlString(this.webBrowser_readerInfo, strError);
                            this.m_webExternalHost.SetTextString(strError);
                            goto ERROR1;
                        }

                        if (lRet == 0)
                        {
                            strError = "保存记录已经成功,但在刷新HTML显示的时候发生错误: " + strError;
                            // Global.SetHtmlString(this.webBrowser_readerInfo, strError);
                            this.m_webExternalHost.SetTextString(strError);
                            goto ERROR1;
                        }

                        if (lRet > 1)
                        {
                            strError = "条码 " + strBarcode + " 命中记录 " + lRet.ToString() + " 条,注意这是一个严重错误,请系统管理员尽快排除。";
                            strError = "保存记录已经成功,但在刷新HTML显示的时候发生错误: " + strError;
                            // Global.SetHtmlString(this.webBrowser_readerInfo, strError);
                            this.m_webExternalHost.SetTextString(strError);
                            goto ERROR1;    // 当出错处理
                        }

                        string strHtml = results[0];

#if NO
                        Global.SetHtmlString(this.webBrowser_readerInfo,
                            strHtml,
        this.MainForm.DataDir,
        "readerinfoform_reader");
#endif
                        this.SetReaderHtmlString(strHtml);
                    }

                }

                // 更新指纹高速缓存
                if (string.IsNullOrEmpty(this.MainForm.FingerprintReaderUrl) == false
                    && string.IsNullOrEmpty(this.readerEditControl1.Barcode) == false)
                {
                    // return:
                    //      -2  remoting服务器连接失败。驱动程序尚未启动
                    //      -1  出错
                    //      0   成功
                    nRet = UpdateFingerprintCache(
                         this.readerEditControl1.Barcode,
                         this.readerEditControl1.Fingerprint,
                         out strError);
                    if (nRet == -1)
                    {
                        strError = "虽然读者记录已经保存成功,但更新指纹缓存时发生了错误: " + strError;
                        goto ERROR1;
                    }
                    // -2 故意不报错。因为用户可能配置了URL,但是当前驱动程序并没有启动
                }

            }
            finally
            {
                EnableControls(true);

                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
            }

            if (StringUtil.IsInList("displaysuccess", strStyle) == true)
                this.MainForm.StatusBarMessage = "读者记录保存成功";
            // MessageBox.Show(this, "保存成功");
            return 1;
        ERROR1:
            MessageBox.Show(this, strError);
            return -1;
        }
Exemplo n.º 3
0
        void SaveTo()
        {
            string strError = "";
            int nRet = 0;
            bool bReserveFieldsCleared = false;

            if (this.readerEditControl1.Barcode == "")
            {
                strError = "尚未输入证条码号";
                goto ERROR1;
            }

            // 校验证条码号
            if (this.NeedVerifyBarcode == true
                && StringUtil.IsIdcardNumber(this.readerEditControl1.Barcode) == false)
            {
                // 形式校验条码号
                // return:
                //      -2  服务器没有配置校验方法,无法校验
                //      -1  error
                //      0   不是合法的条码号
                //      1   是合法的读者证条码号
                //      2   是合法的册条码号
                nRet = VerifyBarcode(
                    this.Channel.LibraryCodeList,
                    this.readerEditControl1.Barcode,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                // 输入的条码格式不合法
                if (nRet == 0)
                {
                    strError = "您输入的证条码号 " + this.readerEditControl1.Barcode + " 格式不正确(" + strError + ")。";
                    goto ERROR1;
                }

                // 实际输入的是册条码号
                if (nRet == 2)
                {
                    strError = "您输入的条码号 " + this.readerEditControl1.Barcode + " 是册条码号。请输入读者证条码号。";
                    goto ERROR1;
                }

                /*
                // 对于服务器没有配置校验功能,但是前端发出了校验要求的情况,警告一下
                if (nRet == -2)
                    MessageBox.Show(this, "警告:前端开启了校验条码功能,但是服务器端缺乏相应的脚本函数,无法校验条码。\r\n\r\n若要避免出现此警告对话框,请关闭前端校验功能");
                 * */
            }

            // 出现对话框,让用户可以选择目标库
            ReaderSaveToDialog saveto_dlg = new ReaderSaveToDialog();
            MainForm.SetControlFont(saveto_dlg, this.Font, false);
            saveto_dlg.Text = "新增一条读者记录";
            saveto_dlg.MessageText = "请选择要保存的目标记录位置\r\n(记录ID为 ? 表示追加保存到数据库末尾)";
            saveto_dlg.MainForm = this.MainForm;
            saveto_dlg.RecPath = this.readerEditControl1.RecPath;
            saveto_dlg.RecID = "?";

            this.MainForm.AppInfo.LinkFormState(saveto_dlg, "readerinfoform_savetodialog_state");
            saveto_dlg.ShowDialog(this);
            this.MainForm.AppInfo.UnlinkFormState(saveto_dlg);

            if (saveto_dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return;

            if (saveto_dlg.RecID == "?")
                this.m_strSetAction = "new";
            else
                this.m_strSetAction = "change";

            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("正在保存读者记录 " + this.readerEditControl1.Barcode + " ...");
            stop.BeginLoop();

            EnableControls(false);

            try
            {
                string strNewXml = "";

                if (this.m_strSetAction == "new")
                    nRet = GetReaderXml(
                        false,  // 不创建<dprms:file>元素
                        true,   // 清除<dprms:file>元素
                        out strNewXml,
                        out strError);
                else
                    nRet = GetReaderXml(
                        true,  // 创建<dprms:file>元素
                        false,
                        out strNewXml,
                        out strError);
                if (nRet == -1)
                    goto ERROR1;

                // 需要消除password/displayName元素内容
                if (this.m_strSetAction == "new")
                {
                            // 清除一些保留字段的内容
                    nRet = ClearReserveFields(
            ref strNewXml,
            out strError);
                    if (nRet == -1)
                        goto ERROR1;

                    bReserveFieldsCleared = true;
                }

                ErrorCodeValue kernel_errorcode;

                byte[] baNewTimestamp = null;
                string strExistingXml = "";
                string strSavedXml = "";
                string strSavedPath = "";

                // 调试
                // MessageBox.Show(this, "2 this.m_strSetAction='" + this.m_strSetAction + "'");

                long lRet = Channel.SetReaderInfo(
                    stop,
                    this.m_strSetAction,
                    saveto_dlg.RecPath, // this.readerEditControl1.RecPath,
                    strNewXml,
                    this.m_strSetAction != "new" ? this.readerEditControl1.OldRecord : null,
                    this.m_strSetAction != "new" ? this.readerEditControl1.Timestamp : null,
                    out strExistingXml,
                    out strSavedXml,
                    out strSavedPath,
                    out baNewTimestamp,
                    out kernel_errorcode,
                    out strError);
                if (lRet == -1)
                {
                    // Debug.Assert(false, "");

                    if (kernel_errorcode == ErrorCodeValue.TimestampMismatch)
                    {
                        CompareReaderForm dlg = new CompareReaderForm();
                        dlg.Initial(
                            this.MainForm,
                            this.readerEditControl1.RecPath,
                            strExistingXml,
                            baNewTimestamp,
                            strNewXml,
                            this.readerEditControl1.Timestamp,
                            "数据库中的记录在编辑期间发生了改变。请仔细核对,并重新修改窗口中的未保存记录,按确定按钮后可重试保存。");

                        dlg.StartPosition = FormStartPosition.CenterScreen;
                        dlg.ShowDialog(this);
                        if (dlg.DialogResult == DialogResult.OK)
                        {
                            nRet = this.readerEditControl1.SetData(dlg.UnsavedXml,
                                dlg.RecPath,
                                dlg.UnsavedTimestamp,
                                out strError);
                            if (nRet == -1)
                            {
                                MessageBox.Show(this, strError);
                            }
                            MessageBox.Show(this, "请注意重新保存记录");
                            return;
                        }
                    }

                    goto ERROR1;
                }

                /*
                this.Timestamp = baNewTimestamp;
                this.OldRecord = strSavedXml;
                this.RecPath = strSavedPath;
                 */

                if (lRet == 1)
                {
                    // 部分字段被拒绝
                    MessageBox.Show(this, strError);

                    if (Channel.ErrorCode == ErrorCode.PartialDenied)
                    {
                        // 提醒重新装载?
                        MessageBox.Show(this, "请重新装载记录, 检查哪些字段内容修改被拒绝。");
                    }
                }
                else
                {
                    this.binaryResControl1.BiblioRecPath = strSavedPath;
                    // 提交对象保存请求
                    // return:
                    //		-1	error
                    //		>=0 实际上载的资源对象数
                    nRet = this.binaryResControl1.Save(out strError);
                    if (nRet == -1)
                    {
                        MessageBox.Show(this, strError);
                    }
                    if (nRet >= 1)
                    {
                        // 重新获得时间戳
                        string[] results = null;
                        string strOutputPath = "";
                        lRet = Channel.GetReaderInfo(
                            stop,
                            "@path:" + strSavedPath,
                            "", // "xml,html",
                            out results,
                            out strOutputPath,
                            out baNewTimestamp,
                            out strError);
                        if (lRet == -1 || lRet == 0)
                        {
                            MessageBox.Show(this, strError);
                        }
                    }

                    // 重新装载记录到编辑器
                    nRet = this.readerEditControl1.SetData(strSavedXml,
                        strSavedPath,
                        baNewTimestamp,
                        out strError);
                    if (nRet == -1)
                        goto ERROR1;
                    /*
                    this.SetXmlToWebbrowser(this.webBrowser_xml,
                        strSavedXml);
                     * */
                    Global.SetXmlToWebbrowser(this.webBrowser_xml,
this.MainForm.DataDir,
"xml",
strSavedXml);
                    // 2007/11/12
                    this.m_strSetAction = "change";

                    // 接着装入对象资源
                    {
                        nRet = this.binaryResControl1.LoadObject(strSavedPath,    // 2008/11/2 changed
                            strSavedXml,
                            out strError);
                        if (nRet == -1)
                        {
                            MessageBox.Show(this, strError);
                            // return -1;
                        }
                    }

                    // 2011/11/23
                    // 装载记录到HTML
                    {
                        byte[] baTimestamp = null;
                        string strOutputRecPath = "";

                        string strBarcode = this.readerEditControl1.Barcode;

                        stop.SetMessage("正在装入读者记录 " + strBarcode + " ...");

                        string[] results = null;
                        lRet = Channel.GetReaderInfo(
                            stop,
                            strBarcode,
                            "html",
                            out results,
                            out strOutputRecPath,
                            out baTimestamp,
                            out strError);
                        if (lRet == -1)
                        {
                            strError = "保存记录已经成功,但在刷新HTML显示的时候发生错误: " + strError;
                            // Global.SetHtmlString(this.webBrowser_readerInfo, strError);
                            this.m_webExternalHost.SetTextString(strError);
                            goto ERROR1;
                        }

                        if (lRet == 0)
                        {
                            strError = "保存记录已经成功,但在刷新HTML显示的时候发生错误: " + strError;
                            Global.SetHtmlString(this.webBrowser_readerInfo, strError);
                            goto ERROR1;
                        }

                        if (lRet > 1)
                        {
                            strError = "条码 " + strBarcode + " 命中记录 " + lRet.ToString() + " 条,注意这是一个严重错误,请系统管理员尽快排除。";
                            strError = "保存记录已经成功,但在刷新HTML显示的时候发生错误: " + strError;
                            // Global.SetHtmlString(this.webBrowser_readerInfo, strError);
                            this.m_webExternalHost.SetTextString(strError);
                            goto ERROR1;    // 当出错处理
                        }

                        string strHtml = results[0];

#if NO
                        Global.SetHtmlString(this.webBrowser_readerInfo,
                            strHtml,
        this.MainForm.DataDir,
        "readerinfoform_reader");
#endif
                        this.SetReaderHtmlString(strHtml);
                    }

                }
            }
            finally
            {
                EnableControls(true);

                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
            }

            if (bReserveFieldsCleared == true)
                MessageBox.Show(this, "另存成功。新记录的密码为初始状态,显示名尚未设置。");
            else
                MessageBox.Show(this, "另存成功。");
            return;
        ERROR1:
            MessageBox.Show(this, strError);
            return;
        }
Exemplo n.º 4
0
        // 成批移动读者记录
        void menu_moveRecords_Click(object sender, EventArgs e)
        {
            string strError = "";

            if (this.listView_records.SelectedItems.Count == 0)
            {
                strError = "尚未选择要移动的读者记录事项";
                goto ERROR1;
            }

            if (this.m_nChangedCount > 0)
            {
                // 警告尚未保存
                strError = "当前窗口内有 " + m_nChangedCount + " 项修改尚未保存。若此时移动读者记录,现有未保存信息可能会丢失。\r\n\r\n请先保存记录,或者放弃修改后,再重新执行本命令";
                goto ERROR1;
            }

            // 得到选定范围的第一条记录的路径
            string strFirstRecPath = this.listView_records.SelectedItems[0].Text;

            // 出现对话框,让用户可以选择目标库
            ReaderSaveToDialog saveto_dlg = new ReaderSaveToDialog();
            MainForm.SetControlFont(saveto_dlg, this.Font, false);
            saveto_dlg.Text = "移动读者记录";
            saveto_dlg.MessageText = "请选择要移动去的目标记录位置";
            saveto_dlg.MainForm = this.MainForm;
            saveto_dlg.RecPath = strFirstRecPath;
            saveto_dlg.RecID = "?";
            if (this.listView_records.SelectedItems.Count > 1)
                saveto_dlg.EnableRecID = false; // 处理记录多于一条的情况下,问号ID不让修改

            this.MainForm.AppInfo.LinkFormState(saveto_dlg, "readersearchform_movetodialog_state");
            saveto_dlg.ShowDialog(this);
            this.MainForm.AppInfo.UnlinkFormState(saveto_dlg);

            if (saveto_dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
                return;

            stop.Style = StopStyle.EnableHalfStop;
            stop.OnStop += new StopEventHandler(this.DoStop);
            stop.Initial("移动读者记录 ...");
            stop.BeginLoop();

            EnableControls(false);
            this.listView_records.Enabled = false;

            int nCount = 0;
            try
            {
                stop.SetProgressRange(0, this.listView_records.SelectedItems.Count);

                int i = 0;
                foreach (ListViewItem item in this.listView_records.SelectedItems)
                {
                    Application.DoEvents();	// 出让界面控制权

                    if (stop != null)
                    {
                        if (stop.State != 0)
                        {
                            MessageBox.Show(this, "用户中断");
                            return;
                        }
                    }

                    string strCurrentRecPath = item.Text;

                    if (string.IsNullOrEmpty(strCurrentRecPath) == true)
                    {
                        // Debug.Assert(false, "");
                        continue;
                    }

                    string strTargetRecPath = saveto_dlg.RecPath;

                    stop.SetMessage("正在移动读者记录 '"+strCurrentRecPath+"' ...");

                    byte[] target_timestamp = null;
                    long lRet = Channel.MoveReaderInfo(
        stop,
        strCurrentRecPath,
        ref strTargetRecPath,
        out target_timestamp,
        out strError);
                    if (lRet == -1)
                        goto ERROR1;

                    Debug.Assert(string.IsNullOrEmpty(strTargetRecPath) == false, "");

                    item.Text = strTargetRecPath;   // 刷新浏览行的记录路径部分

                    stop.SetProgressValue(++i);
                    nCount++;
                }
            }
            finally
            {
                EnableControls(true);
                this.listView_records.Enabled = true;

                stop.EndLoop();
                stop.OnStop -= new StopEventHandler(this.DoStop);
                stop.Initial("");
                stop.HideProgress();
                stop.Style = StopStyle.None;
            }
            MessageBox.Show(this, "成功移动读者记录 "+nCount.ToString()+" 条");
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }