Ejemplo n.º 1
0
        public void Test_GetAlloyWheel()
        {
            int        savedId        = Product.GetNextAvailableId();
            AlloyWheel testAlloyWheel = new AlloyWheel
                                            (savedId, "215/55X21 MAX ALLOYWHEEL", 1, 1000, "MAX", "215/55X20");

            AlloyWheel.AddNewAlloyWheel(testAlloyWheel);

            Assert.AreEqual
                (testAlloyWheel.Name, AlloyWheel.GetAlloyWheels(id: savedId.ToString()).ElementAt(0).Name);
            Assert.AreEqual
                (testAlloyWheel.Name, AlloyWheel.GetAlloyWheels(name: testAlloyWheel.Name).ElementAt(0).Name);
        }
Ejemplo n.º 2
0
        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;
            }
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
0
        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;
                }
            }
        }