private async void BuscarPersonas()
        {
            try
            {
                var persona = SelectPersona;
                ListPersonas = new RangeEnabledObservableCollection <SSP.Servidor.PERSONA>();
                ListPersonas.InsertRange(await SegmentarPersonasBusqueda());
                SelectPersonaAuxiliar = persona;
                if (ListPersonas.Count == 1)
                {
                    #region Validaciones
                    var x = ListPersonas.FirstOrDefault();
                    EmptyBuscarRelacionInternoVisible = ListPersonas != null ? ListPersonas.Count <= 0 : false;
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.AGREGAR_ESPECIALISTAS);

                    #endregion

                    await SeleccionarPersona(ListPersonas.FirstOrDefault());

                    StaticSourcesViewModel.SourceChanged = false;
                }
                ;
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al traer datos del visitante.", ex);
            }
        }
Пример #2
0
        private async void Buscar()
        {
            try
            {
                //LstIngreso = new RangeEnabledObservableCollection<INGRESO>();
                //LstIngreso.InsertRange(await SegmentarIngresoBusqueda());

                ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                InternosEmpty = !(ListExpediente.Count > 0);
                if (ListExpediente.Count > 0)//Empty row
                {
                    EmptyExpedienteVisible = false;
                }
                else
                {
                    EmptyExpedienteVisible = true;
                }

                ImagenImputado = ImagenIngreso = new Imagenes().getImagenPerson();
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar interno", ex);
            }
        }
