private void addPhyisicalAgentButton_Click(object sender, EventArgs e) { EditPhysicalAgentForm newAgentForm = new EditPhysicalAgentForm(null); newAgentForm.ShowDialog(); AddAgentDataToTable(newAgentForm.createdAgent); }
private void editPhyisicalAgentButton_Click(object sender, EventArgs e) { if (phyisicalAgentsDataGridView.SelectedRows.Count > 0) { DataGridViewRow row = phyisicalAgentsDataGridView.SelectedRows[0]; PhysicalAgent agent = new PhysicalAgent( row.Cells[0].Value.ToString(), row.Cells[1].Value.ToString(), row.Cells[2].Value.ToString() ); EditPhysicalAgentForm editPhysicalAgentForm = new EditPhysicalAgentForm(agent); editPhysicalAgentForm.ShowDialog(); if (editPhysicalAgentForm.createdAgent != null) { phyisicalAgentsDataGridView.Rows[row.Index].Cells[0].Value = editPhysicalAgentForm.createdAgent.equipment; phyisicalAgentsDataGridView.Rows[row.Index].Cells[1].Value = editPhysicalAgentForm.createdAgent.usage; phyisicalAgentsDataGridView.Rows[row.Index].Cells[2].Value = editPhysicalAgentForm.createdAgent.generatedRisks; } } }