Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            TMerchantTypeDTO sDto = comboBox2.SelectedItem as TMerchantTypeDTO;

            if (string.IsNullOrEmpty(sDto.MerchantId) == false)
            {
                bool result = _client.TMerchantTypeDelete(sDto.MerchantId);
                if (result)
                {
                    //更新
                    backgroundWorker1.RunWorkerAsync();
                    MessageBox.Show("删除成功!");
                }
            }
            else
            {
                TMerchantTypeDTO dto = comboBox1.SelectedItem as TMerchantTypeDTO;
                if (string.IsNullOrEmpty(dto.MerchantId) == false)
                {
                    //删除所有节点
                    TMerchantTypeDTO[] result = _client.TMerchantTypeGetByPid(dto.MerchantId);
                    foreach (var item in result)
                    {
                        _client.TMerchantTypeDelete(item.MerchantId);
                    }
                    bool result1 = _client.TMerchantTypeDelete(dto.MerchantId);
                    if (result1)
                    {
                        //更新
                        backgroundWorker1.RunWorkerAsync();
                        InitializeCombox();
                        MessageBox.Show("删除成功!");
                    }
                }
            }
        }