private async void DeleteItem() { var idText = TBDeleteItemId.Text; var response = new AuthResponseModel(); int id; if (!Regex.IsMatch(idText, @"^\d+$")) { MessageBox.Show("ID should be a number!"); return; } else { id = Convert.ToInt32(idText); } ComboBoxItem typeItem = (ComboBoxItem)CBDeleteItemCategory.SelectedItem; string category = typeItem.Content.ToString(); if (category == T31.Content.ToString()) //Books { BookProcessor book = new BookProcessor(); response = await book.DeleteBook(id); MessageBox.Show(response.Info); } else if (category == T32.Content.ToString()) //Newspapers { NewspaperProcessor newspaper = new NewspaperProcessor(); response = await newspaper.DeleteNewspaper(id); MessageBox.Show(response.Info); } else if (category == T33.Content.ToString()) //Journals { JournalProcessor journal = new JournalProcessor(); response = await journal.DeleteJournal(id); MessageBox.Show(response.Info); } else if (category == T34.Content.ToString()) //Magazines { MagazineProcessor magazine = new MagazineProcessor(); response = await magazine.DeleteMagazine(id); MessageBox.Show(response.Info); } else if (category == T35.Content.ToString()) //Manuscripts { ManuscriptProcessor manuscript = new ManuscriptProcessor(); response = await manuscript.DeleteManuscript(id); MessageBox.Show(response.Info); } }
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; } }
private void SearchAll() { LBItemList.DataContext = null; GridItemDetails.DataContext = null; ComboBoxItem typeItem = (ComboBoxItem)CBCategory.SelectedItem; string type = typeItem.Content.ToString(); if (type == T3.Content.ToString()) //Books { BookProcessor book = new BookProcessor(); Item = book.GetAllBooks(ReferenceList.Token); LBItemList.DataContext = Item; } else if (type == T4.Content.ToString()) //Newspapers { NewspaperProcessor newspaper = new NewspaperProcessor(); Item = newspaper.GetAllNewspapers(ReferenceList.Token); LBItemList.DataContext = Item; } else if (type == T5.Content.ToString()) //Journals { JournalProcessor journal = new JournalProcessor(); Item = journal.GetAllJournals(ReferenceList.Token); LBItemList.DataContext = Item; } else if (type == T6.Content.ToString()) //Magazines { MagazineProcessor magazine = new MagazineProcessor(); Item = magazine.GetAllMagazines(ReferenceList.Token); LBItemList.DataContext = Item; } else if (type == T7.Content.ToString()) //Manuscripts { ManuscriptProcessor manuscript = new ManuscriptProcessor(); Item = manuscript.GetAllManuscripts(ReferenceList.Token); LBItemList.DataContext = Item; } }
public List <ItemModel> GetManuscriptById(string token, int id) { return(ManuscriptProcessor.GetManuscriptById(token, id)); }
public IEnumerable <ItemModel> GetManuscriptsByType(string token, string type, string value) { return(ManuscriptProcessor.GetManuscriptsByType(token, type, value)); }
public IEnumerable <ItemModel> GetAllManuscripts(string token) { return(ManuscriptProcessor.GetAllManuscripts(token)); }
private async void InsertItemAsync() { var title = TBAddItemTitle.Text; var description = TBAddItemDescription.Text; var author = TBAddItemAuthor.Text; var response = new AuthResponseModel(); int publishYear; if (!Regex.IsMatch(TBAddItemPublishYear.Text, @"^\d{4}$")) { MessageBox.Show("Year should consist of 4 Numbers!"); return; } else { publishYear = Convert.ToInt32(TBAddItemPublishYear.Text); } ComboBoxItem typeItem = (ComboBoxItem)CBAddItemCategory.SelectedItem; string category = typeItem.Content.ToString(); ComboBoxItem typeItem2 = (ComboBoxItem)CBAddItemAccess.SelectedItem; string access = typeItem2.Content.ToString(); if (category == T13.Content.ToString()) //Books { BookProcessor book = new BookProcessor(); response = await book.InsertBook(title, description, author, publishYear, access); MessageBox.Show(response.Info); } else if (category == T14.Content.ToString()) //Newspapers { NewspaperProcessor newspaper = new NewspaperProcessor(); response = await newspaper.InsertNewspaper(title, description, author, publishYear, access); MessageBox.Show(response.Info); } else if (category == T15.Content.ToString()) //Journals { JournalProcessor journal = new JournalProcessor(); response = await journal.InsertJournal(title, description, author, publishYear, access); MessageBox.Show(response.Info); } else if (category == T16.Content.ToString()) //Magazines { MagazineProcessor magazine = new MagazineProcessor(); response = await magazine.InsertMagazine(title, description, author, publishYear, access); MessageBox.Show(response.Info); } else if (category == T17.Content.ToString()) //Manuscripts { ManuscriptProcessor manuscript = new ManuscriptProcessor(); response = await manuscript.InsertManuscript(title, description, author, publishYear, access); MessageBox.Show(response.Info); } }