Ejemplo n.º 1
0
        private void ParseEditedAddress()
        {
            string[] infos = _order.EditedRecipientAddress.Split(',');
            if (null == infos || infos.Length <= 0)
            {
                return;
            }

            int i = 0;

            // first segment should be recipient name.
            txtRecipientName.Text = infos[i++].Trim();

            // second segment should be mobile number.
            txtMobile.Text = infos[i++].Trim();

            if (infos.Length >= 5)
            {
                txtPhone.Text = infos[i++].Trim();
            }

            AddressParser ap = new AddressParser(infos[i++].Trim());

            txtProvince.Text      = ap.Province;
            txtCity1.Text         = ap.City1;
            txtCity2.Text         = ap.City2;
            txtDistrict.Text      = ap.District;
            txtStreetAddress.Text = ap.StreetAddress;
        }
Ejemplo n.º 2
0
        public AddressWithRecipientPhoneParser(string fullAddrWithRecipientPhone)
        {
            _fullAddrWithRecipientPhone = fullAddrWithRecipientPhone.Replace(",", ",");

            // 取出并去掉头上的收件人和电话信息.
            string[] infos = fullAddrWithRecipientPhone.Replace(",", ",").Split(',');
            if (null == infos || infos.Length <= 0)
            {
                return;
            }

            int i = 0;

            // first segment should be recipient name.
            _recipient = infos[i++].Trim();

            // second segment should be mobile number.
            _mobile = infos[i++].Trim();

            if (infos.Length >= 5)
            {
                _phone = infos[i++].Trim();
            }

            _addressParser = new AddressParser(infos[i++]);
        }