Пример #3
0
 private async void BuscarImputado()
 {
     try
     {
         //ListExpediente = (new cImputado()).ObtenerTodos(ApellidoPaternoBuscar, ApellidoMaternoBuscar, NombreBuscar,AnioBuscar, FolioBuscar);
         // ListExpediente = await StaticSourcesViewModel.CargarDatosAsync<ObservableCollection<IMPUTADO>>(() =>
         //new cImputado().ObtenerTodos(ApellidoPaternoBuscar, ApellidoMaternoBuscar, NombreBuscar, AnioBuscar, FolioBuscar));
         ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
         ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
         if (ListExpediente != null)
         {
             if (ListExpediente.Count == 0)
             {
                 EmptyExpedienteVisible = true;
             }
             else
             {
                 emptyExpedienteVisible = false;
             }
         }
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar imputado", ex);
     }
 }
 private void QuitarImputado()
 {
     try
     {
         var s = SelectedIngresoSeleccionado;
         if (LstIngresosSeleccionados.Remove(SelectedIngresoSeleccionado))
         {
             var encontrado = LstIngresos.FirstOrDefault(w => w.Ingreso.ID_IMPUTADO == s.ID_IMPUTADO && w.Ingreso.ID_ANIO == s.ID_ANIO && w.Ingreso.ID_CENTRO == s.ID_CENTRO);
             if (encontrado != null)
             {
                 encontrado.Seleccionado = false;
             }
             SeleccionadosIngresos.Remove(SeleccionadosIngresos.FirstOrDefault(w => w.ID_ANIO == s.ID_ANIO && w.ID_IMPUTADO == s.ID_IMPUTADO && w.ID_INGRESO == s.ID_INGRESO && w.ID_CENTRO == s.ID_CENTRO));
             StaticSourcesViewModel.SourceChanged = true;
         }
         var temp = LstIngresos;
         LstIngresos = new RangeEnabledObservableCollection <cTrasladoIngreso>();
         LstIngresos.InsertRange(temp);
         SelectedIngresoSeleccionado = null;
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al agregar el imputado", ex);
     }
 }
        void CargarDatos()
        {
            var x = new ObservableCollection <VISITA_DIA>(new cVisitaDia().ObtenerTodos().OrderBy(o => o.ID_DIA == 7 ? 2 : 1).ToList());

            ListVisitaDiaFiltro = new RangeEnabledObservableCollection <VISITA_DIA>();
            ListVisitaDia       = x;
            ListTipoVisita      = new ObservableCollection <TIPO_VISITA>(new cTipoVisita().ObtenerTodos());
            ListAreas           = new ObservableCollection <AREA>(new cArea().ObtenerTodos());
            ListLetras          = new ObservableCollection <string>(new string[] { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" });
            Application.Current.Dispatcher.Invoke((Action)(delegate
            {
                ListAreas.Add(new AREA {
                    ID_AREA = -1, DESCR = "SELECCIONE"
                });
                SelectArea = -1;
                ListVisitaDia.Add(new VISITA_DIA {
                    ID_DIA = -1, DESCR = "SELECCIONE"
                });
                ListVisitaDiaFiltro.Add(new VISITA_DIA {
                    ID_DIA = -1, DESCR = "TODOS"
                });
                ListVisitaDiaFiltro.InsertRange(x);
                ListTipoVisita.Insert(0, new TIPO_VISITA {
                    ID_TIPO_VISITA = -1, DESCR = "SELECCIONE"
                });
                //ListLetras.Insert(0, string.Empty);
                SelectLetraInicial = SelectLetraFinal = string.Empty;
                SelectTipoVisita = SelectFechaFiltro = -1;
                SelectDiaVisita = 1;
            }));
        }
Пример #6
0
 private void LimpiarEmpleado()
 {
     NipE              = null;
     NombreE           = PaternoE = MaternoE = string.Empty;
     LstEmpleadoPop    = new RangeEnabledObservableCollection <SSP.Servidor.PERSONA>();
     EmpleadoEmpty     = false;
     ImagenEmpleadoPop = new Imagenes().getImagenPerson();
 }
 private async Task Buscar()
 {
     filtro            = Opcion;
     Pagina            = 1;
     SeguirCargando    = true;
     ResultadosVisible = Visibility.Collapsed;
     LstResultado      = new RangeEnabledObservableCollection <INGRESO>();
     TotalInternos();
     LstResultado.InsertRange(await SegmentarResultadoBusqueda());
     ResultadosVisible = LstResultado.Count > 0 ? Visibility.Collapsed : Visibility.Visible;
 }
        private async void cerrarVisualizadorDocumentos()
        {
            try
            {
                PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.VISUALIZAR_DOCUMENTOS);
                var amparo = new cAmparoIndirectoTipos().Obtener(SelectedIngreso.Ingreso.ID_CENTRO, SelectedIngreso.Ingreso.ID_ANIO, SelectedIngreso.Ingreso.ID_IMPUTADO, SelectedIngreso.Ingreso.ID_INGRESO, null, 5, 2).FirstOrDefault();
                var res    = await new Dialogos().ConfirmacionTresBotonesDinamico("Mensaje", "El interno " + ObtieneNombre(SelectedIngreso.Ingreso.IMPUTADO) + " tiene un amparo para traslado", "Agregar", Convert.ToInt32(Tipo_Respuesta.Agregar),
                                                                                  "Ver amparo", Convert.ToInt32(Tipo_Respuesta.Mostrar_Documento), string.Empty, Convert.ToInt32(Tipo_Respuesta.Cancelar));
                switch ((Tipo_Respuesta)res)
                {
                case Tipo_Respuesta.Agregar:
                    SelectedIngreso.Seleccionado = true;
                    LstIngresosSeleccionados.Add(SelectedIngreso.Ingreso);
                    SeleccionadosIngresos.Add(SelectedIngreso.Ingreso);
                    var temp = LstIngresos;
                    LstIngresos = new RangeEnabledObservableCollection <cTrasladoIngreso>();
                    LstIngresos.InsertRange(temp);
                    SelectedIngreso = null;
                    break;

                case Tipo_Respuesta.Cancelar:
                    SelectedIngreso = null;
                    break;

                case Tipo_Respuesta.Mostrar_Documento:
                    var encontro_amparo_doc = new cAmparoIndirectoDocto().Obtener(amparo.ID_CENTRO, amparo.ID_ANIO, amparo.ID_IMPUTADO, amparo.ID_INGRESO, amparo.ID_AMPARO_INDIRECTO).FirstOrDefault();
                    if (encontro_amparo_doc == null)
                    {
                        new Dialogos().ConfirmacionDialogo("Mensaje", "El documento del amparo no se encuentra en el sistema");
                    }
                    else
                    {
                        var _file = encontro_amparo_doc.DOCUMENTO;
                        await Task.Factory.StartNew(() =>
                        {
                            var fileNamepdf = Path.GetTempPath() + Path.GetRandomFileName().Split('.')[0] + ".pdf";
                            File.WriteAllBytes(fileNamepdf, _file);
                            Application.Current.Dispatcher.Invoke((System.Action)(delegate
                            {
                                PDFViewer.LoadFile(fileNamepdf);
                                PDFViewer.Visibility = Visibility.Visible;
                            }));
                        });

                        PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.VISUALIZAR_DOCUMENTOS);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al agregar el imputado", ex);
            }
        }
        /// <summary>
        /// Metodo Utilizado para bsuqueda de imputado
        /// </summary>
        /// <param name="obj"></param>
        private async void buscarImputado(Object obj = null)
        {
            try
            {
                if (obj != null)
                {
                    //cuando es boton no se hace nada porque solamente existe el de buscar, si hay otro habra que castearlos a button y hacer la comparacion
                    var textbox = obj as TextBox;
                    if (textbox != null)
                    {
                        switch (textbox.Name)
                        {
                        case "NombreBuscar":
                            NombreBuscar = textbox.Text;
                            break;

                        case "ApellidoPaternoBuscar":
                            ApellidoPaternoBuscar = textbox.Text;
                            break;

                        case "ApellidoMaternoBuscar":
                            ApellidoMaternoBuscar = textbox.Text;
                            break;

                        case "FolioBuscar":
                            FolioBuscar = Convert.ToInt32(textbox.Text);
                            break;

                        case "AnioBuscar":
                            AnioBuscar = int.Parse(textbox.Text);
                            break;
                        }
                    }
                }
                TabVisible     = false;
                ImagenIngreso  = ImagenImputado = new Imagenes().getImagenPerson();
                ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                SelectIngresoEnabled = false;
                if (ListExpediente != null)
                {
                    EmptyExpedienteVisible = ListExpediente.Count < 0;
                }
                else
                {
                    EmptyExpedienteVisible = true;
                }
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar al imputado.", ex);
            }
        }
Пример #10
0
 private async void ObtenerSolicitudes()
 {
     try
     {
         LstSolicitudes = new RangeEnabledObservableCollection <cSolicitudCita>();
         LstSolicitudes.InsertRange(await SegmentarBusqueda());
         EmptySolicitudes = LstSolicitudes.Count > 0 ? Visibility.Collapsed : Visibility.Visible;
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar las solicitudes", ex);
     }
 }
Пример #11
0
 private async void FiltrarBusquedaPases()
 {
     try
     {
         var filtro = TextNombreFiltro;
         ListPases = ListPasesTotales = new RangeEnabledObservableCollection <VERIFICACION_PASES>();
         ListPasesTotales.InsertRange(await SegmentarResultadoBusqueda());
         TextNombreFiltro = filtro;
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al filtrar la lista de pases.", ex);
     }
 }
 private async void Buscar()
 {
     try
     {
         fNombreAux           = FNombre;
         fClasificacionAux    = FClasificacion;
         LstConsultaUnificada = new RangeEnabledObservableCollection <CONSULTA_UNIFICADA>();
         LstConsultaUnificada.InsertRange(await SegmentarResultadoBusqueda(1));
         DataGridVacio = LstConsultaUnificada.Count > 0 ? Visibility.Collapsed : Visibility.Visible;
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar.", ex);
     }
 }
Пример #13
0
        private async Task <List <VERIFICACION_PASES> > SegmentarResultadoBusqueda(int _Pag = 1)
        {
            try
            {
                Pagina = _Pag;
                var result = await StaticSourcesViewModel.CargarDatosAsync <ObservableCollection <VERIFICACION_PASES> >(() => new ObservableCollection <VERIFICACION_PASES>((
                                                                                                                                                                                new cPasesVisitanteIngreso().ObtenerPasesXAutorizarXCentroDocumentoYFecha(SelectTipoPase, GlobalVar.gCentro, FechaFiltroInicial, FechaFiltroFinal, SelectAutorizaFiltro, Pagina)).Select(s => new VERIFICACION_PASES
                {
                    NOMBRE_VISITANTE = s.VISITANTE_INGRESO.VISITANTE.PERSONA.PATERNO.Trim() + " " +
                                       (string.IsNullOrEmpty(s.VISITANTE_INGRESO.VISITANTE.PERSONA.MATERNO) ? string.Empty : s.VISITANTE_INGRESO.VISITANTE.PERSONA.MATERNO.Trim()) + " " +
                                       s.VISITANTE_INGRESO.VISITANTE.PERSONA.NOMBRE.Trim(),
                    NOMBRE_IMPUTADO = s.VISITANTE_INGRESO.INGRESO.IMPUTADO.PATERNO.Trim() + " " +
                                      (string.IsNullOrEmpty(s.VISITANTE_INGRESO.INGRESO.IMPUTADO.MATERNO) ? string.Empty : s.VISITANTE_INGRESO.INGRESO.IMPUTADO.MATERNO.Trim()) + " " +
                                      s.VISITANTE_INGRESO.INGRESO.IMPUTADO.NOMBRE.Trim(),
                    CENTRO = s.VISITANTE_INGRESO.INGRESO.CENTRO.DESCR.Trim(),
                    EDAD = (short)new Fechas().CalculaEdad(s.VISITANTE_INGRESO.VISITANTE.PERSONA.FEC_NACIMIENTO),
                    PARENTESCO = s.VISITANTE_INGRESO.TIPO_REFERENCIA.DESCR,
                    FECHA = s.FECHA_ALTA,
                    ID_ANIO = s.ID_ANIO,
                    ID_CENTRO = s.ID_CENTRO,
                    ID_IMPUTADO = s.ID_IMPUTADO,
                    ID_INGRESO = s.ID_INGRESO,
                    ID_PERSONA = s.ID_PERSONA,
                    ID_TIPO_PASE = s.ID_PASE.Value,
                    TIPO_PASE = s.PASE_CATALOGO.DESCR,
                    OBJETO_VISITANTE_INGRESO_PASE = s,
                    AUTORIZA = s.AUTORIZADO == null ? new Nullable <bool>() : s.AUTORIZADO == "S"
                })));

                if (result.Any())
                {
                    Pagina++;
                    SeguirCargando = true;
                }
                else
                {
                    SeguirCargando = false;
                }
                ListPases = new RangeEnabledObservableCollection <VERIFICACION_PASES>();
                ListPases.InsertRange(result);
                return(result.ToList());
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al realizar la busqueda de pases.", ex);
                return(new List <VERIFICACION_PASES>());
            }
        }
Пример #14
0
 //private void PopulateBuscarExterno()
 //{
 //    try
 //    {
 //        System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate
 //        {
 //            int? x = !string.IsNullOrEmpty(NipEx) ? int.Parse(NipEx) : 0;
 //            LstExternoPop = new ObservableCollection<PERSONA_EXTERNO>(new cPersonaExterna().ObtenerTodos(/*4*/GlobalVar.gCentro, x > 0 ? x : null, PaternoEx, MaternoEx, NombreEx));
 //            ExternoEmpty = LstExternoPop.Count > 0 ? false : true;
 //        }));
 //    }
 //    catch (Exception ex)
 //    {
 //        StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar visita externa", ex);
 //    }
 //}
 private async void PopulateBuscarExterno()
 {
     try
     {
         PaginaExterno         = 1;
         SeguirCargandoExterno = true;
         SelectedExternoPop    = null;
         LstExternoPop         = new RangeEnabledObservableCollection <PERSONA_EXTERNO>();
         LstExternoPop.InsertRange(await SegmentarExternoBusqueda());
         ExternoEmpty = LstExternoPop.Count > 0 ? false : true;
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar visitante", ex);
     }
 }
Пример #15
0
        //private void PopulateBuscarVisita()
        //{
        //    try
        //    {
        //        System.Windows.Application.Current.Dispatcher.Invoke((Action)(delegate
        //        {
        //            LstVisitantePop = new ObservableCollection<VISITANTE>(new cVisitante().ObtenerTodos(NoV, NombreV, PaternoV, MaternoV));
        //            VisitanteEmpty = LstVisitantePop.Count > 0 ? false : true;
        //        }));
        //    }
        //    catch (Exception ex)
        //    {
        //        StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar visitante", ex);
        //    }
        //}

        private async void PopulateBuscarVisita()
        {
            try
            {
                PaginaVisitante         = 1;
                SeguirCargandoVisitante = true;
                SelectedVisitantePop    = null;
                LstVisitantePop         = new RangeEnabledObservableCollection <VISITANTE>();
                LstVisitantePop.InsertRange(await SegmentarVisitanteBusqueda());
                VisitanteEmpty = LstVisitantePop.Count > 0 ? false : true;
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar visitante", ex);
            }
        }
Пример #16
0
        private async void ClickEnter(Object obj = null)
        {
            try
            {
                if (!pConsultar)
                {
                    (new Dialogos()).ConfirmacionDialogo("Validación", "No cuenta con suficientes privilegios para realizar esta acción.");
                    return;
                }
                if (obj != null)
                {
                    //cuando es boton no se hace nada porque solamente existe el de buscar, si hay otro habra que castearlos a button y hacer la comparacion
                    var textbox = obj as TextBox;
                    if (textbox != null)
                    {
                        switch (textbox.Name)
                        {
                        case "NUCBuscar":
                            NUC = textbox.Text;
                            break;

                        case "NombreBuscar":
                            Nombre = textbox.Text;
                            break;

                        case "ApellidoPaternoBuscar":
                            Paterno = textbox.Text;
                            break;

                        case "ApellidoMaternoBuscar":
                            Materno = textbox.Text;
                            break;
                        }
                    }
                }
                //BuscarEscalaRiesgo();
                Pagina          = 1;
                SeguirCargando  = true;
                LstEscalaRiesgo = new RangeEnabledObservableCollection <ESCALA_RIESGO>();
                LstEscalaRiesgo.InsertRange(await SegmentarResultadoBusqueda());
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar al imputado.", ex);
            }
        }
Пример #17
0
        private async void buscarImputadoInterno(Object obj = null)
        {
            ImagenIngreso = ImagenImputado = new Imagenes().getImagenPerson();
            //ListExpediente = new List<IMPUTADO>();
            ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
            ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
            //ListExpediente = await SegmentarResultadoBusqueda();

            //if (ListExpediente != null)
            //{
            //    EmptyExpedienteVisible = ListExpediente.Count < 0;
            //    var ListExpedienteAux = new List<IMPUTADO>(ListExpediente);
            //    foreach (var Expediente in ListExpediente)
            //    {
            //        var ingreso_activo = Expediente.INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault();
            //        if (ingreso_activo != null)
            //        {
            //            if (ingreso_activo.ID_ESTATUS_ADMINISTRATIVO != LIBERADO &&
            //            ingreso_activo.ID_ESTATUS_ADMINISTRATIVO != TRASLADADO &&
            //            ingreso_activo.ID_ESTATUS_ADMINISTRATIVO != SUJETO_A_PROCESO_EN_LIBERTAD &&
            //            ingreso_activo.ID_ESTATUS_ADMINISTRATIVO != DISCRECIONAL)
            //            {
            //                if (!ingreso_activo.ABOGADO_INGRESO.Any())
            //                {
            //                    ListExpedienteAux.Remove(Expediente);
            //                }
            //            }
            //            else
            //            {
            //                ListExpedienteAux.Remove(Expediente);
            //            }
            //        }
            //        else
            //        {
            //            ListExpedienteAux.Remove(Expediente);
            //        }


            //    }
            //    ListExpediente = ListExpedienteAux;
            //}
            //else
            //    EmptyExpedienteVisible = true;
        }
 private void Limpiar()
 {
     //Datos Traslado
     DTFecha                              = null;
     DTMotivo                             = DTCentroDestino = -1;
     DTJustificacion                      = DTNoOficio = string.Empty;
     DENoOficio                           = string.Empty;
     AutorizaSalida                       = AutoridadesSalida.First(w => w == "SELECCIONE").ToString();
     LstIngresos                          = new RangeEnabledObservableCollection <cTrasladoIngreso>();
     LstIngresosSeleccionados             = null;
     SeleccionadosIngresos                = null;
     ImagenIngreso                        = null;
     NombreBuscarImputado                 = string.Empty;
     ApellidoPaternoBuscarImputado        = string.Empty;
     ApellidoMaternoBuscarImputado        = string.Empty;
     AnioBuscarImputado                   = null;
     FolioBuscarImputado                  = null;
     StaticSourcesViewModel.SourceChanged = false;
 }
 private async void BuscarEnfermedades()
 {
     try
     {
         ListEnfermedades = new RangeEnabledObservableCollection <ENFERMEDAD>();
         ListEnfermedades.InsertRange(await SegmentarResultadoBusqueda());
         if (ListEnfermedades == null || ListEnfermedades.Count() == 0)
         {
             EmptyVisible = true;
         }
         else
         {
             EmptyVisible = false;
         }
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar las enfermedades.", ex);
     }
 }
 private async void BuscarPersonasSinCodigo()
 {
     try
     {
         var person = SelectPersona;
         ListPersonasAuxiliar = new RangeEnabledObservableCollection <SSP.Servidor.PERSONA>();
         ListPersonas         = new RangeEnabledObservableCollection <SSP.Servidor.PERSONA>();
         ListPersonas.InsertRange(await SegmentarPersonasBusqueda());
         ListPersonasAuxiliar.InsertRange(ListPersonas);
         if (PopUpsViewModels.VisibleBuscarPersonasExistentes == System.Windows.Visibility.Collapsed)
         {
             SelectPersonaAuxiliar = person;
             PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.AGREGAR_ESPECIALISTAS);
         }
         EmptyBuscarRelacionInternoVisible = !(ListPersonas.Count > 0);
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al traer datos del visitante externo.", ex);
     }
 }
        private async void TrasladoMasivoLoad(TrasladoMasivoView Window = null)
        {
            try
            {
                estatus_inactivos = Parametro.ESTATUS_ADMINISTRATIVO_INACT;
                await StaticSourcesViewModel.CargarDatosMetodoAsync(PrepararListas).ContinueWith((prevTask) => {
                    Limpiar();
                });

                LstIngresos = new RangeEnabledObservableCollection <cTrasladoIngreso>();
                await ObtenerTodosActivos();

                SetValidacionesTraslados();
                PDFViewer = PopUpsViewModels.MainWindow.MostrarPDFView.pdfViewer;
                StaticSourcesViewModel.SourceChanged = false;
                ConfiguraPermisos();
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar el traslado", ex);
            }
        }
Пример #22
0
 private async void BuscarImputado()
 {
     try
     {
         ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
         ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
         if (ListExpediente != null)
         {
             if (ListExpediente.Count == 0)
             {
                 EmptyExpedienteVisible = true;
             }
             else
             {
                 emptyExpedienteVisible = false;
             }
         }
     }
     catch (Exception ex)
     {
         StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al buscar imputado", ex);
     }
 }
Пример #23
0
        private void BuscarVisitaNew()
        {
            try
            {
                Pagina         = 1;
                SeguirCargando = true;
                ListVisitantes = new RangeEnabledObservableCollection <PERSONAVISITAAUXILIAR>();
                //Application.Current.Dispatcher.Invoke((Action)(delegate
                //{
                ListVisitantes = new RangeEnabledObservableCollection <PERSONAVISITAAUXILIAR>();
                ListVisitantes.InsertRange(SegmentarBusqueda());
                //}));

                EmptyBuscarRelacionInternoVisible = ListVisitantes.Count > 0 ? false : true;
                if (ListVisitantes != null)
                {
                    if (ListVisitantes.Count == 1)
                    {
                        SelectVisitante = ListVisitantes.FirstOrDefault();
                        GetDatosVisitanteSeleccionadoPadron();
                        ObservacionEnabled = true;
                    }
                    else
                    {
                        PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSCAR_VISITA_EXISTENTE);
                    }
                }
                else
                {
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSCAR_VISITA_EXISTENTE);
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al cargar los datos del visitante seleccionado.", ex);
            }
        }
        private async void clickSwitch(Object obj)
        {
            switch (obj.ToString())
            {
            case "limpiar_lesion":
                BotonLesionEnabled    = true;
                TextDescripcionLesion = string.Empty;
                var radioButons = new FingerPrintScanner().FindVisualChildren <RadioButton>(((CertificadoMedicoIngresoView)((ContentControl)Application.Current.Windows[0].FindName("contentControl")).Content)).ToList();
                foreach (var item in radioButons)
                {
                    item.IsChecked = false;
                }
                SelectLesion = null;
                break;

            case "agregar_lesion":
                await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                {
                    if (SelectIngreso == null)
                    {
                        Application.Current.Dispatcher.Invoke((Action)(delegate
                        {
                            new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar un ingreso.");
                        }));
                        return;
                    }
                    ;
                    if (string.IsNullOrEmpty(TextDescripcionLesion))
                    {
                        Application.Current.Dispatcher.Invoke((Action)(delegate
                        {
                            new Dialogos().ConfirmacionDialogo("Validación", "Debes ingresar una descripcion de la lesión.");
                        }));
                        return;
                    }
                    if (SelectRegion == null)
                    {
                        Application.Current.Dispatcher.Invoke((Action)(delegate
                        {
                            new Dialogos().ConfirmacionDialogo("Validación", "Debes seleccionar la region donde se encuentra la lesión.");
                        }));
                        return;
                    }
                    ;
                    if (ListLesiones == null)
                    {
                        ListLesiones = new ObservableCollection <LesionesCustom>();
                    }
                    ListLesiones.Add(new LesionesCustom {
                        DESCR = TextDescripcionLesion, REGION = new cAnatomiaTopografica().Obtener((int)SelectRegion)
                    });
                });

                break;

            case "agendar_cita":

                break;

            case "nueva_busqueda":
                NombreBuscar   = ApellidoPaternoBuscar = ApellidoMaternoBuscar = string.Empty;
                FolioBuscar    = AnioBuscar = new int?();
                ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                break;

            case "salir_menu":
                PrincipalViewModel.SalirMenu();
                break;

            case "buscar_visible":
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                break;

            case "buscar_salir":
                PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA);
                break;

            case "limpiar_menu":
                ((System.Windows.Controls.ContentControl)PopUpsViewModels.MainWindow.FindName("contentControl")).Content     = new CertificadoMedicoIngresoView();
                ((System.Windows.Controls.ContentControl)PopUpsViewModels.MainWindow.FindName("contentControl")).DataContext = new ControlPenales.CertificadoMedicoIngresoViewModel();
                break;

            case "buscar_menu":
                ListExpediente         = new RangeEnabledObservableCollection <IMPUTADO>();
                SelectExpediente       = new IMPUTADO();
                EmptyExpedienteVisible = true;
                ApellidoPaternoBuscar  = ApellidoMaternoBuscar = NombreBuscar = string.Empty;
                FolioBuscar            = AnioBuscar = null;
                ImagenImputado         = ImagenIngreso = new Imagenes().getImagenPerson();
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                break;

            case "buscar_seleccionar":
                if (SelectIngreso == null)
                {
                    new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar un ingreso");
                    break;
                }
                ;
                if (SelectIngreso.ID_UB_CENTRO != GlobalVar.gCentro)
                {
                    new Dialogos().ConfirmacionDialogo("Validación", "El ingreso seleccionado no pertenece a su centro.");
                    break;
                }
                ;
                var toleranciaTraslado = Parametro.TOLERANCIA_TRASLADO_EDIFICIO;
                if (SelectIngreso.TRASLADO_DETALLE.Any(a => (a.ID_ESTATUS != "CA" ? a.TRASLADO.ORIGEN_TIPO != "F" : false) && a.TRASLADO.TRASLADO_FEC.AddHours(-toleranciaTraslado) <= Fechas.GetFechaDateServer))
                {
                    new Dialogos().ConfirmacionDialogo("Notificación!", "El interno [" + SelectIngreso.ID_ANIO.ToString() + "/" + SelectIngreso.ID_IMPUTADO.ToString() + "] tiene un traslado proximo y no puede recibir visitas.");
                    break;
                }
                ;
                SelectedIngreso = SelectIngreso;
                StaticSourcesViewModel.SourceChanged = false;
                PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA);
                //OnBuscarPorHuella();///Inmediatamente que se valida, continua con la siguiente validacion(busqueda por biometria), comentar en caso de pruebas omitiendo biometria
                break;

            case "guardar_menu":
                if (SelectExpediente == null)
                {
                    new Dialogos().ConfirmacionDialogo("Validación", "Debes seleccionar un imputado.");
                    break;
                }
                if (SelectIngreso == null)
                {
                    new Dialogos().ConfirmacionDialogo("Validación", "Debes seleccionar un ingreso valido.");
                    break;
                }


                break;
            }
        }
