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; }
// 获得 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); }