コード例 #1
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            List <TMerchantTypeDTO> source = new List <TMerchantTypeDTO>();

            source.Add(new TMerchantTypeDTO()
            {
                MerchatType = "未知类型"
            });

            TMerchantTypeDTO dto = comboBox1.SelectedItem as TMerchantTypeDTO;

            if (dto != null)
            {
                string             pid    = dto.MerchantId;
                TMerchantTypeDTO[] result = _client.TMerchantTypeGetByPid(pid);
                source.AddRange(result);
            }
            comboBox2.DataSource    = source;
            comboBox2.DisplayMember = "MerchatType";
            comboBox2.ValueMember   = "MerchantId";
        }
コード例 #2
0
 private static void GetSubNode(ref TreeNode node, string pid)
 {
     TMerchantTypeDTO[] result = _client.TMerchantTypeGetByPid(pid);
     if (result != null && result.Length > 0)
     {
         foreach (TMerchantTypeDTO t in result)
         {
             TreeNode sNode = new TreeNode(t.MerchatType);
             sNode.Name               = t.MerchantId;
             sNode.ToolTipText        = t.MerchantDes;
             sNode.ImageIndex         = 0;
             sNode.SelectedImageIndex = 1;
             GetSubNode(ref sNode, t.MerchantId);
             node.Nodes.Add(sNode);
         }
     }
 }