Exemplo n.º 1
0
        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();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void addAgentLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            AgentDozage newAgDoz = new AgentDozage();

            newAgDoz.DozageMeter = deafaultAgentMeter;
            newAgDoz.MeterId     = deafaultAgentMeter.Id;
            if (currentMedicament != null)
            {
                newAgDoz.MedicamentId = currentMedicament.Id;
                dozages.Add(newAgDoz);
            }
            else
            {
                dozages.Add(newAgDoz);
            }
        }
Exemplo n.º 3
0
        private void deleteAgentLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            int         selectedRowIndex = dataGridView1.SelectedCells[0].RowIndex;
            AgentDozage selectedAgDoz    = dataGridView1.Rows[selectedRowIndex].DataBoundItem as AgentDozage;

            selectedAgDoz.Id = -1;

            if (selectedAgDoz.Agent != null)
            {
                selectedAgents.Remove(selectedAgDoz.Agent.Id);
            }

            dataGridView1.Rows.RemoveAt(selectedRowIndex);
            dozages.Remove(selectedAgDoz);
            updateTableNumRowsColumn();
            dataGridView1.Refresh();
        }