// 通过册条码号检索察看相关种册信息
        // 是否可以优化为:先看看当前窗口中是否有了要检索的条码号?不过这也等于放弃了查重功能。
        void DoSearchFromBarcode(bool bDetectDup)
        {
            string strError = "";

            // string strBiblioRecPath = "";
            // string strItemRecPath = "";


            EnableControls(false);

            try
            {
                this.Clear();

                List <DoublePath> paths = null;

                int nRet = GetLinkInfoFromBarcode(
                    this.textBox_itemBarcode.Text,
                    true,
                    out paths,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                if (nRet == 0)
                {
                    goto NOTFOUND;
                }

                DoublePath dpath = null;

                if (nRet > 1)
                {
                    // MessageBox.Show(this, "册条码号 " + this.textBox_itemBarcode.Text + " 出现重复现象,请及时解决。");
                    SelectDupItemRecordDlg dlg = new SelectDupItemRecordDlg();
                    dlg.MessageText = "册条码号 " + this.textBox_itemBarcode.Text + " 出现重复现象,这将会导致业务功能出现故障。\r\n\r\n请选择当前希望观察的一条册记录。";
                    dlg.Paths       = paths;
                    dlg.ShowDialog(this);

                    if (dlg.DialogResult != DialogResult.OK)
                    {
                        return; // 放弃操作
                    }
                    dpath = dlg.SelectedDoublePath;
                }
                else
                {
                    dpath = paths[0];
                }

                this.BiblioDbName = ResPath.GetDbName(dpath.BiblioRecPath);
                this.ItemDbName   = ResPath.GetDbName(dpath.ItemRecPath);

                nRet = LoadBiblioRecord(
                    dpath.BiblioRecPath,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                // 突出显示所命中的册信息行
                ListViewItem listitem = this.GetListViewItem(
                    this.textBox_itemBarcode.Text,
                    dpath.ItemRecPath);

                if (listitem == null)
                {
                    strError = "册条码号为 '" + this.textBox_itemBarcode.Text
                               + "' 册记录路径为 '" + dpath.ItemRecPath + "' 的ListViewItem居然不存在 ...";
                    goto ERROR1;
                }

                listitem.Selected = true;
                listitem.Focused  = true;
                this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));
            }
            finally
            {
                EnableControls(true);
            }



            this.textBox_itemBarcode.SelectAll();
            this.textBox_itemBarcode.Focus();
            return;

ERROR1:
            MessageBox.Show(this, strError);
            return;

NOTFOUND:
            MessageBox.Show(this, "册条码号 " + this.textBox_itemBarcode.Text + " 没有找到对应的记录。");
            this.textBox_itemBarcode.SelectAll();
            this.textBox_itemBarcode.Focus();
            return;
        }
