private void comboBoxRequestedCarType_SelectedIndexChanged(object sender, EventArgs e) { try { CoreWebService.CarTypeAttributeListResponse carTypeatrributes = client.listCarTypeAttributes((int)comboBoxRequestedCarType.SelectedValue); if (carTypeatrributes.Status == 0) { listBoxCarTypeAttributes.DisplayMember = "attribute"; listBoxCarTypeAttributes.ValueMember = "ID"; listBoxCarTypeAttributes.DataSource = carTypeatrributes.Data; listBoxCarTypeAttributes.ClearSelected(); } CoreWebService.BillOfLadingCarTypeAttributesListResponse rollingStockAttribute = client.listBillOfLadingCartypeAttribute((int)listBoxBillOfLading.SelectedValue); for (int i = 0; i < rollingStockAttribute.Data.Length; i++) { listBoxCarTypeAttributes.SelectedValue = rollingStockAttribute.Data[i].carTypeAttributeID; int r = listBoxCarTypeAttributes.SelectedIndex; listBoxCarTypeAttributes.SetSelected(r, true); } } catch (NullReferenceException) { } }
private void buttonDelete_Click(object sender, EventArgs e) { int i = listBoxBillOfLading.SelectedIndex; CoreWebService.BillOfLadingCarTypeAttributesListResponse carTypeAttribute = client.deleteBillOfLadingCartypeAttribute((int)listBoxBillOfLading.SelectedValue); if (carTypeAttribute.Status != 0) { MessageBox.Show(carTypeAttribute.Message); } CoreWebService.BillOfLadingPathListResponse path = client.deleteBillOfLadingPath((int)listBoxBillOfLading.SelectedValue); if (path.Status != 0) { MessageBox.Show(path.Message); } CoreWebService.BillOfLadingResponse waybillTemplate = client.deleteBillOfLading((int)listBoxBillOfLading.SelectedValue); if (waybillTemplate.Status != 0) { MessageBox.Show(waybillTemplate.Message); } listBoxBillOfLading.SelectedIndex = i - 1; listBoxBillOfLading_SelectedIndexChanged(this, null); }