private void EditButton_Click(object sender, RoutedEventArgs e) { string[] temp = { }; if (MainBookTable.Visibility == Visibility.Visible) { CollectionBook item = MainBookTable.SelectedItem as CollectionBook; string[] mass = { "Книги", item.Автор, item.Название, item.Жанр, item.Издатель, item.Материал, item.асположение, Convert.ToString(item.Цена) }; temp = mass; } if (MainMagazineTable.Visibility == Visibility.Visible) { CollectionMagazine item = MainMagazineTable.SelectedItem as CollectionMagazine; string[] mass = { "Журнал", item.Название, item.Автор, item.Тема, item.асположение, item.Жанр, item.Издатель, item.Аудитория, Convert.ToString(item.Цена) }; temp = mass; } if (MainСhancelleryTable.Visibility == Visibility.Visible) { CollectionChancellery item = MainСhancelleryTable.SelectedItem as CollectionChancellery; string[] mass = { "Концелярия", item.Название, item.асположение, item.Производитель, item.Категория, Convert.ToString(item.Цена) }; temp = mass; } IProductsManagement product = new ProductsManagement(); temp = temp.Where(x => x != "").ToArray(); product.ProductAction("Delete", temp); product.ProductAction("Created", workingtable.data_collection(TypeProduct, massBookObject, massMagazineObject, massСhancelleryObject)); }
private void SearchItem_Click(object sender, RoutedEventArgs e) { string[] massBook = { "Книги", NameBookT.Text, AuthorBookT.Text, GenreBookT.Text, ManufacturerBookT.Text, MaterialBookT.Text, StorageBookT.Text, PriceBookT.Text }; string[] massMagazine = { "Журнал", NameMagazineT.Text, AuthorMagazineT.Text, TopicMagazineT.Text, StorageMagazineT.Text, GenreMagazineT.Text, ManufacturerMagazineT.Text, AudienceMagazineT.Text, PriceMagazineT.Text }; string[] massСhancellery = { "Концелярия", NameСhancelleryT.Text, StorageСhancelleryT.Text, ManufacturerСhancelleryT.Text, AppointmentСhancelleryT.Text, PriceСhancelleryT.Text }; string[][] massrez = { massBook, massMagazine, massСhancellery }; for (int i = 0; i < 3; i++) { string[] temp = massrez[i].Where(x => x != "").ToArray(); if (massrez[i].Length != 1) { mass[flag] = massrez[i]; flag++; } } ProductsManagement products = new ProductsManagement(); Action <IEnumerable <Product> > searchHandler = (items) => { if (items != null) { if (items.All(x => x is Book)) { ItemsBook = items; } if (items.All(x => x is Magazine)) { ItemsMagazine = items; } if (items.All(x => x is Сhancellery)) { ItemsСhancellery = items; } } }; products.SearchComplited += searchHandler; for (int i = 0; i < 3; i++) { string[] temp = mass[i].Where(x => x != "").ToArray(); if (mass[i] != null && temp.Length > 1) { products.ProductAction("Search", mass[i]); } } products.SearchComplited -= searchHandler; this.Close(); }
public void Update() { ProductsManagement products = new ProductsManagement(); Action <IEnumerable <Product> > searchHandler = (temprez) => { Synchronization((Product[])temprez); }; products.LoadAllItem += searchHandler; string[] temp = new string[1]; products.ProductAction("Load_all", temp); products.LoadAllItem -= searchHandler; }
private void btnProducts_Click(object sender, EventArgs e) { ProductsManagement products = new ProductsManagement(); products.Show(); }