Beispiel #2
0
        // 册登录
        // 根据输入的册条码号新增一册信息,或者定位到已经存在的行
        void DoRegisterBarcode()
        {
            string strError = "";
            int nRet;

            if (this.textBox_itemBarcode.Text == "")
            {
                strError = "尚未输入册条码号";
                goto ERROR1;
            }

            // 看看输入的条码号是否为ISBN条码号
            if (IsISBnBarcode(this.textBox_itemBarcode.Text) == true)
            {
                // 保存当前册信息
                EnableControls(false);
                nRet = this.SaveItems(out strError);
                EnableControls(true);
                if (nRet == -1)
                    goto ERROR1;

                // 转而触发新种检索操作
                this.textBox_queryWord.Text = this.textBox_itemBarcode.Text;
                this.textBox_itemBarcode.Text = "";

                this.button_search_Click(null, null);
                return;
            }


            if (this.Items == null)
                this.Items = new BookItemCollection();

            // 种内查重
            BookItem item = this.Items.GetItem(this.textBox_itemBarcode.Text);

            ListViewItem listitem = null;

            // 如果该册条码号的事项已经存在
            if (item != null)
            {
                listitem = this.GetListViewItem(this.textBox_itemBarcode.Text,
                    null);

                if (listitem == null)
                {
                    strError = "册条码号为 '" + this.textBox_itemBarcode.Text + "'的BookItem内存事项存在,但是没有对应的ListViewItem ...";
                    goto ERROR1;
                }

                UnselectListViewItems();
                listitem.Selected = true;
                listitem.Focused = true;
                this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));
                goto END1;
            }

            List<DoublePath> paths = null;

            // 种外全面查重
            nRet = GetLinkInfoFromBarcode(
                this.textBox_itemBarcode.Text,
                true,
                out paths,
                out strError);
            if (nRet == -1)
            {
                strError = "册条码号查重操作出现错误:" + strError;
                goto ERROR1;
            }

            if (nRet > 0)
            {
                // MessageBox.Show(this, "册条码号 " + this.textBox_itemBarcode.Text + " 出现重复现象,请及时解决。");
                SelectDupItemRecordDlg dlg = new SelectDupItemRecordDlg();
                dlg.MessageText = "册条码号 " + this.textBox_itemBarcode.Text + " 已经被登录过了,情况如下。\r\n\r\n如果想详细观察,请选择当前希望观察的一条册记录;否则请按“取消”按钮。";
                dlg.Paths = paths;
                dlg.ShowDialog(this);

                if (dlg.DialogResult != DialogResult.OK)
                    return; // 放弃操作

                if (this.BiblioRecPath != dlg.SelectedDoublePath.BiblioRecPath)
                {
                    MessageBox.Show(this, "请注意软件即将自动装入新种 " + dlg.SelectedDoublePath.BiblioRecPath + " 到窗口中,如稍候您想继续对原种 " + this.BiblioRecPath + " 进行册登录,请切记重新装入原种后再行册登录 ...");
                }

                // 先保存本种
                nRet = this.SaveItems(out strError);
                if (nRet == -1)
                    goto ERROR1;

                this.textBox_queryWord.Text = "";   // qingchu yuanlai de jiansuoci , bimian wuhui 

                DoublePath dpath = dlg.SelectedDoublePath;

                this.BiblioDbName = ResPath.GetDbName(dpath.BiblioRecPath);
                this.ItemDbName = ResPath.GetDbName(dpath.ItemRecPath);

                nRet = LoadBiblioRecord(
                    dpath.BiblioRecPath,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                // 突出显示所命中的册信息行
                listitem = this.GetListViewItem(
                    this.textBox_itemBarcode.Text,
                    dpath.ItemRecPath);

                if (listitem == null)
                {
                    strError = "册条码号为 '" + this.textBox_itemBarcode.Text
                        + "' 册记录路径为 '" + dpath.ItemRecPath + "' 的ListViewItem居然不存在 ...";
                    goto ERROR1;
                }

                listitem.Selected = true;
                listitem.Focused = true;
                this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));

                this.textBox_itemBarcode.SelectAll();
                this.textBox_itemBarcode.Focus();
                return;
            }


            item = new BookItem();

            item.Barcode = this.textBox_itemBarcode.Text;
            item.Changed = true;    // 表示这是新事项

            this.Items.Add(item);

            listitem = item.AddToListView(this.listView_items);

            // 加上选择标记
            UnselectListViewItems();
            listitem.Focused = true;
            this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));

        END1:
            this.textBox_itemBarcode.SelectAll();
            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
        // 册登录
        // 根据输入的册条码号新增一册信息,或者定位到已经存在的行
        void DoRegisterBarcode()
        {
            string strError = "";
            int    nRet;

            if (this.textBox_itemBarcode.Text == "")
            {
                strError = "尚未输入册条码号";
                goto ERROR1;
            }

            // 看看输入的条码号是否为ISBN条码号
            if (IsISBnBarcode(this.textBox_itemBarcode.Text) == true)
            {
                // 保存当前册信息
                EnableControls(false);
                nRet = this.SaveItems(out strError);
                EnableControls(true);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                // 转而触发新种检索操作
                this.textBox_queryWord.Text   = this.textBox_itemBarcode.Text;
                this.textBox_itemBarcode.Text = "";

                this.button_search_Click(null, null);
                return;
            }


            if (this.Items == null)
            {
                this.Items = new BookItemCollection();
            }

            // 种内查重
            BookItem item = this.Items.GetItem(this.textBox_itemBarcode.Text);

            ListViewItem listitem = null;

            // 如果该册条码号的事项已经存在
            if (item != null)
            {
                listitem = this.GetListViewItem(this.textBox_itemBarcode.Text,
                                                null);

                if (listitem == null)
                {
                    strError = "册条码号为 '" + this.textBox_itemBarcode.Text + "'的BookItem内存事项存在,但是没有对应的ListViewItem ...";
                    goto ERROR1;
                }

                UnselectListViewItems();
                listitem.Selected = true;
                listitem.Focused  = true;
                this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));
                goto END1;
            }

            List <DoublePath> paths = null;

            // 种外全面查重
            nRet = GetLinkInfoFromBarcode(
                this.textBox_itemBarcode.Text,
                true,
                out paths,
                out strError);
            if (nRet == -1)
            {
                strError = "册条码号查重操作出现错误:" + strError;
                goto ERROR1;
            }

            if (nRet > 0)
            {
                // MessageBox.Show(this, "册条码号 " + this.textBox_itemBarcode.Text + " 出现重复现象,请及时解决。");
                SelectDupItemRecordDlg dlg = new SelectDupItemRecordDlg();
                dlg.MessageText = "册条码号 " + this.textBox_itemBarcode.Text + " 已经被登录过了,情况如下。\r\n\r\n如果想详细观察,请选择当前希望观察的一条册记录;否则请按“取消”按钮。";
                dlg.Paths       = paths;
                dlg.ShowDialog(this);

                if (dlg.DialogResult != DialogResult.OK)
                {
                    return; // 放弃操作
                }
                if (this.BiblioRecPath != dlg.SelectedDoublePath.BiblioRecPath)
                {
                    MessageBox.Show(this, "请注意软件即将自动装入新种 " + dlg.SelectedDoublePath.BiblioRecPath + " 到窗口中,如稍候您想继续对原种 " + this.BiblioRecPath + " 进行册登录,请切记重新装入原种后再行册登录 ...");
                }

                // 先保存本种
                nRet = this.SaveItems(out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                this.textBox_queryWord.Text = "";   // qingchu yuanlai de jiansuoci , bimian wuhui

                DoublePath dpath = dlg.SelectedDoublePath;

                this.BiblioDbName = ResPath.GetDbName(dpath.BiblioRecPath);
                this.ItemDbName   = ResPath.GetDbName(dpath.ItemRecPath);

                nRet = LoadBiblioRecord(
                    dpath.BiblioRecPath,
                    out strError);
                if (nRet == -1)
                {
                    goto ERROR1;
                }

                // 突出显示所命中的册信息行
                listitem = this.GetListViewItem(
                    this.textBox_itemBarcode.Text,
                    dpath.ItemRecPath);

                if (listitem == null)
                {
                    strError = "册条码号为 '" + this.textBox_itemBarcode.Text
                               + "' 册记录路径为 '" + dpath.ItemRecPath + "' 的ListViewItem居然不存在 ...";
                    goto ERROR1;
                }

                listitem.Selected = true;
                listitem.Focused  = true;
                this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));

                this.textBox_itemBarcode.SelectAll();
                this.textBox_itemBarcode.Focus();
                return;
            }


            item = new BookItem();

            item.Barcode = this.textBox_itemBarcode.Text;
            item.Changed = true;    // 表示这是新事项

            this.Items.Add(item);

            listitem = item.AddToListView(this.listView_items);

            // 加上选择标记
            UnselectListViewItems();
            listitem.Focused = true;
            this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));

