Ejemplo n.º 1
0
        private void Search()
        {
            LBItemList.DataContext      = null;
            GridItemDetails.DataContext = null;
            ComboBoxItem typeItem = (ComboBoxItem)CBCategory.SelectedItem;
            string       type     = typeItem.Content.ToString();

            ComboBoxItem typeItem2 = (ComboBoxItem)CBSearchType.SelectedItem;
            string       value     = typeItem2.Content.ToString();

            var searchvalue = TBSearchValue.Text.Equals("") ? "0" : TBSearchValue.Text;

            if (type == T3.Content.ToString()) //Books
            {
                BookProcessor book = new BookProcessor();
                Item = book.GetBooks(ReferenceList.Token, value, searchvalue);
                LBItemList.DataContext = Item;
            }
            else
            if (type == T4.Content.ToString()) //Newspapers
            {
                NewspaperProcessor newspaper = new NewspaperProcessor();
                Item = newspaper.GetNewspapers(ReferenceList.Token, value, searchvalue);
                LBItemList.DataContext = Item;
            }
            else
            if (type == T5.Content.ToString()) //Journals
            {
                JournalProcessor journal = new JournalProcessor();
                Item = journal.GetJournals(ReferenceList.Token, value, searchvalue);
                LBItemList.DataContext = Item;
            }
            else
            if (type == T6.Content.ToString()) //Magazines
            {
                MagazineProcessor magazine = new MagazineProcessor();
                Item = magazine.GetMagazines(ReferenceList.Token, value, searchvalue);
                LBItemList.DataContext = Item;
            }
            else
            if (type == T7.Content.ToString()) //Manuscripts
            {
                ManuscriptProcessor manuscript = new ManuscriptProcessor();
                Item = manuscript.GetManuscripts(ReferenceList.Token, value, searchvalue);
                LBItemList.DataContext = Item;
            }
        }