Пример #25
0
        private async void ModelEnter(Object obj)
        {
            try
            {
                if (obj != null)
                {
                    if (!obj.GetType().Name.Equals("String"))
                    {
                        //cuando es boton no se hace nada porque solamente existe el de buscar, si hay otro habra que castearlos a button y hacer la comparacion
                        var textbox = obj as TextBox;
                        if (textbox != null)
                        {
                            switch (textbox.Name)
                            {
                            case "NombreBuscar":
                                NombreBuscar = textbox.Text;
                                NombreD      = NombreBuscar;
                                FolioBuscar  = FolioD;
                                AnioBuscar   = AnioD;
                                break;

                            case "ApellidoPaternoBuscar":
                                ApellidoPaternoBuscar = textbox.Text;
                                PaternoD    = ApellidoPaternoBuscar;
                                FolioBuscar = FolioD;
                                AnioBuscar  = AnioD;
                                break;

                            case "ApellidoMaternoBuscar":
                                ApellidoMaternoBuscar = textbox.Text;
                                MaternoD    = ApellidoMaternoBuscar;
                                FolioBuscar = FolioD;
                                AnioBuscar  = AnioD;
                                break;

                            case "FolioBuscar":
                                if (!string.IsNullOrEmpty(textbox.Text))
                                {
                                    FolioBuscar = int.Parse(textbox.Text);
                                }
                                else
                                {
                                    FolioBuscar = null;
                                }
                                AnioBuscar = AnioD;
                                break;

                            case "AnioBuscar":
                                if (!string.IsNullOrEmpty(textbox.Text))
                                {
                                    AnioBuscar = int.Parse(textbox.Text);
                                }
                                else
                                {
                                    AnioBuscar = null;
                                }
                                FolioBuscar = FolioD;
                                break;
                            }
                        }
                    }
                }
                ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();

                if (string.IsNullOrEmpty(NombreD))
                {
                    NombreBuscar = string.Empty;
                }
                else
                {
                    NombreBuscar = NombreD;
                }

                if (string.IsNullOrEmpty(PaternoD))
                {
                    ApellidoPaternoBuscar = string.Empty;
                }
                else
                {
                    ApellidoPaternoBuscar = PaternoD;
                }

                if (string.IsNullOrEmpty(MaternoD))
                {
                    ApellidoMaternoBuscar = string.Empty;
                }
                else
                {
                    ApellidoMaternoBuscar = MaternoD;
                }

                if (AnioBuscar != null && FolioBuscar != null)
                {
                    ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                    ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                    if (ListExpediente.Count == 1)
                    {
                        if (ListExpediente[0].INGRESO.Count > 0)
                        {
                            foreach (var item in ListExpediente[0].INGRESO)
                            {
                                if (item.ID_ESTATUS_ADMINISTRATIVO != Parametro.ID_ESTATUS_ADMVO_LIBERADO)
                                {
                                    SelectExpediente = ListExpediente[0];
                                    SelectIngreso    = item;
                                    //TabVisible = true;
                                    //this.SeleccionaIngreso();
                                    //this.ViewModelArbol();
                                    //EdificioI = SelectIngreso.ID_UB_EDIFICIO;
                                    ObtenerIngreso();
                                    PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA);
                                    break;
                                }
                                else
                                {
                                    SelectExpediente = null;
                                    SelectIngreso    = null;
                                    ImagenImputado   = ImagenIngreso = new Imagenes().getImagenPerson();
                                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                                    //TabVisible = false;
                                }
                            }
                        }
                        else
                        {
                            SelectExpediente = null;
                            SelectIngreso    = null;
                            ImagenImputado   = ImagenIngreso = new Imagenes().getImagenPerson();
                            PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                            //TabVisible = false;
                        }
                    }
                    else
                    {
                        ImagenImputado = ImagenIngreso = new Imagenes().getImagenPerson();
                        PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                        //TabVisible = false;
                    }
                }
                else
                {
                    //ListExpediente = (new cImputado()).ObtenerTodos(ApellidoPaternoBuscar, ApellidoMaternoBuscar, NombreBuscar, AnioBuscar,FolioBuscar);
                    ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                    ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                    if (ListExpediente.Count > 0)//Empty row
                    {
                        EmptyExpedienteVisible = false;
                    }
                    else
                    {
                        EmptyExpedienteVisible = true;
                    }
                    ImagenImputado = ImagenIngreso = new Imagenes().getImagenPerson();
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                    //TabVisible = false;
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al ingresar busqueda", ex);
            }
        }
