コード例 #1
0
        /// <summary>
        /// Fin de el metodo populate que fue llamado de forma asincrona
        /// </summary>
        /// <param name="res"></param>
        void EndPopulate(IAsyncResult res)
        {
            Exception ex;

            if (this.InvokeRequired)
            {
                AsyncCallback d = new AsyncCallback(EndPopulate);
                this.Invoke(d, new object[] { res });
            }
            else
            {
                AsyncResult result = (AsyncResult)res;

                DelegateWithOutAndRefParameters del = (DelegateWithOutAndRefParameters)result.AsyncDelegate;
                del.EndInvoke(out ex, res);
                if (ex != null)
                {
                    if (String.IsNullOrEmpty(ex.Source))
                    {
                        ex.Source = "frmPatientAtencion.EndPopulate";
                    }
                    this.ExceptionViewer.Show(ex);
                    return;
                }

                StringBuilder s = null;

                #region Datos Patient
                lblDNI.Text    = ServiceCalls.CurrentPatient.Persona.NroDocumento;
                lblNombre.Text = ServiceCalls.CurrentPatient.Persona.ApellidoNombre;
                lblEdad.Text   = ServiceCalls.CurrentPatient.Persona.GetLabelEdad();
                //TODO: Poner fecha nacimiento
                if (ServiceCalls.CurrentPatient.Persona.Foto == null)
                {
                    this.pictureEdit1.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Clip;
                    if (ServiceCalls.CurrentPatient.Persona.Sexo.Equals((Int16)Sexo.Masculino))
                    {
                        pictureEdit1.Image = Health.Front.Base.Properties.Resource.User_M;
                    }
                    else
                    {
                        pictureEdit1.Image = Health.Front.Base.Properties.Resource.User_F;
                    }
                }
                else
                {
                    this.pictureEdit1.Properties.SizeMode = DevExpress.XtraEditors.Controls.PictureSizeMode.Stretch;
                    pictureEdit1.Image = Fwk.HelperFunctions.TypeFunctions.ConvertByteArrayToImage(ServiceCalls.CurrentPatient.Persona.Foto);
                }
                #endregion

                #region Allergies
                if (_PatientAllergy == null)
                {
                    return;
                }
                {
                    if (!string.IsNullOrEmpty(_PatientAllergy.ToString()))
                    {
                        s = new StringBuilder();
                        btnAlertAllergy.Visible = true;


                        //Establezco los nombres de otras alergias para q se macheen con los ids de OtherAllergy
                        if (!string.IsNullOrEmpty(_PatientAllergy.OtherAllergy))
                        {
                            //Array de Ids
                            _PatientAllergy.OtherAllergy = _PatientAllergy.OtherAllergy.Replace(" ", "");
                            var listOther = _PatientAllergy.OtherAllergy.Split(',').ToList <string>();

                            //MAcheo de array con nombre de otras alergias
                            string[] x = (from p in ServiceCalls.AllergiesItemTypesList where listOther.Contains(p.IdParametro.ToString()) select p.Nombre).ToArray <string>();

                            x.ToList().ForEach(item => s.AppendLine(item));
                            _PatientAllergy.OtherNames = s.ToString();
                            s = null;
                        }
                        lblAllergiesInfo.Text = string.Empty;
                        lblAllergiesInfo.Text = _PatientAllergy.ToString();
                    }
                }

                #endregion

                #region Permanent medicaments


                if (_PatientMedicament_ViewList.Count != 0)
                {
                    s = new StringBuilder("El pasiente esta actualmente medicado: \r\n \r\n");
                    string strMedicamentRecord = "{0} {1} ";
                    _PatientMedicament_ViewList.ForEach(item =>
                                                        s.AppendLine(string.Format(strMedicamentRecord, item.MedicamentName, item.StatusDescription)));
                    lblAlertMedicament.Text    = s.ToString();
                    btnAlertMedicament.Visible = true;
                }

                #endregion


                #region Diagnosis
                if (_MedicalEventAlert_ViewList.Count != 0)
                {
                    s = new StringBuilder("Alerta de diagnosticos: \r\n \r\n");
                    _MedicalEventAlert_ViewList.ForEach(item => s.AppendLine(item.Description));
                    lblAlertDiagnosis.Text    = s.ToString();
                    btnAlertdiagnosis.Visible = true;
                }
                #endregion
            }
        }