Example #1
0
 private void btnEditSelectedAuthor_Click(object sender, EventArgs e)
 {
     if (dgvAuthors.SelectedAuthor==null)
     {
         MessageBox.Show("Nie wybrałeś autora do edycji. ", "Informacja", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     FormEditAuthor formEditAuthor = new FormEditAuthor();
     formEditAuthor.EditedAuthorID = dgvAuthors.SelectedAuthor.id;
     if (formEditAuthor.ShowDialog() == DialogResult.OK)
     {
         Autor editedAuthor = (new BibliotekaDataContext()).Autors.Where(x => x.id == dgvAuthors.SelectedAuthor.id).Single();
         dgvAuthors.UpdateEditedAuthor(editedAuthor);
     }
 }
Example #2
0
 private void btnAddAuthor_Click(object sender, EventArgs e)
 {
     FormEditAuthor formEditAuthor = new FormEditAuthor();
     formEditAuthor.EditedAuthorID = 0;
     formEditAuthor.ShowDialog();
 }