private void DgvProdana_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgvProdana.Columns[e.ColumnIndex].Name == "Detalji") { var id = dgvProdana.Rows[e.RowIndex].Cells[0].Value; frmDetaljiVozila forma = new frmDetaljiVozila(int.Parse(id.ToString()), null, this); forma.Show(); } }
private async void DgvVozila_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgvVozila.Columns[e.ColumnIndex].Name == "Detalji") { var id = dgvVozila.Rows[e.RowIndex].Cells[0].Value; frmDetaljiVozila forma = new frmDetaljiVozila(int.Parse(id.ToString()), this); forma.Show(); } else if (dgvVozila.Columns[e.ColumnIndex].Name == "Arhiviraj") { var id = dgvVozila.Rows[e.RowIndex].Cells[0].Value; if (MessageBox.Show("Da li ste sigurni da želite arhivirati podatke o ovom vozilu?", "Poruka", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { await _vozila.Delete(id); await GetVozila(); MessageBox.Show("Zapis uspješno arhiviran"); } } }