private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (formIsInitialized) { if ((e.ColumnIndex == 1) && (e.RowIndex >= 0)) { AgentSelectForm asf = new AgentSelectForm(selectedAgents); asf.ShowDialog(); if (asf.SelectedAgent != null) { AgentDozage selectedAgDoz = dataGridView1.Rows[e.RowIndex].DataBoundItem as AgentDozage; selectedAgDoz.Agent = asf.SelectedAgent; dataGridView1.Refresh(); selectedAgents.Add(selectedAgDoz.Agent.Id); } } if ((e.ColumnIndex == 2) && (e.RowIndex >= 0)) { MeterSelectForm msf = new MeterSelectForm(MeterType.MedicamentDozage); msf.ShowDialog(); if (msf.SelectedMeter != null) { AgentDozage selectedAgDoz = dataGridView1.Rows[e.RowIndex].DataBoundItem as AgentDozage; selectedAgDoz.DozageMeter = msf.SelectedMeter; selectedAgDoz.MeterId = msf.SelectedMeter.Id; dataGridView1.Refresh(); } } } }
private void analizesTable_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (formIsLoaded) { if (e.RowIndex > 0 && e.ColumnIndex == 1) { Analyze selectedItem = analizesTable.Rows[e.RowIndex].DataBoundItem as Analyze; MeterSelectForm mf = new MeterSelectForm(MeterType.Analize); mf.ShowDialog(); if (mf.SelectedMeter != null) { selectedItem.AnalizeMeter = mf.SelectedMeter; selectedItem.MeterId = mf.SelectedMeter.Id; analizesTable.Refresh(); } } } }