private void ChooseStorePlaceCombobox_SelectedValueChanged(object sender, EventArgs e) { Parcel[] parcels = _parcelController.GetParcelsByStorePlaceWithAddress( _storePlaceController.GetById(int.Parse( chooseStorePlaceCombobox.SelectedItem.ToString(). Substring(0, chooseStorePlaceCombobox.SelectedItem.ToString().IndexOf(" "))))); _sortController.setStorePlace(int.Parse( chooseStorePlaceCombobox.SelectedItem.ToString(). Substring(0, chooseStorePlaceCombobox.SelectedItem.ToString().IndexOf(" ")))); parcelsListView.Items.Clear(); _parcels.Clear(); foreach (Parcel parcel in parcels) { _parcels.Add(parcel); } if (chooseStorePlaceCombobox.SelectedItem != null) { foreach (var parcel in _parcels) { string[] parcelInfo = { parcel.Id.ToString(), parcel.SenderData.PersonalAddress.Street + ", " + parcel.SenderData.PersonalAddress.ApartmentNumber + "/" + parcel.SenderData.PersonalAddress.HomeNumber + ", " + parcel.SenderData.PersonalAddress.PostCode + " " + parcel.SenderData.PersonalAddress.City, parcel.ReceiverData.PersonalAddress.Street + ", " + parcel.ReceiverData.PersonalAddress.ApartmentNumber + "/" + parcel.ReceiverData.PersonalAddress.HomeNumber + ", " + parcel.ReceiverData.PersonalAddress.PostCode + " " + parcel.ReceiverData.PersonalAddress.City, parcel.ParcelHeight.ToString(), parcel.ParcelLength.ToString(), parcel.ParcelWidth.ToString(), parcel.ParcelWeight.ToString(), parcel.Priority.ToString(), parcel.ParcelType, parcel.ParcelStatus.ToString() }; if (!parcel.ParcelStatus.ToString().Equals("OnWayToTheCustomer") && !parcel.ParcelStatus.ToString().Equals("Delivered")) { parcelsListView.Items.Add(new ListViewItem(parcelInfo)); } } } /*string[] parcelInfo1 = { "12", * "test, "+ * "12/"+ * "12, ", * "test"}; * parcelsListView.Items.Add(new ListViewItem(parcelInfo1)); * * string[] parcelInfo2 = { "12", * "abc, "+ * "12/"+ * "12, ", * "abc"}; * parcelsListView.Items.Add(new ListViewItem(parcelInfo2));*/ //buttonLoad.Enabled = chooseStorePlaceCombobox.SelectedItem != null; //foreach (ListViewItem parcel in parcelsListView.Items) //{ // parcel.Selected = false; // if (!_availableParcels.Contains(parcel)) // { // parcelsListView.Items.Remove(parcel); // } //} //if (chooseStorePlaceCombobox.SelectedItem != null && vehiclesCargoDictionary.ContainsKey(_availableVehicles[chooseStorePlaceCombobox.SelectedIndex])) //{ // foreach (ListViewItem item in vehiclesCargoDictionary[_availableVehicles[chooseStorePlaceCombobox.SelectedIndex]]) // { // parcelsListView.Items.Add(item); // item.Selected = true; // } //} ////if (chooseVehicleCombobox.SelectedItem != null && vehiclesCargoDictionary.ContainsKey(_availableVehicles[chooseVehicleCombobox.SelectedIndex])) ////{ //// foreach(ListViewItem parcel in parcelsListView.Items) //// { //// if (vehiclesCargoDictionary[_availableVehicles[chooseVehicleCombobox.SelectedIndex]]. //// Contains(parcel)) //// { //// parcel.Selected = true; //// } //// } ////} //parcelsListView.Select(); }