private void ExecuteFilterCommand() { ReturnedData.Clear(); DataAccess db = new DataAccess(); PlanetAndFruit itemToAdd; if (FruitsSelectedItem != null) { try { //Filter based on current color string filer = FruitsSelectedItem.Split(' ')[1]; foreach (var item in db.GetAllFruitsWithColor(filer)) { itemToAdd = new PlanetAndFruit(); itemToAdd.Name = item.Name; ReturnedData.Add(itemToAdd); } } catch (Exception e) { MessageBox.Show("You Must Select A Color First!"); } } else { MessageBox.Show("You Must Select A Color First!"); } }
private void ExecuteORderASCCommand() { ReturnedData.Clear(); DataAccess db = new DataAccess(); PlanetAndFruit itemToAdd; foreach (var item in db.GetAllFruitsASC()) { itemToAdd = new PlanetAndFruit(); itemToAdd.Name = item.Name; ReturnedData.Add(itemToAdd); } }
private void ExecuteJoinCommand() { ReturnedData.Clear(); DataAccess db = new DataAccess(); PlanetAndFruit itemToAdd; foreach (var item in db.GetAllJoinByColor()) { itemToAdd = new PlanetAndFruit(); itemToAdd.Name = item.Name; itemToAdd.Name2 = item.Name2; ReturnedData.Add(itemToAdd); } }