Exemplo n.º 1
0
        /// <summary>
        /// 新建地址事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btNewAddr_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (selectedConsumer != null)
            {
                ConsumerAddressAdd dialog = new ConsumerAddressAdd();
                dialog.Text         = "新建地址";
                dialog.ConsumerNick = selectedConsumer.nick;
                if (DialogResult.OK == dialog.ShowDialog())
                {
                    Alading.Entity.ConsumerAddress addr = new Alading.Entity.ConsumerAddress();
                    addr.buyer_nick        = selectedConsumer.nick;
                    addr.location_country  = dialog.ConsumerCountry;
                    addr.location_state    = dialog.ConsumerProvince;
                    addr.location_city     = dialog.ConsumerCity;
                    addr.location_district = dialog.ConsumerCounty;
                    addr.location_address  = dialog.ConsumerAddress;
                    addr.location_zip      = dialog.ConsumerZip;

                    Alading.Core.Enum.ReturnType result
                        = Alading.Business.ConsumerAddressService.AddConsumerAddress(addr);

                    if (result == Alading.Core.Enum.ReturnType.Success)
                    {
                        consumerAddressList.Add(addr);
                        gcAddrGrid.DataSource = null;
                        gcAddrGrid.DataSource = consumerAddressList;
                    }
                    else
                    {
                        XtraMessageBox.Show("保存数据失败!");
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void btSave_Click(object sender, EventArgs e)
        {
            //TODO: (WXC) 保存对客户的更改
            if (selectedConsumer != null)
            {
                selectedConsumer.nick             = txConsumerName.Text;
                selectedConsumer.buyer_name       = txBuyer.Text;
                selectedConsumer.location_address = txAddr.Text;
                selectedConsumer.buyer_zip        = txZipcode.Text;
                selectedConsumer.alipay           = txZhifubao.Text;
                selectedConsumer.phone            = txTel.Text;
                selectedConsumer.mobilephone      = txMobile.Text;
                selectedConsumer.email            = txEmail.Text;
                selectedConsumer.score            = Convert.ToInt32(txCredit.Text);

                selectedConsumer.location_state    = selectedProvinceIndex >= 0 ? provinceList[selectedProvinceIndex].name : string.Empty;
                selectedConsumer.location_city     = selectedCityIndex >= 0 ? cityList[selectedCityIndex].name : string.Empty;
                selectedConsumer.location_district = selectedCountyIndex >= 0 ? countyList[selectedCountyIndex].name : string.Empty;

                selectedConsumer.source = cbSource.SelectedIndex;

                Alading.Core.Enum.ReturnType result = Alading.Business.ConsumerService.UpdateConsumer(selectedConsumer);
                if (result == Alading.Core.Enum.ReturnType.Success)
                {
                    //刷新表格中的数据
                    gcConsumerGrid.DataSource = null;
                    gcConsumerGrid.DataSource = consumerList;
                }
                else
                {
                    XtraMessageBox.Show("更新数据失败!");
                }
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// 删除地址事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btDelAddr_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (selectedConsumer != null && selectedConsumerAddress != null)
     {
         Alading.Core.Enum.ReturnType result
             = Alading.Business.ConsumerAddressService.RemoveConsumerAddress(selectedConsumerAddress.ConsumerAddressID);
         if (result == Alading.Core.Enum.ReturnType.Success)
         {
             consumerAddressList.Remove(selectedConsumerAddress);
             gcAddrGrid.DataSource = null;
             gcAddrGrid.DataSource = consumerAddressList;
         }
         else
         {
             XtraMessageBox.Show("保存数据失败!");
         }
     }
 }
Exemplo n.º 4
0
        private void btNewConsumer_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //TODO: (WXC) 添加客户
            ConsumerAdd consumerAdd = new ConsumerAdd();

            if (DialogResult.OK == consumerAdd.ShowDialog())
            {
                Alading.Entity.Consumer      consumer = consumerAdd.GetNewConsumer();
                Alading.Core.Enum.ReturnType result   = Alading.Business.ConsumerService.AddConsumer(consumer);
                if (result == Alading.Core.Enum.ReturnType.Success)
                {
                    LoadStrategy = new LoadAllConsumer();
                    LoadAllConsumer();
                }
                //do when insert data is failed
                else
                {
                    XtraMessageBox.Show("保存数据失败!");
                }
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 编辑地址事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btEditAddr_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (selectedConsumer != null && selectedConsumerAddress != null)
            {
                ConsumerAddressAdd dialog = new ConsumerAddressAdd();
                dialog.Text             = "编辑地址";
                dialog.ConsumerNick     = selectedConsumer.nick;
                dialog.ConsumerProvince = selectedConsumerAddress.location_state;
                dialog.ConsumerCity     = selectedConsumerAddress.location_city;
                dialog.ConsumerCounty   = selectedConsumerAddress.location_district;
                dialog.ConsumerAddress  = selectedConsumerAddress.location_address;
                dialog.ConsumerZip      = selectedConsumerAddress.location_zip;

                if (DialogResult.OK == dialog.ShowDialog())
                {
                    selectedConsumerAddress.location_country  = dialog.ConsumerCountry;
                    selectedConsumerAddress.location_state    = dialog.ConsumerProvince;
                    selectedConsumerAddress.location_city     = dialog.ConsumerCity;
                    selectedConsumerAddress.location_district = dialog.ConsumerCounty;
                    selectedConsumerAddress.location_address  = dialog.ConsumerAddress;
                    selectedConsumerAddress.location_zip      = dialog.ConsumerZip;

                    Alading.Core.Enum.ReturnType result
                        = Alading.Business.ConsumerAddressService.UpdateConsumerAddress(selectedConsumerAddress);
                    if (result == Alading.Core.Enum.ReturnType.Success)
                    {
                        gcAddrGrid.DataSource = null;
                        gcAddrGrid.DataSource = consumerAddressList;
                    }
                    else
                    {
                        XtraMessageBox.Show("保存数据失败!");
                    }
                }
            }
        }