private void BtnUpdate_Click(object sender, EventArgs e) { a = new Bll.ClsAuthors(Convert.ToInt32(dgvAuthors.SelectedRows[0].Cells["AuthorCode"].Value)); pnlAddOrUpdate.Visible = true; lblCode.Text = Convert.ToString(a.AuthorCode); txtAuthorLastName.Text = a.AuthorLastName; txtAuthorFirstName.Text = a.AuthorFirstName; state = "update"; }
private void BtnAdd_Click(object sender, EventArgs e) { pnlAddOrUpdate.Visible = true; a = new Bll.ClsAuthors(); at = new Bll.ClsAuthorsTable(); lblCode.Text = at.GetNewKey().ToString(); txtAuthorLastName.Text = ""; txtAuthorFirstName.Text = ""; state = "add"; }
private void btnDelete_Click(object sender, EventArgs e) { a = new Bll.ClsAuthors(Convert.ToInt32(dgvAuthors.SelectedRows[0].Cells[0].Value)); pnlAddOrUpdate.Visible = false; DialogResult answer = MessageBox.Show("מחיקה", "?האם אתה בטוח שהינך מעוניין למחוק סופר זה לצמיתות", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.RtlReading); if (answer == DialogResult.Yes) { try { a.Delete(); MessageBox.Show("!המחיקה בוצעה בהצלחה"); } catch (Exception) { MessageBox.Show("לא ניתן למחוק סופר זה"); } } }