private void butAddPatients_Click(object sender, EventArgs e) { FormCentralPatientSearch FormCPS = new FormCentralPatientSearch(); FormCPS.ListConnsOK = new List <CentralConnection> { _sourceConnection }; //FormCPS.IsSelectionMode=true;//always selection mode if (FormCPS.ShowDialog() == DialogResult.OK) { DataRow selectedPatRow = FormCPS.DataRowSelectedPatient; if (_listPatientDataRows.AsEnumerable().Any(x => x["PatNum"].ToString() == selectedPatRow["PatNum"].ToString())) { return; //No need to add the same patient to the grid. } _listPatientDataRows.Add(selectedPatRow); FillPatients(); } }
private void butPtSearch_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) { MsgBox.Show(this, "Please select at least one connection to search first."); return; } List <CentralConnection> listConns = new List <CentralConnection>(); for (int i = 0; i < gridMain.SelectedIndices.Length; i++) { if (((CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag).ConnectionStatus != "OK") { continue; } listConns.Add((CentralConnection)gridMain.Rows[gridMain.SelectedIndices[i]].Tag); } FormCentralPatientSearch FormCPS = new FormCentralPatientSearch(); FormCPS.ListConns = listConns; FormCPS.AutoLogIn = checkAutoLog.Checked; FormCPS.ShowDialog(); FillGrid(); }