コード例 #1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSearch2_Click(object sender, EventArgs e)
        {
            var sendArea    = BaiduMapHelper.GetProvCityDistFromBaiduMap(txtSendAddress.Text);
            var receiveArea = BaiduMapHelper.GetProvCityDistFromBaiduMap(txtReceiveAddress.Text);

            if (sendArea != null && receiveArea != null)
            {
                var selectedRemark = new List <string>()
                {
                    sendArea.Result.AddressComponent.Province, sendArea.Result.AddressComponent.City, sendArea.Result.AddressComponent.District
                };
                var selectedReceiveMark = new List <string>()
                {
                    receiveArea.Result.AddressComponent.Province, receiveArea.Result.AddressComponent.City, receiveArea.Result.AddressComponent.District
                };
                var printMarkEntity = BillPrintHelper.GetZtoPrintMark(string.Join(",", selectedRemark), txtSendAddress.Text, string.Join(",", selectedReceiveMark), txtReceiveAddress.Text);
                if (printMarkEntity != null)
                {
                    txtMark2.Text      = printMarkEntity.Result.Mark;
                    txtPrintMark2.Text = printMarkEntity.Result.PrintMark;
                }
                else
                {
                    XtraMessageBox.Show(@"未提取到大头笔信息", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            else
            {
                XtraMessageBox.Show(@"地址填写不详细", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
コード例 #2
0
        private void BindPrintMark()
        {
            if (dgvSearchSendArea.Text.Trim().Length == 0)
            {
                // 获取系统默认发件人的省市区信息绑定就可以了,网点提供解决方案
                ZtoUserManager userManager = new ZtoUserManager(BillPrintHelper.DbHelper);
                var            userList    = userManager.GetList <ZtoUserEntity>(new KeyValuePair <string, object>(ZtoUserEntity.FieldIsDefault, 1), new KeyValuePair <string, object>(ZtoUserEntity.FieldIssendorreceive, 1));
                if (userList.Any())
                {
                    dgvSearchSendArea.Text = string.Format("{0}-{1}-{2}", userList.First().Province, userList.First().City, userList.First().County);
                }
                else
                {
                    XtraMessageBox.Show(@"发件区域填写不正确,请重新填写", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            if (dgvSearchReceiveArea.Text.Trim().Length == 0)
            {
                return;
            }
            var sendAreaArray = dgvSearchSendArea.Text.Split('-');

            if (sendAreaArray.Length != 3)
            {
                sendAreaArray = new[] { "", "", "" };
            }
            var receiveAreaArray = dgvSearchReceiveArea.Text.Split('-');

            if (receiveAreaArray.Length != 3)
            {
                XtraMessageBox.Show(@"收件区域填写不正确,请重新填写", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Error);
                dgvSearchReceiveArea.Focus();
                return;
            }
            var selectedRemark = new List <string>()
            {
                sendAreaArray[0], sendAreaArray[1], sendAreaArray[2]
            };
            var selectedReceiveMark = new List <string>()
            {
                receiveAreaArray[0], receiveAreaArray[1], receiveAreaArray[2]
            };
            var printMarkEntity = BillPrintHelper.GetZtoPrintMark(string.Join(",", selectedRemark), null, string.Join(",", selectedReceiveMark), null);

            if (printMarkEntity != null)
            {
                txtPrint.Text     = printMarkEntity.Result.Mark;
                txtPrintMark.Text = printMarkEntity.Result.PrintMark;
            }
            else
            {
                XtraMessageBox.Show(@"未提取到大头笔信息", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }