public void Select(ObservableCollection <string>[] collections, string shop, Shop[] allShops) { for (int i = 0; i < allShops.Length; i++) { if (allShops[i].Name == shop) { Shop[] selectShop = new[] { allShops[i] }; Worker.All(collections[2], selectShop); break; } } }
public void Select(ObservableCollection <string>[] collections, string city, Shop[] allShops) { List <Shop> SelectedShops = new List <Shop>(); for (int i = 0; i < allShops.Length; i++) { if (allShops[i].City == city) { SelectedShops.Add(allShops[i]); } } Shops.All(collections[1], SelectedShops.ToArray()); Workers.All(collections[2], SelectedShops.ToArray()); }
public ApplicationViewModel() { _mainDatabase = new[] { new Shop("Москва", "A1", new[] { "Василий Петрович", "Александр Генадьевич", "Александр Иванович" }), new Shop("Санкт-Петербург", "A2", new[] { "Валерий Антонович", "Максим Александрович", "Виталий Александрович" }), new Shop("Москва", "A3", new[] { "Антон Валерьевич", "Дмитрий Максимович", "Кирилл Витальевич" }), new Shop("Череповец", "A4", new[] { "Мария Петровна", "Михаил Дмитриевич", "Елизавета Ивановна" }), new Shop("Вологда", "A5", new[] { "Пётр Антонович", "Генадий Михайлович", "Катерина Владиславовна" }), new Shop("Череповец", "A6", new[] { "Антон Васильевич", "Виталий Генадьевич", "Владимир Кириллович" }), new Shop("Магнитогорск", "A7", new[] { "Ольга Генадьевна", "Кирилл Витальевич", "Евгений Владимирович" }), new Shop("Москва", "A8", new[] { "Генадий Кириллович", "Любовь Михайловна", "Владимир Евгеньевич" }) }; Cities = new ObservableCollection <string>(); Shops = new ObservableCollection <string>(); Workers = new ObservableCollection <string>(); AllCollections = new[] { Cities, Shops, Workers }; _Cities.All(Cities, _mainDatabase); _Shops.All(Shops, _mainDatabase); _Workers.All(Workers, _mainDatabase); }