private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1 && e.RowIndex > 0)
            {
                YearMedicamentNeed selectedItem = dataGridView1.Rows[e.RowIndex].DataBoundItem as YearMedicamentNeed;

                MedicamentSelectForm msf = new MedicamentSelectForm(new List <int> {
                    selectedItem.MedName.Id
                }, false);
                msf.ShowDialog();
                if (msf.SelectedMedicament != null)
                {
                    selectedItem.OldMedNameValue = selectedItem.MedName;
                    selectedItem.MedName         = msf.SelectedMedicament;
                    dataGridView1.Refresh();
                }
            }
        }
Esempio n. 2
0
 private void medicamentMovementTable_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (formIsInialized)
     {
         if (e.ColumnIndex == 2 && e.RowIndex >= 0)
         {
             MedicamentMovement   medMov = medicamentMovementTable.Rows[e.RowIndex].DataBoundItem as MedicamentMovement;
             MedicamentSelectForm msf    = new MedicamentSelectForm(agentsList, true);
             msf.ShowDialog();
             if (msf.SelectedMedicament != null)
             {
                 medMov.MedicamentId = msf.SelectedMedicament.Id;
                 medMov.Medicament   = msf.SelectedMedicament;
                 medMov.DayDozage    = medicamentAssignationList.Where(p => p.AssignMedicament.Id == msf.SelectedMedicament.Id).First().Dozage;
                 medicamentMovementTable.Refresh();
             }
         }
     }
 }
Esempio n. 3
0
 private void medicamentsTable_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (formIsInialized)
     {
         if (e.ColumnIndex == 1 && e.RowIndex >= 0)
         {
             MedicamentAssignation medAssign = medicamentsTable.Rows[e.RowIndex].DataBoundItem as MedicamentAssignation;
             MedicamentSelectForm  asf       = new MedicamentSelectForm(agentsList, false);
             asf.ShowDialog();
             if (asf.SelectedMedicament != null)
             {
                 if (medAssign.AssignMedicament != null)
                 {
                     agentsList.Remove(medAssign.AssignMedicament.Id);
                 }
                 medAssign.MedicamentId     = asf.SelectedMedicament.Id;
                 medAssign.AssignMedicament = asf.SelectedMedicament;
                 agentsList.Add(asf.SelectedMedicament.Id);
                 medicamentsTable.Refresh();
             }
         }
     }
 }