public void RefreshStockPartList() { try { List <Part> partList = DataController.GetInstance.GetParts(); spc = Application.Current.Resources["StockPartCollection"] as StockPartCollection; spc.Clear(); foreach (Part part in partList) { spc.Add(part); } Application.Current.Resources["StockPartCollection"] = spc; } catch (MySqlException ex) { MessageBox.Show(ex.Message); } }
public void SearchStockPartList(string searchTerm) { if (searchTerm.Length == 0 || searchTerm.Equals("Search")) { slc = spc; Application.Current.Resources["StockListCollection"] = slc; } else { StockPartCollection tempList = new StockPartCollection(); foreach (Part part in spc) { if (part.Part_Number.ToLower().Contains(searchTerm.ToLower()) || part.Part_Description.ToLower().Contains(searchTerm.ToLower())) { tempList.Add(part); } } Application.Current.Resources["StockListCollection"] = tempList; } }
public MainViewModel() { mainWindow = ((MainWindow)Application.Current.MainWindow); slc = Application.Current.Resources["StockListCollection"] as StockPartCollection; jlc = Application.Current.Resources["JobListCollection"] as JobCollection; llc = Application.Current.Resources["LogListCollection"] as LogCollection; CheckInList = new ObservableCollection <Part>() { new Part() { Part_Number = "" } }; CheckOutList = new ObservableCollection <Part>() { new Part() { Part_Number = "" } }; }