Ejemplo n.º 1
0
        private void gridView_Medicaments_DoubleClick(object sender, EventArgs e)
        {
            if (selected_PatientMedicament == null) return;
            using (frmQueryUpdateMedicament frm = new frmQueryUpdateMedicament())
            {
                #region seteos de formulario
                frm.currentMedicalEventId = currentEvent.MedicalEventId;
                if (selected_PatientMedicament.Enabled)
                    frm.State = this.State;
                else
                    frm.State = Fwk.Bases.EntityUpdateEnum.NONE;
                #endregion

                frm.PatientMedicament_Original = selected_PatientMedicament;
                frm.PatientMedicamentList = currentEvent.PatientMedicaments;
                frm.Refresh();

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    //Se debe obtener nuevamente dado q el PatientMedicaments que nos da la grilla pierde referencia con la coleccion _Evento.PatientMedicaments


                    ///Agrega uno nuevo en base una anterior
                    if (frm.UpdateMedicamentEnum == UpdateMedicalEventEnum.Other_MedicalEvent)
                    {
                        currentEvent.PatientMedicaments.Add(frm.UpdatedPatientMedicament);

                        selected_PatientMedicament.EntityState = Fwk.Bases.EntityState.Changed;
                        selected_PatientMedicament.Enabled = false;
                    }

                    //Actualiza la creada en este Evento Medico
                    if (frm.UpdateMedicamentEnum == UpdateMedicalEventEnum.Same_MedicalEvent)
                    {

                        //if (Selected_PatientMedicament.PatientMedicamentId >= 0)
                            //selected_PatientMedicament = _Evento.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(Selected_PatientMedicament.PatientMedicamentId)).FirstOrDefault();
                        //Mapeo
                        Fwk.HelperFunctions.ReflectionFunctions.MapProperties<PatientMedicament_ViewBE>(frm.UpdatedPatientMedicament, ref selected_PatientMedicament);
                        
                        if (selected_PatientMedicament.PatientMedicamentId >= 0)
                        {
                            //selected_PatientMedicament = currentEvent.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(selected_PatientMedicament.PatientMedicamentId)).FirstOrDefault();
                            //Fwk.HelperFunctions.ReflectionFunctions.MapProperties<PatientMedicament_ViewBE>(frm.UpdatedPatientMedicament, ref Selected_PatientMedicament);
                            selected_PatientMedicament.EntityState = Fwk.Bases.EntityState.Changed;
                        }
                        //else
                        //{
                            
                        //}
                    }
                    gridView_Medicaments.RefreshData();
                }
            }
        }
Ejemplo n.º 2
0
 private void gridView_Medicaments_DoubleClick(object sender, EventArgs e)
 {
     if (Selected_PatientMedicament == null)
     {
         return;
     }
     using (frmQueryUpdateMedicament frm = new frmQueryUpdateMedicament())
     {
         frm.State = this.State;
         frm.PatientMedicament_Original = Selected_PatientMedicament;
         frm.currentMedicalEventId      = _Evento.MedicalEventId;
         frm.Refresh();
     }
 }
Ejemplo n.º 3
0
 private void gridView_Medicaments_DoubleClick(object sender, EventArgs e)
 {
     if (Selected_PatientMedicament == null) return;
     using (frmQueryUpdateMedicament frm = new frmQueryUpdateMedicament())
     {
         frm.State = this.State;
         frm.PatientMedicament_Original = Selected_PatientMedicament;
         frm.currentMedicalEventId = _Evento.MedicalEventId;
         frm.Refresh();
     }
 }
Ejemplo n.º 4
0
        private void gridView_Medicaments_DoubleClick(object sender, EventArgs e)
        {
            if (selected_PatientMedicament == null)
            {
                return;
            }
            using (frmQueryUpdateMedicament frm = new frmQueryUpdateMedicament())
            {
                #region seteos de formulario
                frm.currentMedicalEventId = currentEvent.MedicalEventId;
                if (selected_PatientMedicament.Enabled)
                {
                    frm.State = this.State;
                }
                else
                {
                    frm.State = Fwk.Bases.EntityUpdateEnum.NONE;
                }
                #endregion

                frm.PatientMedicament_Original = selected_PatientMedicament;
                frm.PatientMedicamentList      = currentEvent.PatientMedicaments;
                frm.Refresh();

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    //Se debe obtener nuevamente dado q el PatientMedicaments que nos da la grilla pierde referencia con la coleccion _Evento.PatientMedicaments


                    ///Agrega uno nuevo en base una anterior
                    if (frm.UpdateMedicamentEnum == UpdateMedicalEventEnum.Other_MedicalEvent)
                    {
                        currentEvent.PatientMedicaments.Add(frm.UpdatedPatientMedicament);

                        selected_PatientMedicament.EntityState = Fwk.Bases.EntityState.Changed;
                        selected_PatientMedicament.Enabled     = false;
                    }

                    //Actualiza la creada en este Evento Medico
                    if (frm.UpdateMedicamentEnum == UpdateMedicalEventEnum.Same_MedicalEvent)
                    {
                        //if (Selected_PatientMedicament.PatientMedicamentId >= 0)
                        //selected_PatientMedicament = _Evento.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(Selected_PatientMedicament.PatientMedicamentId)).FirstOrDefault();
                        //Mapeo
                        Fwk.HelperFunctions.ReflectionFunctions.MapProperties <PatientMedicament_ViewBE>(frm.UpdatedPatientMedicament, ref selected_PatientMedicament);

                        if (selected_PatientMedicament.PatientMedicamentId >= 0)
                        {
                            //selected_PatientMedicament = currentEvent.PatientMedicaments.Where(p => p.PatientMedicamentId.Equals(selected_PatientMedicament.PatientMedicamentId)).FirstOrDefault();
                            //Fwk.HelperFunctions.ReflectionFunctions.MapProperties<PatientMedicament_ViewBE>(frm.UpdatedPatientMedicament, ref Selected_PatientMedicament);
                            selected_PatientMedicament.EntityState = Fwk.Bases.EntityState.Changed;
                        }
                        //else
                        //{

                        //}
                    }
                    gridView_Medicaments.RefreshData();
                }
            }
        }