public void Test_GetTyre() { int savedId = Product.GetNextAvailableId(); Tyre testTyre = new Tyre (savedId, "215/55X21 DSI JAPAN TYRE", "DSI", "215/55X21", "JAPAN", 1000, 1); Tyre.AddNewTyre(testTyre); Assert.AreEqual (testTyre.Name, Tyre.GetTyres(id: savedId.ToString()).ElementAt(0).Name); Assert.AreEqual (testTyre.Name, Tyre.GetTyres(name: testTyre.Name).ElementAt(0).Name); }
public OrderWindow() { try { InitializeComponent(); _orderEntriesList = new List <OrderEntry>(); _itemSource = Tyre.GetTyres(); ComboBox.ItemsSource = Item.GetItemTypes(); _product = ComboBox.SelectedItem.ToString(); SetInvoiceNumber(); } catch (Exception ex) { log.Error(ex.Message); MessageBox.Show("Exception : " + ex.Message); } }
private void LoadItemSource(string id = "%", string name = "%") { switch (_selectedItemType) { case "Tyre": _itemSource = Tyre.GetTyres(id, name); break; case "Alloy Wheel": _itemSource = AlloyWheel.GetAlloyWheels(id, name); break; case "Battery": _itemSource = Battery.GetBatteries(id, name); break; } }
private void comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { _product = ComboBox.SelectedItem.ToString(); //assign the name of the item type if (_product.Equals("Alloy Wheel")) { _itemSource = AlloyWheel.GetAlloyWheels(); } else if (_product.Equals("Battery")) { _itemSource = Battery.GetBatteries(); } else if (_product.Equals("Tyre")) { _itemSource = Tyre.GetTyres(); } RefreshSearchDataGrid(); }
private void SearchTextBox_TextChanged(object sender, TextChangedEventArgs e) { var textBox = sender as TextBox; if (textBox?.Text != DefaultSearchText) { if (_product.Equals("Tyre")) { _itemSource = Tyre.GetTyres(name: textBox?.Text); DataGridSearch.ItemsSource = _itemSource; } else if (_product.Equals("Alloy Wheel")) { _itemSource = AlloyWheel.GetAlloyWheels(name: textBox?.Text); DataGridSearch.ItemsSource = _itemSource; } else if (_product.Equals("Battery")) { _itemSource = Battery.GetBatteries(name: textBox?.Text); DataGridSearch.ItemsSource = _itemSource; } } }