Exemplo n.º 1
0
        /*
         * void bindingControl1_GetItemInfo(object sender, GetItemInfoEventArgs e)
         * {
         *  if (this.GetItemInfo != null)
         *      this.GetItemInfo(sender, e);
         * }
         * */

        void bindingControl1_GetOrderInfo(object sender, GetOrderInfoEventArgs e)
        {
            if (this.GetOrderInfo != null)
            {
                this.GetOrderInfo(sender, e);
            }
        }
Exemplo n.º 2
0
        /*
         * void issueManageControl1_GenerateEntity(object sender, GenerateEntityEventArgs e)
         * {
         *  if (this.GenerateEntity != null)
         *      this.GenerateEntity(sender, e);
         * }
         * */

        void issueManageControl1_GetOrderInfo(object sender, GetOrderInfoEventArgs e)
        {
            if (this.GetOrderInfo != null)
            {
                this.GetOrderInfo(sender, e);
            }
        }
Exemplo n.º 3
0
        // 期控件要获得订购信息
        void issueControl1_GetOrderInfo(object sender,
            GetOrderInfoEventArgs e)
        {
            string strError = "";
            List<string> XmlRecords = null;
            // 根据出版时间,匹配“时间范围”符合的订购记录
            int nRet = this.orderControl1.GetOrderInfoByPublishTime(e.PublishTime,
                e.LibraryCodeList,
                out XmlRecords,
                out strError);
            if (nRet == -1)
            {
                e.ErrorInfo = strError;
                return;
            }

            e.OrderXmls = XmlRecords;
        }
Exemplo n.º 4
0
        /*
        void bindingControl1_GetItemInfo(object sender, GetItemInfoEventArgs e)
        {
            if (this.GetItemInfo != null)
                this.GetItemInfo(sender, e);
        }
         * */

        void bindingControl1_GetOrderInfo(object sender, GetOrderInfoEventArgs e)
        {
            if (this.GetOrderInfo != null)
                this.GetOrderInfo(sender, e);
        }
Exemplo n.º 5
0
        // 获得一年内的期总数
        // return:
        //      -1  出错
        //      0   无法获得
        //      1   获得
        int GetOneYearIssueCount(string strPublishYear,
            out int nValue,
            out string strError)
        {
            strError = "";
            nValue = 0;

            if (this.GetOrderInfo == null)
                return 0;   // 无法获得

            GetOrderInfoEventArgs e1 = new GetOrderInfoEventArgs();
            e1.BiblioRecPath = "";
            e1.PublishTime = strPublishYear;
            this.GetOrderInfo(this, e1);
            if (String.IsNullOrEmpty(e1.ErrorInfo) == false)
            {
                strError = "在获取本种内出版日期为 '" + strPublishYear + "' 的订购信息的过程中发生错误: " + e1.ErrorInfo;
                return -1;
            }

            if (e1.OrderXmls.Count == 0)
                return 0;

            for (int i = 0; i < e1.OrderXmls.Count; i++)
            {
                string strXml = e1.OrderXmls[i];

                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(strXml);
                }
                catch (Exception ex)
                {
                    strError = "XML装入DOM时发生错误: " + ex.Message;
                    return -1;
                }

                string strRange = DomUtil.GetElementText(dom.DocumentElement,
                    "range");

                string strIssueCount = DomUtil.GetElementText(dom.DocumentElement,
                    "issueCount");

                int nIssueCount = 0;
                try
                {
                    nIssueCount = Convert.ToInt32(strIssueCount);
                }
                catch
                {
                    continue;
                }

                float years = Global.Years(strRange);
                if (years != 0)
                {
                    nValue = Convert.ToInt32((float)nIssueCount * (1/years));
                }
            }

            return 1;
        }
Exemplo n.º 6
0
        // 检测一个出版时间是否在已经订购的范围内
        bool InOrderRange(string strPublishTime)
        {
            if (this.GetOrderInfo == null)
                return false;

            GetOrderInfoEventArgs e1 = new GetOrderInfoEventArgs();
            e1.BiblioRecPath = "";
            e1.PublishTime = strPublishTime;
            this.GetOrderInfo(this, e1);
            if (String.IsNullOrEmpty(e1.ErrorInfo) == false)
                return false;

            if (e1.OrderXmls.Count == 0)
                return false;

            return true;
        }
