private void Button_Click_saveMake(object sender, RoutedEventArgs e) { VehicleStorage temp = new VehicleStorage { make_id = make.Text, make_name = TextMake.Text, model_id = model.Text, model_name = TextModel.Text, yearfrom = Int32.Parse(TextYearfrom.Text), yearto = Int32.Parse(TextYearTo.Text), unique_id = ThisUniqueID, readable = TextMake.Text + "-" + TextModel.Text + "-" + TextYearfrom.Text + "-" + TextYearTo.Text }; bool flag = true; foreach (VehicleStorage g in vehiclestorageList) { if (g.Have(temp)) { flag = false; break; } } if (flag) { vehiclestorageList.Add(temp); ListBoxMake.ItemsSource = null; ListBoxMake.ItemsSource = vehiclestorageList; ListBoxMake.DisplayMemberPath = "readable"; ListBoxMake.SelectedValuePath = "IDStore"; DropdownButtonMake.IsOpen = false; } }
public bool Have(VehicleStorage temp) { if ( temp.model_id == model_id && temp.make_id == make_id && temp.yearfrom == yearfrom && temp.yearto == yearto //temp.unique_id == unique_id ) { return(true); } return(false); }
private void Button_Click_CarSearchMake(object sender, RoutedEventArgs e) { try { VehicleStorage temp = (VehicleStorage)ListBoxMake_Second.SelectedItem; CargrSearchMakeName = temp.make_name; CargrSearchModelName = temp.model_name; OpenBrowserCargr(); ListBoxMake_Second.ItemsSource = null; ChildWindowMake.WindowState = Xceed.Wpf.Toolkit.WindowState.Closed; } catch (Exception) { return; } }