END1:
            this.textBox_itemBarcode.SelectAll();
            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Beispiel #4
0
        // 通过册条码号检索察看相关种册信息
        // 是否可以优化为:先看看当前窗口中是否有了要检索的条码号?不过这也等于放弃了查重功能。
        void DoSearchFromBarcode(bool bDetectDup)
        {
            string strError = "";
            // string strBiblioRecPath = "";
            // string strItemRecPath = "";


            EnableControls(false);

            try
            {

                this.Clear();

                List<DoublePath> paths = null;

                int nRet = GetLinkInfoFromBarcode(
                    this.textBox_itemBarcode.Text,
                    true,
                    out paths,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                if (nRet == 0)
                {
                    goto NOTFOUND;
                }

                DoublePath dpath = null;

                if (nRet > 1)
                {
                    // MessageBox.Show(this, "册条码号 " + this.textBox_itemBarcode.Text + " 出现重复现象,请及时解决。");
                    SelectDupItemRecordDlg dlg = new SelectDupItemRecordDlg();
                    dlg.MessageText = "册条码号 " + this.textBox_itemBarcode.Text + " 出现重复现象,这将会导致业务功能出现故障。\r\n\r\n请选择当前希望观察的一条册记录。";
                    dlg.Paths = paths;
                    dlg.ShowDialog(this);

                    if (dlg.DialogResult != DialogResult.OK)
                        return; // 放弃操作

                    dpath = dlg.SelectedDoublePath;
                }
                else
                {
                    dpath = paths[0];
                }

                this.BiblioDbName = ResPath.GetDbName(dpath.BiblioRecPath);
                this.ItemDbName = ResPath.GetDbName(dpath.ItemRecPath);

                nRet = LoadBiblioRecord(
                    dpath.BiblioRecPath,
                    out strError);
                if (nRet == -1)
                    goto ERROR1;

                // 突出显示所命中的册信息行
                ListViewItem listitem = this.GetListViewItem(
                    this.textBox_itemBarcode.Text,
                    dpath.ItemRecPath);

                if (listitem == null)
                {
                    strError = "册条码号为 '" + this.textBox_itemBarcode.Text
                        + "' 册记录路径为 '" + dpath.ItemRecPath + "' 的ListViewItem居然不存在 ...";
                    goto ERROR1;
                }

                listitem.Selected = true;
                listitem.Focused = true;
                this.listView_items.EnsureVisible(this.listView_items.Items.IndexOf(listitem));

            }
            finally
            {
                EnableControls(true);
            }



            this.textBox_itemBarcode.SelectAll();
            this.textBox_itemBarcode.Focus();
            return;
        ERROR1:
            MessageBox.Show(this, strError);
            return;
        NOTFOUND:
            MessageBox.Show(this, "册条码号 " + this.textBox_itemBarcode.Text + " 没有找到对应的记录。");
            this.textBox_itemBarcode.SelectAll();
            this.textBox_itemBarcode.Focus();
            return;
        }