private void cbxStreet_SelectionChangeCommitted(object sender, EventArgs e) { ArrayList arrList = new ArrayList(); string areaId = cbxStreet.SelectedValue.ToString().ToLower(); if (areaId != null) { JavaScriptSerializer jss = new JavaScriptSerializer(); foreach (var row in arrListCommunity) { string str = row.ToString(); str = str.Replace("\n", string.Empty).Replace("\r", string.Empty); DictionaryItem js = jss.Deserialize <DictionaryItem>(str); if (areaId == js.ParentId.ToString().ToLower()) { arrList.Add(row); } } cbxCommunity.DataSource = arrList; cbxCommunity.ValueMember = "ItemId"; cbxCommunity.DisplayMember = "ItemName"; cbxCommunity.SelectedIndex = 0; } }
private void banDingComboBoxData() { dynamic streetAndCommunityInfo = DictionaryItem.getStreetAndCommunity(GovVar.Area1); foreach (var row in streetAndCommunityInfo) { if (row.Levels.Value == 4) { arrListStreet.Add(row); } else if (row.Levels.Value == 5) { arrListCommunity.Add(row); } } cbxStreet.DataSource = arrListStreet; cbxStreet.ValueMember = "ItemId"; cbxStreet.DisplayMember = "ItemName"; //cbxStreet.SelectedIndex = -1; //cbxCommunity.DataSource = arrListCommunity; //cbxCommunity.ValueMember = "ItemId"; //cbxCommunity.DisplayMember = "ItemName"; //cbxCommunity.SelectedIndex = -1; cbxResidentBizId.DataSource = DictionaryItem.getDictionaryItemList("01005"); cbxResidentBizId.ValueMember = "ItemId"; cbxResidentBizId.DisplayMember = "ItemName"; //cbxResidentBizId.SelectedIndex = -1; cbxAccountType.DataSource = DictionaryItem.getDictionaryItemList("00016"); cbxAccountType.ValueMember = "ItemId"; cbxAccountType.DisplayMember = "ItemName"; //cbxAccountType.SelectedIndex = -1; cbxEducationLevel.DataSource = DictionaryItem.getDictionaryItemList("00017"); cbxEducationLevel.ValueMember = "ItemId"; cbxEducationLevel.DisplayMember = "ItemName"; //cbxEducationLevel.SelectedIndex = -1; cbxMarriage.DataSource = DictionaryItem.getDictionaryItemList("00018"); cbxMarriage.ValueMember = "ItemId"; cbxMarriage.DisplayMember = "ItemName"; //cbxMarriage.SelectedIndex = -1; cbxLivingStatus.DataSource = DictionaryItem.getDictionaryItemList("00019"); cbxLivingStatus.ValueMember = "ItemId"; cbxLivingStatus.DisplayMember = "ItemName"; //cbxLivingStatus.SelectedIndex = -1; cbxHousingStatus.DataSource = DictionaryItem.getDictionaryItemList("00020"); cbxHousingStatus.ValueMember = "ItemId"; cbxHousingStatus.DisplayMember = "ItemName"; //cbxHousingStatus.SelectedIndex = -1; cbxIncomeStatus.DataSource = DictionaryItem.getDictionaryItemList("00021"); cbxIncomeStatus.ValueMember = "ItemId"; cbxIncomeStatus.DisplayMember = "ItemName"; //cbxIncomeStatus.SelectedIndex = -1; cbxNation.DataSource = DictionaryItem.getDictionaryItemList("00022"); cbxNation.ValueMember = "ItemId"; cbxNation.DisplayMember = "ItemName"; //cbxNation.SelectedIndex = -1; dynamic dyCitys = DictionaryItem.getDictionaryItemList("00005"); ArrayList arrCitys = new ArrayList(); ArrayList arrCounty = new ArrayList(); foreach (var row in dyCitys) { int len = row.ItemCode.Value.Length; if (len == 4) { arrCitys.Add(row); } else if (len == 6) { arrCounty.Add(row); } } cbxNativePlace.DataSource = arrCitys; cbxNativePlace.ValueMember = "ItemId"; cbxNativePlace.DisplayMember = "ItemName"; //cbxNativePlace.SelectedIndex = -1; cbxHouseholdRegister.DataSource = arrCitys; cbxHouseholdRegister.ValueMember = "ItemId"; cbxHouseholdRegister.DisplayMember = "ItemName"; //cbxHouseholdRegister.SelectedIndex = -1; cbxResidentialOfHometown.DataSource = arrCounty; cbxResidentialOfHometown.ValueMember = "ItemId"; cbxResidentialOfHometown.DisplayMember = "ItemName"; //cbxResidentialOfHometown.SelectedIndex = -1; }