コード例 #1
0
ファイル: OrderEditForm.cs プロジェクト: liuyanchen1994/dp2
        void EditDistributeButton_Click(object sender, EventArgs e)
        {
            bool bControl = Control.ModifierKeys == Keys.Control;

            string strCopy = this.orderEditControl_editing.Copy;

            string strNewCopy = "";
            string strOldCopy = "";

            OrderDesignControl.ParseOldNewValue(strCopy,
                                                out strOldCopy,
                                                out strNewCopy);
            int copy = -1;

            Int32.TryParse(OrderDesignControl.GetCopyFromCopyString(strOldCopy), out copy);

            string           strDistribute = this.orderEditControl_editing.Distribute;
            DistributeDialog dlg           = new DistributeDialog();

            MainForm.SetControlFont(dlg, this.Font, false);
            dlg.DistributeString = strDistribute;
            if (bControl == false)
            {
                dlg.Count = copy;
            }
            dlg.GetValueTable += dlg_GetValueTable;
            Program.MainForm.AppInfo.LinkFormState(dlg, "DistributeDialog_state");
            dlg.ShowDialog(this);
            if (dlg.DialogResult == System.Windows.Forms.DialogResult.Cancel)
            {
                return;
            }
            this.orderEditControl_editing.Distribute = dlg.DistributeString;
        }
コード例 #2
0
ファイル: BatchOrderScript.cs プロジェクト: gvhung/dp2
 public int getArriveCount(string copy)
 {
     try
     {
         return(Convert.ToInt32(OrderDesignControl.GetCopyFromCopyString(copy)));
     }
     catch
     {
         return(-1);  // error
     }
 }
コード例 #3
0
        // 检查各个字段内容是否正确
        // return:
        //      -1  有错
        //      0   正确
        public int VerifyFields(out string strError)
        {
            strError = "";
            int nRet = 0;

            string strRange     = this.Range;
            string strOrderTime = this.OrderTime;

            if (string.IsNullOrEmpty(strRange) == false)
            {
                // 检查出版时间范围字符串是否合法
                // 如果使用单个出版时间来调用本函数,也是可以的
                // return:
                //      -1  出错
                //      0   正确
                nRet = LibraryServerUtil.CheckPublishTimeRange(strRange,
                                                               true, // TODO: 期刊要用 false
                                                               out strError);
                if (nRet == -1)
                {
                    return(-1);
                }
            }

            if (string.IsNullOrEmpty(strOrderTime) == false)
            {
                try
                {
                    DateTime time = DateTimeUtil.FromRfc1123DateTimeString(strOrderTime);
                    if (time.Year == 1753)
                    {
                        strError = "订购时间字符串 '" + strOrderTime + "' 这是一个不太可能的时间";
                        return(-1);
                    }
                }
                catch (Exception ex)
                {
                    strError = "订购时间字符串 '" + strOrderTime + "' 格式错误: " + ex.Message;
                    return(-1);
                }
            }

            // 验证馆藏分配字符串
            string strDistribute = this.Distribute;

            if (string.IsNullOrEmpty(strDistribute) == false)
            {
                LocationCollection locations = new LocationCollection();
                nRet = locations.Build(strDistribute, out strError);
                if (nRet == -1)
                {
                    strError = "馆藏分配字符串 '" + strDistribute + "' 格式错误: " + strError;
                    return(-1);
                }
            }

            if (this.FixedPrice.StartsWith("@") == false &&
                this.Price.StartsWith("@") == false &&
                string.IsNullOrEmpty(this.FixedPrice) == false &&
                string.IsNullOrEmpty(this.Price) == false)
            {
                // 检查码洋、折扣和单价之间的关系
                // return:
                //      -2  码洋和订购价货币单位不同,无法进行校验。
                //      -1  校验过程出错
                //      0   校验发现三者关系不正确
                //      1   校验三者关系正确
                nRet = OrderDesignControl.VerifyOrderPriceByFixedPricePair(
                    this.FixedPrice,
                    this.Discount,
                    this.Price,
                    "both",
                    out strError);
                if (nRet != 1 && nRet != -2)
                {
                    strError = "校验码洋、折扣和单价三者之间关系时出现错误: " + strError;
                    return(-1);
                }
            }

            return(0);
        }
コード例 #4
0
ファイル: OrderList.cs プロジェクト: gvhung/dp2
        // 获得 OrderStore 对象的一些字段值,用于合并
        static Hashtable GetValues(OrderStore order)
        {
            string strError = "";

            Hashtable result = new Hashtable();

            XmlDocument dom = new XmlDocument();

            dom.LoadXml(order.Xml);

            string strRefID = DomUtil.GetElementText(dom.DocumentElement,
                                                     "refID");

            result["seller"] = DomUtil.GetElementText(dom.DocumentElement,
                                                      "seller");

            // 渠道地址
            result["sellerAddress"] = DomUtil.GetElementText(dom.DocumentElement,
                                                             "sellerAddress");

            {
                // 单价
                string strPrice = DomUtil.GetElementText(dom.DocumentElement,
                                                         "price");

                string strAcceptPrice = "";

                // price取其中的订购价部分
                {
                    string strOldPrice = "";
                    string strNewPrice = "";

                    // 分离 "old[new]" 内的两个值
                    OrderDesignControl.ParseOldNewValue(strPrice,
                                                        out strOldPrice,
                                                        out strNewPrice);

                    strPrice       = strOldPrice;
                    strAcceptPrice = strNewPrice;
                }

                result["price"]       = strPrice;
                result["acceptPrice"] = strAcceptPrice;
            }

            result["catalogNo"] = DomUtil.GetElementText(dom.DocumentElement,
                                                         "catalogNo");


            result["issueCount"] = DomUtil.GetElementText(dom.DocumentElement,
                                                          "issueCount");

            result["range"] = DomUtil.GetElementText(dom.DocumentElement,
                                                     "range");

            {
                string strTempCopy = DomUtil.GetElementText(dom.DocumentElement,
                                                            "copy");

                string strTempAcceptCopy = "";
                {
                    string strOldCopy = "";
                    string strNewCopy = "";
                    // 分离 "old[new]" 内的两个值
                    OrderDesignControl.ParseOldNewValue(strTempCopy,
                                                        out strOldCopy,
                                                        out strNewCopy);
                    strTempCopy       = strOldCopy;
                    strTempAcceptCopy = strNewCopy;
                }

                int    nCopy       = 0;
                string strLeftCopy = OrderDesignControl.GetCopyFromCopyString(strTempCopy);
                if (string.IsNullOrEmpty(strLeftCopy) == false)
                {
                    try
                    {
                        nCopy = Convert.ToInt32(strLeftCopy);
                    }
                    catch (Exception ex)
                    {
                        strError = "原始数据事项 " + strRefID + " 内复本数字 '" + strLeftCopy + "' 格式不正确: " + ex.Message;
                        throw new Exception(strError);
                    }
                }

                result["copy"] = nCopy;

                int nSubCopy = 1;
                {
                    string strRightCopy = OrderDesignControl.GetRightFromCopyString(strTempCopy);
                    if (String.IsNullOrEmpty(strRightCopy) == false)
                    {
                        try
                        {
                            nSubCopy = Convert.ToInt32(strRightCopy);
                        }
                        catch (Exception ex)
                        {
                            strError = "原始数据事项 " + strRefID + " 内每套册数 '" + strRightCopy + "' 格式不正确: " + ex.Message;
                            throw new Exception(strError);
                        }
                    }
                }

                result["subcopy"] = nSubCopy;

                int nAcceptSubCopy = 1;
                {
                    string strRightCopy = OrderDesignControl.GetRightFromCopyString(strTempAcceptCopy);
                    if (String.IsNullOrEmpty(strRightCopy) == false)
                    {
                        try
                        {
                            nAcceptSubCopy = Convert.ToInt32(strRightCopy);
                        }
                        catch (Exception ex)
                        {
                            strError = "原始数据事项 " + strRefID + " 内已到每套册数 '" + strRightCopy + "' 格式不正确: " + ex.Message;
                            throw new Exception(strError);
                        }
                    }
                }
            }

            return(result);
        }