コード例 #1
0
        private void button_OK_Click(object sender, EventArgs e)
        {
            if (this.listView_paths.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择任何事项");
                return;
            }

            this.SelectedDoublePath = this.Paths[this.listView_paths.SelectedIndices[0]];

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #2
0
ファイル: SelectDupItemRecordDlg.cs プロジェクト: zszqwe/dp2
        private void button_OK_Click(object sender, EventArgs e)
        {
            if (this.listView_paths.SelectedItems.Count == 0)
            {
                MessageBox.Show(this, "尚未选择任何事项");
                return;
            }

            this.SelectedDoublePath = this.Paths[this.listView_paths.SelectedIndices[0]];

            this.DialogResult = DialogResult.OK;
            this.Close();
        }
コード例 #3
0
ファイル: SelectDupItemRecordDlg.cs プロジェクト: zszqwe/dp2
        void FillList()
        {
            this.listView_paths.Items.Clear();

            if (this.Paths == null)
            {
                return;
            }

            for (int i = 0; i < this.Paths.Count; i++)
            {
                DoublePath dpath = this.Paths[i];

                ListViewItem item = new ListViewItem(dpath.ItemRecPath);

                item.SubItems.Add(dpath.BiblioRecPath);

                this.listView_paths.Items.Add(item);
            }
        }
コード例 #4
0
        // 根据册条码号在一系列可能的实体库中检索出册信息,
        // 然后提取出有关种的信息
        int GetLinkInfoFromBarcode(string strBarcode,
                                   bool bDetectDup,
                                   out List <DoublePath> paths,
                                   out string strError)
        {
            strError = "";
            // strBiblioRecPath = "";
            // strItemRecPath = "";

            paths = new List <DoublePath>();

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

            // 获得cfgs/global配置文件
            int nRet = GetGlobalCfgFile(out strError);

            if (nRet == -1)
            {
                return(-1);
            }

            // 列出所有<dblink>配置事项
            XmlNodeList nodes = this.dom.DocumentElement.SelectNodes("//dblink");

            if (nodes.Count == 0)
            {
                strError = "cfgs/global配置文件中,尚未配置任何<dblink>元素。";
                return(-1);
            }


            this.SearchPanel.BeginLoop("正在检索 " + strBarcode + " 所对应的册信息...");
            try
            {
                for (int i = 0; i < nodes.Count; i++)
                {
                    XmlNode node            = nodes[i];
                    string  strBiblioDbName = DomUtil.GetAttr(node, "bibliodb");
                    string  strItemDbName   = DomUtil.GetAttr(node, "itemdb");

                    // 2007/4/5 改造 加上了 GetXmlStringSimple()
                    string strQueryXml = "<target list='"
                                         + StringUtil.GetXmlStringSimple(strItemDbName + ":" + "册条码") // 2007/9/14
                                         + "'><item><word>"
                                         + StringUtil.GetXmlStringSimple(strBarcode)
                                         + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>" + this.Lang + "</lang></target>";

                    // strItemRecPath = "";
                    List <string> aPath = null;

                    nRet = this.SearchPanel.SearchMultiPath(
                        this.ServerUrl,
                        strQueryXml,
                        1000,
                        out aPath,
                        out strError);
                    if (nRet == -1)
                    {
                        return(-1);
                    }
                    if (nRet == 0)
                    {
                        continue;
                    }

                    for (int j = 0; j < aPath.Count; j++)
                    {
                        strItemRecPath = aPath[j];

                        XmlDocument tempdom     = null;
                        byte[]      baTimestamp = null;
                        // 提取册记录
                        nRet = this.SearchPanel.GetRecord(
                            this.ServerUrl,
                            strItemRecPath,
                            out tempdom,
                            out baTimestamp,
                            out strError);
                        if (nRet == -1)
                        {
                            strError = "提取册记录 " + strItemRecPath + " 时发生错误:" + strError;
                            return(-1);
                        }

                        strBiblioRecPath = strBiblioDbName + "/" + DomUtil.GetElementText(tempdom.DocumentElement, "parent");

                        DoublePath dpath = new DoublePath();
                        dpath.ItemRecPath   = strItemRecPath;
                        dpath.BiblioRecPath = strBiblioRecPath;

                        paths.Add(dpath);
                    }

                    // 如果不需要查重,则遇到命中后尽快退出循环
                    if (bDetectDup == false && paths.Count >= 1)
                    {
                        return(paths.Count);
                    }
                }

                return(paths.Count);
            }
            finally
            {
                this.SearchPanel.EndLoop();
            }
        }
コード例 #5
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;
        }
