private void AddConferenceButton_Click(object sender, EventArgs e) { formDTO.op = CrudOpr.Create; CreateUpdateParticipantForm form = new CreateUpdateParticipantForm(this, formDTO); form.Show(); }
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { int id = Convert.ToInt32(dataGridView1.CurrentRow.Cells["participantIdDataGridViewTextBoxColumn"].Value); // updating if (e.ColumnIndex == 9) { formDTO.op = CrudOpr.Update; ViewConferencesWithParticipant findParticipant = dataFormDTO.db.ViewConferencesWithParticipants.SingleOrDefault(o => o.participantId == id); formDTO.obj = findParticipant; CreateUpdateParticipantForm form = new CreateUpdateParticipantForm(this, formDTO); form.Show(); } // deleting if (e.ColumnIndex == 10) { // Запрашиваем подтверждение string message = "Do you want to delete?"; string caption = "Y/n"; var result = MessageBox.Show(message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { participant participant = new participant(); participant.participantId = id; // deleting if (crud.delete(participant)) { MessageBox.Show("Conference was deleted!"); resetData(); } else { MessageBox.Show("Deleting was denied"); } } } }