private void AddOwnerMenu_Click(object sender, EventArgs e) { AddOwnerForm form = new AddOwnerForm(); form.ShowDialog(); openOwner(); }
private void OwnerView_CellClick(object sender, DataGridViewCellEventArgs e) { if ((((DataGridView)sender).Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewButtonCell) == null) { foreach (var user in list) { if (user.id == int.Parse((((DataGridView)sender).Rows[e.RowIndex].Cells[0].Value.ToString()))) { AddOwnerForm ownerForm = new AddOwnerForm(user); ownerForm.ShowDialog(); openOwner(); return; } } } else { if (MessageBox.Show("Вы действительно желаете удалить данную запись?", "Удаление", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Objects.Owner.Delete(Convert.ToInt32(OwnerView.Rows[e.RowIndex].Cells[0].Value)); OwnerView.Rows.RemoveAt(e.RowIndex); MessageBox.Show("Пользователь успешно удалён."); } } }