コード例 #6
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);
        }
コード例 #7
0
ファイル: RegisterBarcodeDlg.cs プロジェクト: renyh1013/dp2
        // 根据册条码号在一系列可能的实体库中检索出册信息,
        // 然后提取出有关种的信息
        int GetLinkInfoFromBarcode(string strBarcode,
            bool bDetectDup,
            out List<DoublePath> paths,
            out string strError)
        {
            strError = "";
            // strBiblioRecPath = "";
            // strItemRecPath = "";

            paths = new List<DoublePath>();

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

            // 获得cfgs/global配置文件
            int nRet = GetGlobalCfgFile(out strError);
            if (nRet == -1)
                return -1;

            // 列出所有<dblink>配置事项
            XmlNodeList nodes = this.dom.DocumentElement.SelectNodes("//dblink");
            if (nodes.Count == 0)
            {
                strError = "cfgs/global配置文件中,尚未配置任何<dblink>元素。";
                return -1;
            }


            this.SearchPanel.BeginLoop("正在检索 " + strBarcode + " 所对应的册信息...");
            try
            {
                for (int i = 0; i < nodes.Count; i++)
                {
                    XmlNode node = nodes[i];
                    string strBiblioDbName = DomUtil.GetAttr(node, "bibliodb");
                    string strItemDbName = DomUtil.GetAttr(node, "itemdb");

                    // 2007/4/5 改造 加上了 GetXmlStringSimple()
                    string strQueryXml = "<target list='"
                        + StringUtil.GetXmlStringSimple(strItemDbName + ":" + "册条码")       // 2007/9/14
                        + "'><item><word>"
                        + StringUtil.GetXmlStringSimple(strBarcode)
                        + "</word><match>exact</match><relation>=</relation><dataType>string</dataType><maxCount>-1</maxCount></item><lang>" + this.Lang + "</lang></target>";

                    // strItemRecPath = "";
                    List<string> aPath = null;

                    nRet = this.SearchPanel.SearchMultiPath(
                        this.ServerUrl,
                        strQueryXml,
                        1000,
                        out aPath,
                        out strError);
                    if (nRet == -1)
                        return -1;
                    if (nRet == 0)
                        continue;

                    for (int j = 0; j < aPath.Count; j++)
                    {
                        strItemRecPath = aPath[j];

                        XmlDocument tempdom = null;
                        byte[] baTimestamp = null;
                        // 提取册记录
                        nRet = this.SearchPanel.GetRecord(
                            this.ServerUrl,
                            strItemRecPath,
                            out tempdom,
                            out baTimestamp,
                            out strError);
                        if (nRet == -1)
                        {
                            strError = "提取册记录 " + strItemRecPath + " 时发生错误:" + strError;
                            return -1;
                        }

                        strBiblioRecPath = strBiblioDbName + "/" + DomUtil.GetElementText(tempdom.DocumentElement, "parent");

                        DoublePath dpath = new DoublePath();
                        dpath.ItemRecPath = strItemRecPath;
                        dpath.BiblioRecPath = strBiblioRecPath;

                        paths.Add(dpath);
                    }

                    // 如果不需要查重,则遇到命中后尽快退出循环
                    if (bDetectDup == false && paths.Count >= 1)
                        return paths.Count;
                }

                return paths.Count;
            }
            finally
            {
                this.SearchPanel.EndLoop();
            }
        }