private void btn_Add_Click(object sender, System.EventArgs e) { var checkItems = listBox_Unclassified.CheckedItems; var typeId = Convert.ToInt32(lookUpEdit_LayerType.EditValue); foreach (LayerInfo checkItem in checkItems) { if(checkItem!=null) { var layerCatalog = new Model.LayerCatalog { typeId = typeId, layerName = checkItem.LayerName, layerCaption = checkItem.LayerCaption }; var layerCatalogId = _bll.Add(layerCatalog); layerCatalog.id = layerCatalogId; if (layerCatalogId > 0) { (listBox_Classified.DataSource as List<Model.LayerCatalog>).Add(layerCatalog); (listBox_Unclassified.DataSource as List<LayerInfo>).Remove(checkItem); } } } listBox_Classified.UnCheckAll(); listBox_Unclassified.UnCheckAll(); }
private void btn_Add_Click(object sender, System.EventArgs e) { var checkItems = listBox_Unclassified.CheckedItems; var typeId = Convert.ToInt32(lookUpEdit_LayerType.EditValue); foreach (LayerInfo checkItem in checkItems) { if (checkItem != null) { var layerCatalog = new Model.LayerCatalog { typeId = typeId, layerName = checkItem.LayerName, layerCaption = checkItem.LayerCaption }; var layerCatalogId = _bll.Add(layerCatalog); layerCatalog.id = layerCatalogId; if (layerCatalogId > 0) { (listBox_Classified.DataSource as List <Model.LayerCatalog>).Add(layerCatalog); (listBox_Unclassified.DataSource as List <LayerInfo>).Remove(checkItem); } } } listBox_Classified.UnCheckAll(); listBox_Unclassified.UnCheckAll(); }