コード例 #1
0
 /// <summary>
 /// 省份
 /// </summary>
 public void getProvince()
 {
     try
     {
         ResultModelOfArrayOfModel_Regiond4FqxSXX prov = cs.GetRegionInfo(1, true);
         if (prov.Code != 0)
         {
             MessageBox.Show(prov.Message);
         }
         else
         {
             List <Model_Region> regions = new List <Model_Region>();
             Model_Region        reg     = new Model_Region();
             reg.Idk__BackingField   = 0;
             reg.Namek__BackingField = "中国";
             regions.Add(reg);
             foreach (Model_Region item in prov.Data)
             {
                 Model_Region regs = new Model_Region();
                 regs.Idk__BackingField       = item.Idk__BackingField;
                 regs.Namek__BackingField     = item.Namek__BackingField;
                 regs.ParentIdk__BackingField = item.ParentIdk__BackingField;
                 regions.Add(regs);
             }
             cmbProvince.DisplayMember = "Namek__BackingField";
             cmbProvince.ValueMember   = "Idk__BackingField";
             cmbProvince.DataSource    = regions;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }