private async System.Threading.Tasks.Task GuardaEspecialistaSinPersona()
        {
            try
            {
                System.DateTime _fechaActual      = Fechas.GetFechaDateServer;
                var             NuevoEspecialista = new SSP.Servidor.ESPECIALISTA
                {
                    ESTATUS              = SelectedEstatus.CLAVE,
                    ID_ESPECIALIDAD      = SelectedEspecialidadEdicion.Value,
                    ID_PERSONA           = null,
                    ESPECIALISTA_MATERNO = TextMaterno,
                    ESPECIALISTA_NOMBRE  = TextNombre,
                    ESPECIALISTA_PATERNO = TextPaterno,
                    ID_CENTRO_UBI        = GlobalVar.gCentro,
                    ID_USUARIO           = GlobalVar.gUsr,
                    REGISTRO_FEC         = _fechaActual
                };

                bool _Respuesta = false;
                await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                {
                    if (!Bandera_Agregar)
                    {
                        NuevoEspecialista.ID_ESPECIALISTA = SelectedItem != null ? SelectedItem.ID_ESPECIALISTA : new short();
                        _Respuesta      = new SSP.Controlador.Catalogo.Justicia.cEspecialistas().ActualizarEspecialista(NuevoEspecialista);
                        Bandera_Agregar = true;
                    }
                    else
                    {
                        _Respuesta = new SSP.Controlador.Catalogo.Justicia.cEspecialistas().GuardarEspecialista(NuevoEspecialista);
                    }
                });

                if (_Respuesta)
                {
                    new Dialogos().ConfirmacionDialogo("Éxito", "La información se guardo correctamente.");
                }
                else
                {
                    new Dialogos().ConfirmacionDialogo("Error", "Surgió un error al guardar.");
                }
            }
            catch (Exception exc)
            {
                new Dialogos().ConfirmacionDialogo("Error", string.Format("{0} {1}", "Surgió un error al guardar.", exc.Message));
            }
        }
        private async System.Threading.Tasks.Task GetDatosPersonaSeleccionada(bool hideAll = false)
        {
            try
            {
                if (SelectPersona != null)
                {
                    TextCodigo = SelectPersona.ID_PERSONA.ToString();

                    if (SelectPersona != null)
                    {
                        TextPaterno     = !string.IsNullOrEmpty(SelectPersona.PATERNO) ? SelectPersona.PATERNO.Trim() : string.Empty;
                        TextMaterno     = !string.IsNullOrEmpty(SelectPersona.MATERNO) ? SelectPersona.MATERNO.Trim() : string.Empty;
                        TextNombre      = !string.IsNullOrEmpty(SelectPersona.NOMBRE) ? SelectPersona.NOMBRE.Trim() : string.Empty;
                        SelectSexo      = !string.IsNullOrEmpty(SelectPersona.SEXO) ? SelectPersona.SEXO : string.Empty;
                        FechaNacimiento = SelectPersona.FEC_NACIMIENTO.HasValue ? SelectPersona.FEC_NACIMIENTO.Value : new System.DateTime?();
                        TextCurp        = !string.IsNullOrEmpty(SelectPersona.CURP) ? SelectPersona.CURP.Trim() : string.Empty;
                        TextRfc         = !string.IsNullOrEmpty(SelectPersona.RFC) ? SelectPersona.RFC.Trim() : string.Empty;
                        TextTelefono    = !string.IsNullOrEmpty(SelectPersona.TELEFONO) ? SelectPersona.TELEFONO.Trim() : string.Empty;
                        TextCorreo      = !string.IsNullOrEmpty(SelectPersona.CORREO_ELECTRONICO) ? SelectPersona.CORREO_ELECTRONICO.Trim() : string.Empty;
                        TextNip         = SelectPersona.PERSONA_NIP != null?SelectPersona.PERSONA_NIP.Any() ? SelectPersona.PERSONA_NIP.Where(w => w.ID_CENTRO == GlobalVar.gCentro).Any() ?
                                          SelectPersona.PERSONA_NIP.Where(w => w.ID_CENTRO == GlobalVar.gCentro).FirstOrDefault().NIP : new int?() : new int?() : new int?();

                        FotoVisita = SelectPersona == null ?
                                     new Imagenes().getImagenPerson() :
                                     SelectPersona.PERSONA_BIOMETRICO.Any() ? SelectPersona.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)ControlPenales.BiometricoServiceReference.enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)ControlPenales.BiometricoServiceReference.enumTipoFormato.FMTO_JPG).Any() ?
                                     SelectPersona.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)ControlPenales.BiometricoServiceReference.enumTipoBiometrico.FOTO_FRENTE_REGISTRO && w.ID_FORMATO == (short)ControlPenales.BiometricoServiceReference.enumTipoFormato.FMTO_JPG).FirstOrDefault().BIOMETRICO :
                                     new Imagenes().getImagenPerson() : new Imagenes().getImagenPerson();
                    }
                    ;

                    LstEspecialidadesCaptura = new System.Collections.ObjectModel.ObservableCollection <SSP.Servidor.ESPECIALIDAD>();

                    //prepara la lista con las especialidades en las que puede entrar
                    var _especialidadesDisponibles = new SSP.Controlador.Catalogo.Justicia.cEspecialidades().ObtenerTodos(string.Empty, "S");
                    var _especialidadesActuales    = new SSP.Controlador.Catalogo.Justicia.cEspecialistas().GetData(x => x.ID_PERSONA == SelectPersona.ID_PERSONA);
                    if (_especialidadesDisponibles.Any())
                    {
                        foreach (var item in _especialidadesDisponibles)
                        {
                            if (_especialidadesActuales.Any(x => x.ID_ESPECIALIDAD == item.ID_ESPECIALIDAD))
                            {
                                continue; // ya existe dentro de las especialidades que tiene
                            }
                            System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate
                            {
                                LstEspecialidadesCaptura.Add(item);
                            }));
                        }
                    }
                    ;

                    System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate
                    {
                        LstEspecialidadesCaptura.Insert(0, new SSP.Servidor.ESPECIALIDAD {
                            DESCR = "SELECCIONE", ID_ESPECIALIDAD = -1
                        });
                    }));

                    RaisePropertyChanged("LstEspecialidadesCaptura");

                    SelectedEspecialidadEdicion = -1;
                    await System.Threading.Tasks.TaskEx.Delay(100);
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al traer datos del visitante externo.", ex);
            }
        }