private void addAuthor_Click(object sender, EventArgs e) { AddAuthor addAuthorForm = new AddAuthor(this.currentUser); addAuthorForm.FormClosed += new FormClosedEventHandler(AddAuthorClosed); addAuthorForm.ShowDialog(); }
private void EditAuthorBtn_Click(object sender, RoutedEventArgs e) { AuthorViewModel authorVM = dataGrid.SelectedItem as AuthorViewModel; AddAuthor editAuthor = new AddAuthor(authorVM.Name, authorVM.SurName); if (editAuthor.ShowDialog().Value) { string name = editAuthor.Name.Text; string surname = editAuthor.Surname.Text; if (authorVM != null && name != null && surname != null) { Author author = authorController.GetById(authorVM.Id); author.Name = authorVM.Name = name; author.SurName = authorVM.SurName = surname; authorController.Edit(author); } } }
private void AddAuthorBtn_Click(object sender, RoutedEventArgs e) { InitDataSource(ref authorItems, Mapper.AuthorsToAuthorViewModels, authorController.Get); AddAuthor addAuthor = new AddAuthor(); if (addAuthor.ShowDialog().Value) { string name = addAuthor.Name.Text; string surname = addAuthor.Surname.Text; if (name != null && surname != null) { Author author = new Author(name, surname); authorController.Add(author); authorItems.Add(Mapper.AuthorToAuthorViewModel(author)); return; } } }
private void ButAddAuthor_Click(object sender, EventArgs e) { AddAuthor _authorForm = new AddAuthor(this); _authorForm.ShowDialog(); if (_authorForm.flag) { try { _db.Authprs.Add(new Authors { FIO = _authorForm.FIO, Year = Int32.Parse(_authorForm.YearBorn) }); _db.SaveChanges(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void addAuthorbtn_Click(object sender, EventArgs e) { try { AddAuthor addAuthor = new AddAuthor(); addAuthor.ShowDialog(); if (isChanged) { InformationForm information = new InformationForm("An author is added.", "Info"); information.Show(); } } catch (Exception) { MessageBox.Show("Something wrong!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } finally { this.ViewAuthors_Load(sender, e); } }
private void addAuthorToolStripMenuItem_Click(object sender, EventArgs e) { AddAuthor addAuthorForm = new AddAuthor(this.currentUser); addAuthorForm.ShowDialog(); }
private void AppBarButton_Click(object sender, System.Windows.RoutedEventArgs e) { AddAuthor a = new AddAuthor(); a.ShowDialog(); }