Пример #26
0
        private async void ModelEnter(Object obj)
        {
            try
            {
                if (obj != null)
                {
                    if (!PConsultar)
                    {
                        (new Dialogos()).ConfirmacionDialogo("Validación", "No cuenta con suficientes privilegios para realizar esta acción.");
                        return;
                    }
                    if (!obj.GetType().Name.Equals("String"))
                    {
                        var textbox = obj as TextBox;
                        if (textbox != null)
                        {
                            switch (textbox.Name)
                            {
                            case "NombreBuscar":
                                NombreBuscar = textbox.Text;
                                NombreD      = NombreBuscar;
                                FolioBuscar  = FolioD;
                                AnioBuscar   = AnioD;
                                break;

                            case "ApellidoPaternoBuscar":
                                ApellidoPaternoBuscar = textbox.Text;
                                PaternoD    = ApellidoPaternoBuscar;
                                FolioBuscar = FolioD;
                                AnioBuscar  = AnioD;
                                break;

                            case "ApellidoMaternoBuscar":
                                ApellidoMaternoBuscar = textbox.Text;
                                MaternoD    = ApellidoMaternoBuscar;
                                FolioBuscar = FolioD;
                                AnioBuscar  = AnioD;
                                break;

                            case "FolioBuscar":
                                if (!string.IsNullOrEmpty(textbox.Text))
                                {
                                    FolioBuscar = int.Parse(textbox.Text);
                                }
                                else
                                {
                                    FolioBuscar = null;
                                }
                                AnioBuscar = AnioD;
                                break;

                            case "AnioBuscar":
                                if (!string.IsNullOrEmpty(textbox.Text))
                                {
                                    AnioBuscar = int.Parse(textbox.Text);
                                }
                                else
                                {
                                    AnioBuscar = null;
                                }
                                FolioBuscar = FolioD;
                                break;
                            }
                        }
                    }
                }
                ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();

                if (string.IsNullOrEmpty(NombreD))
                {
                    NombreBuscar = string.Empty;
                }
                else
                {
                    NombreBuscar = NombreD;
                }

                if (string.IsNullOrEmpty(PaternoD))
                {
                    ApellidoPaternoBuscar = string.Empty;
                }
                else
                {
                    ApellidoPaternoBuscar = PaternoD;
                }

                if (string.IsNullOrEmpty(MaternoD))
                {
                    ApellidoMaternoBuscar = string.Empty;
                }
                else
                {
                    ApellidoMaternoBuscar = MaternoD;
                }

                if (AnioBuscar != null && FolioBuscar != null)
                {
                    ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                    ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                    if (ListExpediente.Count == 1)
                    {
                        if (estatus_inactivos.Contains(ListExpediente[0].INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault().ID_ESTATUS_ADMINISTRATIVO))
                        {
                            SelectExpediente = null;
                            SelectIngreso    = null;
                            ImagenImputado   = ImagenIngreso = new Imagenes().getImagenPerson();
                            PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                            new Dialogos().ConfirmacionDialogo("Notificación!", "No se encontró ningún ingreso activo en este imputado.");
                            return;
                        }
                        if (ListExpediente[0].INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault().ID_UB_CENTRO != GlobalVar.gCentro)
                        {
                            SelectExpediente = null;
                            SelectIngreso    = null;
                            ImagenImputado   = ImagenIngreso = new Imagenes().getImagenPerson();
                            PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                            new Dialogos().ConfirmacionDialogo("Validación", "El ingreso seleccionado no pertenece a su centro.");
                            return;
                        }
                        var toleranciaTraslado = Parametro.TOLERANCIA_TRASLADO_EDIFICIO;
                        if (ListExpediente[0].INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault().TRASLADO_DETALLE.Any(a => (a.ID_ESTATUS != "CA" ? a.TRASLADO.ORIGEN_TIPO != "F" : false) && a.TRASLADO.TRASLADO_FEC.AddHours(-toleranciaTraslado) <= Fechas.GetFechaDateServer))
                        {
                            new Dialogos().ConfirmacionDialogo("Notificación!", "El interno [" + ListExpediente[0].ID_ANIO.ToString() + "/" +
                                                               ListExpediente[0].ID_IMPUTADO.ToString() + "] tiene un traslado próximo y no tiene permitido ningún cambio de información.");
                            return;
                        }

                        SelectExpediente = ListExpediente[0];
                        SelectIngreso    = ListExpediente[0].INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault();
                        SelectedInterno  = SelectExpediente;
                        //SeleccionaIngreso();
                        StaticSourcesViewModel.SourceChanged = false;
                        PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA);
                        return;
                    }
                    else
                    {
                        SelectExpediente = null;
                        SelectIngreso    = null;
                        ImagenImputado   = ImagenIngreso = new Imagenes().getImagenPerson();
                        PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                    }
                }
                else
                {
                    ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                    ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                    if (ListExpediente.Count > 0)//Empty row
                    {
                        EmptyExpedienteVisible = false;
                    }
                    else
                    {
                        EmptyExpedienteVisible = true;
                    }

                    ImagenImputado = ImagenIngreso = new Imagenes().getImagenPerson();
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al ingresar búsqueda", ex);
            }
        }