Exemplo n.º 7
0
        // 获得可用的最大订购时间范围
        // return:
        //      -1  error
        //      0   not found
        //      1   found
        int GetMaxOrderRange(out string strStartDate,
            out string strEndDate,
            out string strError)
        {
            strStartDate = "";
            strEndDate = "";
            strError = "";

            if (this.GetOrderInfo == null)
                return 0;

            GetOrderInfoEventArgs e1 = new GetOrderInfoEventArgs();
            e1.BiblioRecPath = "";
            e1.PublishTime = "*";
            this.GetOrderInfo(this, e1);
            if (String.IsNullOrEmpty(e1.ErrorInfo) == false)
            {
                strError = e1.ErrorInfo;
                return -1;
            }

            if (e1.OrderXmls.Count == 0)
                return 0;

            for (int i = 0; i < e1.OrderXmls.Count; i++)
            {
                string strXml = e1.OrderXmls[i];

                XmlDocument dom = new XmlDocument();
                try
                {
                    dom.LoadXml(strXml);
                }
                catch (Exception ex)
                {
                    strError = "订购XML装入DOM时发生错误: " + ex.Message;
                    return -1;
                }

                string strRange = DomUtil.GetElementText(dom.DocumentElement,
                    "range");

                string strIssueCount = DomUtil.GetElementText(dom.DocumentElement,
                    "issueCount");

                int nIssueCount = 0;
                try
                {
                    nIssueCount = Convert.ToInt32(strIssueCount);
                }
                catch
                {
                    continue;
                }

                int nRet = strRange.IndexOf("-");
                if (nRet == -1)
                {
                    strError = "时间范围 '" + strRange + "' 格式错误,缺乏-";
                    return -1;
                }

                string strStart = strRange.Substring(0, nRet).Trim();
                string strEnd = strRange.Substring(nRet + 1).Trim();

                if (strStart.Length != 8)
                {
                    strError = "时间范围 '" + strRange + "' 格式错误,左边部分字符数不为8";
                    return -1;
                }
                if (strEnd.Length != 8)
                {
                    strError = "时间范围 '" + strRange + "' 格式错误,右边部分字符数不为8";
                    return -1;
                }

                if (strStartDate == "")
                    strStartDate = strStart;
                else
                {
                    if (String.Compare(strStartDate, strStart) > 0)
                        strStartDate = strStart;
                }

                if (strEndDate == "")
                    strEndDate = strEnd;
                else
                {
                    if (String.Compare(strEndDate, strEnd) < 0)
                        strEndDate = strEnd;
                }
            }

            if (strStartDate == "")
            {
                Debug.Assert(strEndDate == "", "");
                return 0;
            }

            return 1;
        }
Exemplo n.º 8
0
        private void TreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e == null)
            {
                // 没有选中任何节点
                EanbleOrderDesignControl(false);

                // 修改工具条按钮状态
                {
                    this.toolStripButton_delete.Enabled = false;
                    this.toolStripButton_modify.Enabled = false;
                    this.toolStripButton_moveUp.Enabled = false;
                    this.toolStripButton_moveDown.Enabled = false;
                }

                return;
            }


            string strError = "";
            // 装入内容到右边

            // 如果当前TreeNode节点下面还没有订购信息,则从外部获取。最好在获取一次后,有个已经获取的标志

            TreeNode tree_node = e.Node;

            // 修改工具条按钮状态
            {
                this.toolStripButton_delete.Enabled = true;
                this.toolStripButton_modify.Enabled = true;

                int index = this.TreeView.Nodes.IndexOf(tree_node);
                if (index == 0)
                    this.toolStripButton_moveUp.Enabled = false;
                else
                    this.toolStripButton_moveUp.Enabled = true;

                if (index >= this.TreeView.Nodes.Count - 1)
                    this.toolStripButton_moveDown.Enabled = false;
                else
                    this.toolStripButton_moveDown.Enabled = true;
            }



            IssueManageItem item = (IssueManageItem)tree_node.Tag;
            Debug.Assert(item != null, "");

            List<string> XmlRecords = new List<string>();
            XmlNodeList nodes = item.dom.DocumentElement.SelectNodes("orderInfo/*");

            if (nodes.Count > 0)
            {
                for (int i = 0; i < nodes.Count; i++)
                {
                    XmlRecords.Add(nodes[i].OuterXml);
                }
            }
            else if (this.GetOrderInfo != null)
            {
                GetOrderInfoEventArgs e1 = new GetOrderInfoEventArgs();
                e1.BiblioRecPath = "";
                e1.PublishTime = item.PublishTime;
                this.GetOrderInfo(this, e1);
                if (String.IsNullOrEmpty(e1.ErrorInfo) == false)
                {
                    strError = "在获取本种内出版日期为 '" + item.PublishTime + "' 的订购信息的过程中发生错误: " + e1.ErrorInfo;
                    goto ERROR1;
                }

                XmlRecords = e1.OrderXmls;

                if (XmlRecords.Count == 0)
                {
                    this.OrderInfoMessage = "出版日期 '" + item.PublishTime + "' 没有对应的的订购信息";
                    EanbleOrderDesignControl(false);

                    item.OrderedCount = -1;
                    this.m_currentTreeNode = e.Node;
                    return;
                }
            }

            this.OrderInfoMessage = "";
            EanbleOrderDesignControl(true);

            // return:
            //      -1  error
            //      >=0 订购的总份数
            int nRet = LoadOrderDesignItems(XmlRecords,
                out strError);
            if (nRet == -1)
                goto ERROR1;

            item.OrderedCount = nRet;

            this.m_currentTreeNode = e.Node;

            return;
        ERROR1:
            MessageBox.Show(this, strError);
        }
Exemplo n.º 9
0
        /*
        void issueManageControl1_GenerateEntity(object sender, GenerateEntityEventArgs e)
        {
            if (this.GenerateEntity != null)
                this.GenerateEntity(sender, e);
        }
         * */

        void issueManageControl1_GetOrderInfo(object sender, GetOrderInfoEventArgs e)
        {
            if (this.GetOrderInfo != null)
                this.GetOrderInfo(sender, e);
        }