Ejemplo n.º 3
0
        private void ConsignShForm_Load(object sender, EventArgs e)
        {
            txtBuyerAccount.Text = _order.BuyerAccount;
            txtRemark.Text       = _order.Remark;
            txtBuyerRemark.Text  = _order.BuyerRemark;

            // address info.
            if (string.IsNullOrEmpty(_order.EditedRecipientAddress))
            {
                AddressParser ap = new AddressParser(_order.RecipientAddress);
                txtRecipientName.Text = _order.RecipientName;
                txtProvince.Text      = ap.Province;
                txtCity1.Text         = ap.City1;
                txtCity2.Text         = ap.City2;
                txtDistrict.Text      = ap.District;
                txtStreetAddress.Text = ap.StreetAddress;
                txtMobile.Text        = _order.MobileNumber;
                txtPhone.Text         = _order.PhoneNumber;
            }
            else
            {
                txtRecipientName.BackColor = Color.FromArgb(255, 200, 200);
                txtProvince.BackColor      = Color.FromArgb(255, 200, 200);
                txtCity1.BackColor         = Color.FromArgb(255, 200, 200);
                txtCity2.BackColor         = Color.FromArgb(255, 200, 200);
                txtDistrict.BackColor      = Color.FromArgb(255, 200, 200);
                txtStreetAddress.BackColor = Color.FromArgb(255, 200, 200);
                txtMobile.BackColor        = Color.FromArgb(255, 200, 200);
                txtPhone.BackColor         = Color.FromArgb(255, 200, 200);

                ParseEditedAddress();
                //MessageBox.Show(this, "需要手动输入地址!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            // Product info.
            _soldProductInfos = GetProducts(_order.Items);
            foreach (SoldProductInfo spi in _soldProductInfos)
            {
                txtProducts.Text += string.Format("{0} x {1}\r\n", spi.ShortName, spi.Count);
            }
            if (txtProducts.Text.Length > 2 && txtProducts.Text.EndsWith("\r\n"))
            {
                txtProducts.Text = txtProducts.Text.Remove(txtProducts.Text.Length - 2, 2);                 // remove return at the end of string.
            }
            txtProducts.TextChanged += new EventHandler(txtProducts_TextChanged);
            //

            //Bitmap bmp = new Bitmap(1200, 600);//picExpressBill.BackgroundImage.Width+100, picExpressBill.BackgroundImage.Height+100);
            //Graphics g = Graphics.FromImage(bmp);
            //DrawBill(g, true);
            //picExpressBill.Image = bmp;

            txtBillNumber.Focus();

            this.Activated += new EventHandler(ConsignShForm_Activated);
        }
Ejemplo n.º 4
0
        private void ParseEditedAddress()
        {
            try
            {
                string[] infos = _orders[0].EditedRecipientAddress.Replace(",", ",").Split(',');
                if (null == infos || infos.Length <= 0)
                {
                    return;
                }

                int i = 0;

                // first segment should be recipient name.
                txtRecipientName.Text = infos[i++].Trim();

                // second segment should be mobile number.
                txtMobile.Text = infos[i++].Trim();

                if (infos.Length >= 5)
                {
                    txtMobile.Text += "," + infos[i++].Trim();
                }

                AddressParser ap = new AddressParser(infos[i++].Trim());
                txtProvince.Text      = ap.Province;
                txtCity1.Text         = ap.City1;
                txtCity2.Text         = ap.City2;
                txtDistrict.Text      = ap.District;
                txtStreetAddress.Text = ap.StreetAddress;
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    this,
                    string.Format("解析新地址出错! 火速联系KK~\n{0}\n{1}", _orders[0].EditedRecipientAddress, ex.ToString()),
                    this.Text,
                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Ejemplo n.º 5
0
        //public NingboOrder NingboOrder
        //{
        //    get { return _ningboOrder; }
        //}

        private void ConsignShForm_Load(object sender, EventArgs e)
        {
            if (_orders.Count > 1)
            {
                this.Text += string.Format(" [{0}个订单合并发货]", _orders.Count);
            }

            StringBuilder sbRemark = new StringBuilder();

            foreach (Order o in _orders)
            {
                if (string.IsNullOrEmpty(o.Remark))
                {
                    continue;
                }

                if (_orders.Count > 1)
                {
                    sbRemark.Append(string.Format("#{0}: ", _orders.IndexOf(o) + 1));
                }
                sbRemark.Append(o.Remark);
                if (_orders.IndexOf(o) < _orders.Count - 1)
                {
                    sbRemark.Append("\r\n");
                }
            }

            StringBuilder sbBuyerRemark = new StringBuilder();

            foreach (Order o in _orders)
            {
                if (string.IsNullOrEmpty(o.BuyerRemark))
                {
                    continue;
                }

                if (_orders.Count > 1)
                {
                    sbBuyerRemark.Append(string.Format("#{0}: ", _orders.IndexOf(o) + 1));
                }
                sbBuyerRemark.Append(o.BuyerRemark);
                if (_orders.IndexOf(o) < _orders.Count - 1)
                {
                    sbBuyerRemark.Append("\r\n");
                }
            }

            txtRemark.Text      = sbRemark.ToString().Trim();
            txtBuyerRemark.Text = sbBuyerRemark.ToString().Trim();

            SizeF size = Graphics.FromHwnd(this.Handle).MeasureString(txtRemark.Text, this.Font, txtRemark.Width - 6);

            txtRemark.Height = size.ToSize().Height + 6;

            // address info.
            if (string.IsNullOrEmpty(_orders[0].EditedRecipientAddress))
            {
                AddressParser ap = new AddressParser(_orders[0].RecipientAddress);
                txtRecipientName.Text = _orders[0].RecipientName.Trim();
                txtProvince.Text      = ap.Province.Trim();
                txtCity1.Text         = ap.City1.Trim();
                txtCity2.Text         = ap.City2.Trim();
                txtDistrict.Text      = ap.District.Trim();
                txtStreetAddress.Text = ap.StreetAddress.Trim();
                txtMobile.Text        = _orders[0].MobileNumber.Trim();
            }
            else
            {
                txtRecipientName.BackColor = Color.FromArgb(255, 200, 200);
                txtProvince.BackColor      = Color.FromArgb(255, 200, 200);
                txtCity1.BackColor         = Color.FromArgb(255, 200, 200);
                txtCity2.BackColor         = Color.FromArgb(255, 200, 200);
                txtDistrict.BackColor      = Color.FromArgb(255, 200, 200);
                txtStreetAddress.BackColor = Color.FromArgb(255, 200, 200);
                txtMobile.BackColor        = Color.FromArgb(255, 200, 200);

                ParseEditedAddress();
                //MessageBox.Show(this, "需要手动输入地址!", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            if (string.IsNullOrEmpty(txtCity1.Text))
            {
                if (txtProvince.Text.StartsWith("北京") || txtProvince.Text.StartsWith("上海") || txtProvince.Text.StartsWith("天津") || txtProvince.Text.StartsWith("重庆"))
                {
                    txtCity1.Text = txtProvince.Text;
                }
            }

            // Product info.
            if (!_isRefundingOrder)
            {
                int cMustSendFromDe = 0, cBonded = 0;
                _soldProductInfos = GetProducts(_orders, out cMustSendFromDe, out cBonded);
                foreach (SoldProductInfo spi in _soldProductInfos)
                {
                    txtProducts.Text += string.Format("{0} x {1}{2}\r\n", spi.ShortName, spi.Count, string.IsNullOrEmpty(spi.Comment) ? string.Empty : (" " + spi.Comment));
                }
                if (txtProducts.Text.Length > 2 && txtProducts.Text.EndsWith("\r\n"))
                {
                    txtProducts.Text = txtProducts.Text.Remove(txtProducts.Text.Length - 2, 2);                     // remove return at the end of string.
                }
                foreach (SoldProductInfo spi in _soldProductInfos)
                {
                    SoldProductInfoControl spic = new SoldProductInfoControl(spi, true);
                    spic.OnRemove         += new EventHandler(spic_OnRemove);
                    spic.OnProductChanged += new EventHandler(spic_OnProductChanged);
                    spic.OnCountChanged   += new EventHandler(spic_OnCountChanged);
                    pnlProductList.Controls.Add(spic);
                    pnlProductList.Controls.SetChildIndex(spic, pnlProductList.Controls.IndexOf(tsAddProduct));
                    spic.Margin = new Padding(3, 2, 3, 0);
                }
            }
            pnlProductList.Height    = Math.Max(115, tsAddProduct.Bottom);
            txtProducts.Height       = pnlProductList.Height;
            txtProducts.TextChanged += new EventHandler(txtProducts_TextChanged);
            //

            float money = 0;

            foreach (Order o in _orders)
            {
                money += o.TotalMoney;
            }

            lblMoney.Text = money.ToString("0.00");

            cboLogistics.Items.Add("邮政国内小包");
            cboLogistics.Items.Add("EMS");
            cboLogistics.Items.Add("中通");
            cboLogistics.SelectedIndex = 0;

            LayoutControls();
        }