Пример #27
0
        /// <summary>
        //Metodo que recive el evento click de una busqueda
        /// </summary>
        /// <param name="obj"></param>
        private async void ClickEnter(Object obj)
        {
            try
            {
                if (obj != null)
                {
                    //cuando es boton no se hace nada porque solamente existe el de buscar, si hay otro habra que castearlos a button y hacer la comparacion
                    var textbox = obj as System.Windows.Controls.TextBox;
                    if (textbox != null)
                    {
                        switch (textbox.Name)
                        {
                        case "NUCBuscar":
                            NUCBuscar = textbox.Text;
                            break;

                        case "NombreBuscar":
                            NombreBuscar = textbox.Text;
                            break;

                        case "ApellidoPaternoBuscar":
                            ApellidoPaternoBuscar = textbox.Text;
                            break;

                        case "ApellidoMaternoBuscar":
                            ApellidoMaternoBuscar = textbox.Text;
                            break;

                        case "AnioBuscar":
                            if (!string.IsNullOrEmpty(textbox.Text))
                            {
                                AnioBuscar = short.Parse(textbox.Text);
                            }
                            else
                            {
                                AnioBuscar = null;
                            }
                            break;

                        case "FolioBuscar":
                            if (!string.IsNullOrEmpty(textbox.Text))
                            {
                                FolioBuscar = int.Parse(textbox.Text);
                            }
                            else
                            {
                                FolioBuscar = null;
                            }
                            break;
                        }
                    }

                    #region nuevo
                    LstLiberados = new RangeEnabledObservableCollection <cLiberados>();
                    LstLiberados.InsertRange(await SegmentarResultadoBusquedaLiberados());
                    EmptyExpedienteVisible = LstLiberados.Count > 0 ? false : true;
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSCAR_LIBERADO);
                    #endregion
                    //PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSCAR_LIBERADO);
                    //ListExpediente = new RangeEnabledObservableCollection<IMPUTADO>();
                    //ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                    //if (ListExpediente.Count > 0)//Empty row
                    //    EmptyExpedienteVisible = false;
                    //else
                    //    EmptyExpedienteVisible = true;
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error en el flujo del modulo", ex);
            }
        }
        private async void ModelEnter(Object obj)
        {
            try
            {
                NombreBuscar          = TextNombreImputado;
                ApellidoPaternoBuscar = TextPaternoImputado;
                ApellidoMaternoBuscar = TextMaternoImputado;
                FolioBuscar           = TextFolioImputado;
                AnioBuscar            = TextAnioImputado;

                ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();

                #region Validacion Nombre y Apellidos
                if (string.IsNullOrEmpty(TextNombreImputado))
                {
                    NombreBuscar = string.Empty;
                }
                else
                {
                    NombreBuscar = TextNombreImputado;
                }

                if (string.IsNullOrEmpty(TextPaternoImputado))
                {
                    ApellidoPaternoBuscar = string.Empty;
                }
                else
                {
                    ApellidoPaternoBuscar = TextPaternoImputado;
                }

                if (string.IsNullOrEmpty(TextMaternoImputado))
                {
                    ApellidoMaternoBuscar = string.Empty;
                }
                else
                {
                    ApellidoMaternoBuscar = TextMaternoImputado;
                }

                #endregion

                if (AnioBuscar != null && FolioBuscar != null)
                {
                    ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                    ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                    if (ListExpediente.Count == 1)
                    {
                        await StaticSourcesViewModel.CargarDatosMetodoAsync(() =>
                        {
                            if (ListExpediente[0].INGRESO.Count == 0)
                            {
                                SelectExpediente = null;
                                SelectIngreso    = null;
                                ImagenImputado   = ImagenIngreso = new Imagenes().getImagenPerson();
                                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                            }
                            if (Parametro.ESTATUS_ADMINISTRATIVO_INACT.Any(a => a.HasValue ? a.Value == ListExpediente[0].INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault().ID_ESTATUS_ADMINISTRATIVO : false))
                            {
                                Application.Current.Dispatcher.Invoke((Action)(delegate
                                {
                                    new Dialogos().ConfirmacionDialogo("Notificación!", "No se encontró ningun ingreso activo en este imputado.");
                                }));
                                return;
                            }
                            if (ListExpediente[0].INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault().ID_UB_CENTRO.HasValue ?
                                ListExpediente[0].INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault().ID_UB_CENTRO != GlobalVar.gCentro : false)
                            {
                                SelectExpediente = null;
                                SelectIngreso    = null;
                                ImagenImputado   = ImagenIngreso = new Imagenes().getImagenPerson();
                                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                                Application.Current.Dispatcher.Invoke((Action)(delegate
                                {
                                    new Dialogos().ConfirmacionDialogo("Validación", "El ingreso seleccionado no pertenece a su centro.");
                                }));
                                return;
                            }
                            SelectExpediente = ListExpediente[0];
                            SelectIngreso    = SelectExpediente.INGRESO.OrderByDescending(o => o.ID_INGRESO).FirstOrDefault();
                            ///TODO: checar si ya existe el certificado en el ingreso seleccionado
                            GetDatosImputadoSeleccionado();
                            StaticSourcesViewModel.SourceChanged = false;
                            PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA);
                        });
                    }
                    else
                    {
                        ImagenImputado = ImagenIngreso = new Imagenes().getImagenPerson();
                        PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                    }
                }
                else
                {
                    ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                    ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                    if (ListExpediente.Count > 0)//Empty row
                    {
                        EmptyExpedienteVisible = false;
                    }
                    else
                    {
                        EmptyExpedienteVisible = true;
                    }
                    ImagenImputado = ImagenIngreso = new Imagenes().getImagenPerson();
                    PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                }
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al ingresar búsqueda", ex);
            }

            return;
        }
        private async void ClickEnter(Object obj)
        {
            try
            {
                if (obj != null)
                {
                    var textbox = obj as TextBox;
                    if (textbox != null)
                    {
                        switch (textbox.Name)
                        {
                        case "NombreBuscar":
                            NombreBuscar = textbox.Text;
                            break;

                        case "ApellidoPaternoBuscar":
                            ApellidoPaternoBuscar = textbox.Text;
                            break;

                        case "ApellidoMaternoBuscar":
                            ApellidoMaternoBuscar = textbox.Text;
                            break;

                        case "AnioBuscar":
                            if (!string.IsNullOrEmpty(textbox.Text))
                            {
                                AnioBuscar = int.Parse(textbox.Text);
                            }
                            else
                            {
                                AnioBuscar = null;
                            }
                            break;

                        case "FolioBuscar":
                            if (!string.IsNullOrEmpty(textbox.Text))
                            {
                                FolioBuscar = int.Parse(textbox.Text);
                            }
                            else
                            {
                                FolioBuscar = null;
                            }
                            break;
                        }
                    }
                }

                ListExpediente = new RangeEnabledObservableCollection <IMPUTADO>();
                ListExpediente.InsertRange(await SegmentarResultadoBusqueda());
                if (ListExpediente.Count > 0)//Empty row
                {
                    EmptyExpedienteVisible = false;
                }
                else
                {
                    EmptyExpedienteVisible = true;
                }

                ImagenImputado = ImagenIngreso = new Imagenes().getImagenPerson();
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al ingresar búsqueda", ex);
            }

            return;
        }
