예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            bool             result = true;
            TMerchantTypeDTO sDto   = comboBox2.SelectedItem as TMerchantTypeDTO;

            //新增
            if (sDto == null)
            {
                string           pid = string.Empty;
                TMerchantTypeDTO dto = comboBox1.SelectedItem as TMerchantTypeDTO;
                if (dto != null && string.IsNullOrEmpty(dto.MerchantId) == false)
                {
                    pid = dto.MerchantId;
                }
                sDto = new TMerchantTypeDTO()
                {
                    MerchantId  = Guid.NewGuid().ToString(),
                    MerchatType = comboBox2.Text,
                    MerchantDes = textBox1.Text,
                    ParentId    = pid
                };
                result = _client.TMerchantTypeAdd(sDto);
            }
            else
            {
                result = _client.TMerchantTypeUpdate(sDto);
            }
            if (result)
            {
                //更新
                backgroundWorker1.RunWorkerAsync();
                InitializeCombox();
                MessageBox.Show("保存成功!");
            }
        }