Пример #30
0
        private async void clickSwitch(Object obj)
        {
            switch (obj.ToString())
            {
            case "salir_menu":
                PrincipalViewModel.SalirMenu();
                break;

            case "nueva_busqueda":
                ListExpediente         = new RangeEnabledObservableCollection <IMPUTADO>();
                SelectExpediente       = new IMPUTADO();
                EmptyExpedienteVisible = true;
                ApellidoPaternoBuscar  = ApellidoMaternoBuscar = NombreBuscar = string.Empty;
                FolioBuscar            = AnioBuscar = null;
                ImagenImputado         = ImagenIngreso = new Imagenes().getImagenPerson();
                break;

            case "buscar_menu":
                if (!PConsultar)
                {
                    (new Dialogos()).ConfirmacionDialogo("Validación", "No cuenta con suficientes privilegios para realizar esta acción.");
                    return;
                }
                LimpiarBusquedaInterno();
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                break;

            //case "reporte_menu":
            //    break;
            case "buscar_salir":
                LimpiarBusquedaInterno();
                PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA);
                break;

            case "add_interno":
                if (!PConsultar)
                {
                    (new Dialogos()).ConfirmacionDialogo("Validación", "No cuenta con suficientes privilegios para realizar esta acción.");
                    return;
                }
                LimpiarBusquedaInterno();
                PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA);
                break;

            case "del_interno":
                EliminarInterno();
                break;

            case "buscar_seleccionar":    //"seleccionar_interno_pop":
                if (SelectIngreso == null)
                {
                    new Dialogos().ConfirmacionDialogo("Validación", "Debes seleccionar un ingreso valido.");
                    return;
                }
                //Se quita candado de papeletas
                //var hoy = Fechas.GetFechaDateServer;
                //if (new cAtencionIngreso().ObtenerSolicitudesPorMes(SelectIngreso.ID_CENTRO, SelectIngreso.ID_ANIO, SelectIngreso.ID_IMPUTADO, SelectIngreso.ID_INGRESO, hoy.Year, hoy.Month) > VCitasMes)
                //{
                //    new Dialogos().ConfirmacionDialogo("Validación", "En interno ha sobrepasado el número de solicitudes por mes.");
                //    return;
                //}
                var EstatusInactivos = Parametro.ESTATUS_ADMINISTRATIVO_INACT;
                foreach (var item in EstatusInactivos)
                {
                    if (SelectIngreso.ID_ESTATUS_ADMINISTRATIVO == item)
                    {
                        new Dialogos().ConfirmacionDialogo("Notificación!", "El ingreso seleccionado no esta activo.");
                        return;
                    }
                }
                if (SelectIngreso.ID_UB_CENTRO != GlobalVar.gCentro)
                {
                    new Dialogos().ConfirmacionDialogo("Validación", "El ingreso seleccionado no pertenece a su centro.");
                    return;
                }
                var toleranciaTraslado = Parametro.TOLERANCIA_TRASLADO_EDIFICIO;
                if (SelectIngreso.TRASLADO_DETALLE.Any(a => (a.ID_ESTATUS != "CA" ? a.TRASLADO.ORIGEN_TIPO != "F" : false) && a.TRASLADO.TRASLADO_FEC.AddHours(-toleranciaTraslado) <= Fechas.GetFechaDateServer))
                {
                    new Dialogos().ConfirmacionDialogo("Notificación!", "El interno [" + SelectIngreso.ID_ANIO.ToString() + "/" +
                                                       SelectIngreso.ID_IMPUTADO.ToString() + "] tiene un traslado proximo y no puede recibir visitas.");
                    return;
                }
                AgregarInterno();
                LimpiarBuscar();
                break;

            case "salir_interno_pop":
                PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSCAR_INTERNO);
                LimpiarBuscar();
                break;

            case "buscar_interno_pop":
                Buscar();
                break;

            case "guardar_menu":
                if (!PInsertar)
                {
                    (new Dialogos()).ConfirmacionDialogo("Validación", "No cuenta con suficientes privilegios para realizar esta acción.");
                    return;
                }
                if (!base.HasErrors)
                {
                    if (ValidacionIngresos())
                    {
                        GuardarSolicitud();
                    }

                    else
                    {
                        new Dialogos().ConfirmacionDialogo("Validación!", "Favor de agregar los internos que recibirán atención.");
                    }
                }
                else
                {
                    new Dialogos().ConfirmacionDialogo("Validación!", "Favor de capturar los campos obligatorios.");
                }
                break;

            case "limpiar_menu":
                ((System.Windows.Controls.ContentControl)PopUpsViewModels.MainWindow.FindName("contentControl")).Content     = new SolicitudAtencionView();
                ((System.Windows.Controls.ContentControl)PopUpsViewModels.MainWindow.FindName("contentControl")).DataContext = new SolicitudAtencionViewModel();
                break;
            }
        }