//CLICK SWITCH - BOTONES public async void ClickSwitch(object obj) { switch (obj.ToString()) { case "BuscarClick": VentanaBusqueda.Hide(); await StaticSourcesViewModel.CargarDatosMetodoAsync(() => { var AnioBusqueda = 0; var FolioBusqueda = 0; Int32.TryParse(AnioBuscar, out AnioBusqueda); Int32.TryParse(FolioBuscar, out FolioBusqueda); if (!string.IsNullOrEmpty(NombreBuscar) || !string.IsNullOrEmpty(ApellidoPaternoBuscar) || !string.IsNullOrEmpty(ApellidoMaternoBuscar) || AnioBusqueda != 0 || FolioBusqueda != 0) { try { ListExpediente.Clear(); var imputados_busqueda = new List <InternosActividad>(); List <GRUPO_ASISTENCIA> imputados = new InternosActividad().ObtenerInternos(Areas, NombreBuscar, ApellidoPaternoBuscar, ApellidoMaternoBuscar, (short)AnioBusqueda, FolioBusqueda).Where(w => //FILTRA CON LA FECHA DEL SERVER w.GRUPO_HORARIO.HORA_INICIO.Value.Day == Fechas.GetFechaDateServer.Day && w.GRUPO_HORARIO.HORA_INICIO.Value.Month == Fechas.GetFechaDateServer.Month && w.GRUPO_HORARIO.HORA_INICIO.Value.Year == Fechas.GetFechaDateServer.Year && w.GRUPO_HORARIO.HORA_INICIO.Value.Hour == Fechas.GetFechaDateServer.Hour && //FILTRA A LOS INTERNOS CON TRASLADOS EN PROCESO Ó ACTIVOS (w.GRUPO_PARTICIPANTE.INGRESO.TRASLADO_DETALLE.Where( wTD => wTD.TRASLADO.TRASLADO_FEC.Year == Fechas.GetFechaDateServer.Year && wTD.TRASLADO.TRASLADO_FEC.Month == Fechas.GetFechaDateServer.Month && wTD.TRASLADO.TRASLADO_FEC.Day == Fechas.GetFechaDateServer.Day && (wTD.TRASLADO.ID_ESTATUS == "EP" || wTD.TRASLADO.ID_ESTATUS == "AC")).Count() == 0) && //FILTRA A LOS INTERNOS CON EXCARCELACIONES EN PROCESO Ó ACTIVAS (w.GRUPO_PARTICIPANTE.INGRESO.EXCARCELACION.Where( wEXC => wEXC.PROGRAMADO_FEC.Value.Year == Fechas.GetFechaDateServer.Year && wEXC.PROGRAMADO_FEC.Value.Month == Fechas.GetFechaDateServer.Month && wEXC.PROGRAMADO_FEC.Value.Day == Fechas.GetFechaDateServer.Day && wEXC.ID_ESTATUS == "EP" || wEXC.ID_ESTATUS == "AC").Count() == 0) ).ToList(); foreach (var imputado in imputados) { if (!ListaSeleccionados.Where(w => w.Anio == imputado.GRUPO_PARTICIPANTE.ING_ID_ANIO && w.Centro == imputado.GRUPO_PARTICIPANTE.ING_ID_CENTRO && w.IdImputado == imputado.GRUPO_PARTICIPANTE.ING_ID_IMPUTADO).Any()) { imputados_busqueda.Add(new InternosActividad() { Actividad = imputado.GRUPO_PARTICIPANTE.ACTIVIDAD.DESCR, Anio = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_ANIO, Area = (short)imputado.GRUPO_HORARIO.ID_AREA, Asistencia = imputado.ASISTENCIA == 1 ? true : false, Centro = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_CENTRO, Expediente = string.Format("{0}/{1}", imputado.GRUPO_PARTICIPANTE.ING_ID_ANIO, imputado.GRUPO_PARTICIPANTE.ING_ID_IMPUTADO), IdIngreso = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_INGRESO, IdImputado = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_IMPUTADO, Id_Grupo = (short)imputado.GRUPO_PARTICIPANTE.ID_GRUPO, IdConsec = (short)imputado.ID_CONSEC, Materno = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.MATERNO, Paterno = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.PATERNO, Nombre = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.NOMBRE, NIP = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.NIP, Ubicacion = imputado.GRUPO_HORARIO.AREA.DESCR, Seleccionar = false, Responsable = string.Format("{1} {2} {0}", imputado.GRUPO_PARTICIPANTE.GRUPO.PERSONA.NOMBRE.TrimEnd(), imputado.GRUPO_PARTICIPANTE.GRUPO.PERSONA.PATERNO.TrimEnd(), imputado.GRUPO_PARTICIPANTE.GRUPO.PERSONA.MATERNO.TrimEnd()) }); } } ListExpediente = imputados_busqueda; if (ListExpediente.Count > 0) { EmptyBusquedaVisible = false; } else { EmptyBusquedaVisible = true; } } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al realizar la busqueda de participantes.", ex); } } else { ListExpediente = new List <InternosActividad>(); } }); VentanaBusqueda.ShowDialog(); break; case "SeleccionarImputado": if (SelectedImputado != null) { if (SelectedImputado.FotoInterno == null) { try { var ingreso_biometrico = new cIngresoBiometrico(); var placeholder = new Imagenes().getImagenPerson(); var foto_ingreso = ingreso_biometrico.Obtener(SelectedImputado.Anio, SelectedImputado.Centro, SelectedImputado.IdImputado, (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO).FirstOrDefault(); var foto_seguimiento = ingreso_biometrico.Obtener(SelectedImputado.Anio, SelectedImputado.Centro, SelectedImputado.IdImputado, (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO).FirstOrDefault(); SelectedImputadoFotoIngreso = foto_ingreso != null ? foto_ingreso.BIOMETRICO : placeholder; SelectedImputadoFotoSeguimiento = foto_seguimiento != null ? foto_seguimiento.BIOMETRICO : placeholder; } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al obtener fotos del imputado seleccionado.", ex); } } } break; case "0": if (NIPBuscar.Length < 10) { NIPBuscar += "0"; } break; case "1": if (NIPBuscar.Length < 10) { NIPBuscar += "1"; } break; case "2": if (NIPBuscar.Length < 10) { NIPBuscar += "2"; } break; case "3": if (NIPBuscar.Length < 10) { NIPBuscar += "3"; } break; case "4": if (NIPBuscar.Length < 10) { NIPBuscar += "4"; } break; case "5": if (NIPBuscar.Length < 10) { NIPBuscar += "5"; } break; case "6": if (NIPBuscar.Length < 10) { NIPBuscar += "6"; } break; case "7": if (NIPBuscar.Length < 10) { NIPBuscar += "7"; } break; case "8": if (NIPBuscar.Length < 10) { NIPBuscar += "8"; } break; case "9": if (NIPBuscar.Length < 10) { NIPBuscar += "9"; } break; case "backspace": if (NIPBuscar.Length > 0) { NIPBuscar = NIPBuscar.Substring(0, NIPBuscar.Length - 1); } break; case "limpiarNIP": NIPBuscar = ""; break; case "onBuscarPorNIP": var NIP = 0; try { if (Int32.TryParse(NIPBuscar, out NIP)) { SelectedCustodio = new cEmpleado().Obtener(NIP); if (SelectedCustodio != null) { NombreCustodio = SelectedCustodio.PERSONA.NOMBRE.TrimEnd(); PaternoCustodio = SelectedCustodio.PERSONA.PATERNO.TrimEnd(); MaternoCustodio = SelectedCustodio.PERSONA.MATERNO.TrimEnd(); AnioCustodio = SelectedCustodio.REGISTRO_FEC.Value.Year.ToString(); IDCustodio = SelectedCustodio.ID_EMPLEADO.ToString(); var consulta_foto_custodio = SelectedCustodio.PERSONA.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO).FirstOrDefault(); FotoCustodio = consulta_foto_custodio != null ? consulta_foto_custodio.BIOMETRICO : new Imagenes().getImagenPerson(); CambiarMensajeNIP(enumMensajeNIP.ENCONTRADO); } else { CambiarMensajeNIP(enumMensajeNIP.NO_ENCONTRADO); } } } catch (Exception ex) { VentanaBusqueda.Hide(); StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al obtener informacion de un custodio (Error al buscar por ID).", ex); } break; case "Autorizar": try { var ingreso_ubicacion = new cIngresoUbicacion(); using (TransactionScope transaccion = new TransactionScope(TransactionScopeOption.RequiresNew, new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted })) { foreach (var imputado in ListExpediente) { } transaccion.Complete(); } } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al asignar el custodio seleccionado.", ex); } break; case "SeleccionarInternos": if (ListExpediente.Count > 0) { var seleccionados = ListExpediente.Where(w => w.Seleccionar).ToList(); var lista_seleccionados = seleccionados != null ? seleccionados : new List <InternosActividad>(); if (lista_seleccionados.Count > 0) { EmptySeleccionadosVisible = false; ListaSeleccionados.AddRange(lista_seleccionados); RaisePropertyChanged("ListaSeleccionados"); } else { EmptySeleccionadosVisible = true; await VentanaBusqueda.ShowMessageAsync("Validación", "Debe seleccionar al menos un interno."); } } else { await VentanaBusqueda.ShowMessageAsync("Validación", "No hay internos resultantes de la búsqueda. Por favor, intente más tarde ó ejecute una nueva búsqueda."); } break; case "RemoverInternos": if (ListaSeleccionados.Count > 0) { var seleccionados = ListaSeleccionados.Where(w => w.Seleccionar).ToList(); var lista_seleccionados = seleccionados != null ? seleccionados : new List <InternosActividad>(); if (lista_seleccionados.Count > 0) { } else { await VentanaBusqueda.ShowMessageAsync("Validación", "Debe seleccionar al menos un interno."); } } else { await VentanaBusqueda.ShowMessageAsync("Validación", "No hay internos seleccionados."); } break; case "Limpiar": SelectedJustificacion = enumTipoSalida.TRASLADO; NombreCustodio = ""; PaternoCustodio = ""; MaternoCustodio = ""; AnioCustodio = ""; IDCustodio = ""; FotoCustodio = new Imagenes().getImagenPerson(); break; case "LimpiarClick": var placeholder_limpiar = new Imagenes().getImagenPerson(); SelectedImputadoFotoIngreso = placeholder_limpiar; SelectedImputadoFotoSeguimiento = placeholder_limpiar; NombreBuscar = ""; ApellidoPaternoBuscar = ""; ApellidoMaternoBuscar = ""; AnioBuscar = ""; FolioBuscar = ""; ListExpediente = new List <InternosActividad>(); EmptyBusquedaVisible = true; break; } }
//CLICK ENTER public async void EnterKeyPressed(object obj) { VentanaBusqueda.Hide(); await StaticSourcesViewModel.CargarDatosMetodoAsync(() => { var AnioBusqueda = 0; var FolioBusqueda = 0; Int32.TryParse(AnioBuscar, out AnioBusqueda); Int32.TryParse(FolioBuscar, out FolioBusqueda); if (!string.IsNullOrEmpty(NombreBuscar) || !string.IsNullOrEmpty(ApellidoPaternoBuscar) || !string.IsNullOrEmpty(ApellidoMaternoBuscar) || AnioBusqueda != 0 || FolioBusqueda != 0) { try { //SE LIMPIA BÚSQUEDA ANTERIOR ListExpediente.Clear(); //SE INICIA NUEVA BÚSQUEDA var imputados_busqueda = new List <InternosActividad>(); List <GRUPO_ASISTENCIA> imputados = new InternosActividad().ObtenerInternos(Areas, NombreBuscar, ApellidoPaternoBuscar, ApellidoMaternoBuscar, (short)AnioBusqueda, FolioBusqueda).Where(w => //FILTRA CON LA FECHA DEL SERVER w.GRUPO_HORARIO.HORA_INICIO.Value.Day == Fechas.GetFechaDateServer.Day && w.GRUPO_HORARIO.HORA_INICIO.Value.Month == Fechas.GetFechaDateServer.Month && w.GRUPO_HORARIO.HORA_INICIO.Value.Year == Fechas.GetFechaDateServer.Year && w.GRUPO_HORARIO.HORA_INICIO.Value.Hour == Fechas.GetFechaDateServer.Hour && //FILTRA A LOS INTERNOS CON TRASLADOS EN PROCESO Ó ACTIVOS (w.GRUPO_PARTICIPANTE.INGRESO.TRASLADO_DETALLE.Where( wTD => wTD.TRASLADO.TRASLADO_FEC.Year == Fechas.GetFechaDateServer.Year && wTD.TRASLADO.TRASLADO_FEC.Month == Fechas.GetFechaDateServer.Month && wTD.TRASLADO.TRASLADO_FEC.Day == Fechas.GetFechaDateServer.Day && (wTD.TRASLADO.ID_ESTATUS == "EP" || wTD.TRASLADO.ID_ESTATUS == "AC")).Count() == 0) && //FILTRA A LOS INTERNOS CON EXCARCELACIONES EN PROCESO Ó ACTIVAS (w.GRUPO_PARTICIPANTE.INGRESO.EXCARCELACION.Where( wEXC => wEXC.PROGRAMADO_FEC.Value.Year == Fechas.GetFechaDateServer.Year && wEXC.PROGRAMADO_FEC.Value.Month == Fechas.GetFechaDateServer.Month && wEXC.PROGRAMADO_FEC.Value.Day == Fechas.GetFechaDateServer.Day && wEXC.ID_ESTATUS == "EP" || wEXC.ID_ESTATUS == "AC").Count() == 0) ).ToList(); foreach (var imputado in imputados) { if (!ListaSeleccionados.Where(w => w.Anio == imputado.GRUPO_PARTICIPANTE.ING_ID_ANIO && w.Centro == imputado.GRUPO_PARTICIPANTE.ING_ID_CENTRO && w.IdImputado == imputado.GRUPO_PARTICIPANTE.ING_ID_IMPUTADO).Any()) { imputados_busqueda.Add(new InternosActividad() { Actividad = imputado.GRUPO_PARTICIPANTE.ACTIVIDAD.DESCR, Anio = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_ANIO, Area = (short)imputado.GRUPO_HORARIO.ID_AREA, Asistencia = imputado.ASISTENCIA == 1 ? true : false, Centro = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_CENTRO, Expediente = string.Format("{0}/{1}", imputado.GRUPO_PARTICIPANTE.ING_ID_ANIO, imputado.GRUPO_PARTICIPANTE.ING_ID_IMPUTADO), IdIngreso = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_INGRESO, IdImputado = (short)imputado.GRUPO_PARTICIPANTE.ING_ID_IMPUTADO, Id_Grupo = (short)imputado.GRUPO_PARTICIPANTE.ID_GRUPO, IdConsec = (short)imputado.ID_CONSEC, Materno = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.MATERNO, Paterno = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.PATERNO, Nombre = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.NOMBRE, NIP = imputado.GRUPO_PARTICIPANTE.INGRESO.IMPUTADO.NIP, Ubicacion = imputado.GRUPO_HORARIO.AREA.DESCR, Seleccionar = false, Responsable = string.Format("{1} {2} {0}", imputado.GRUPO_PARTICIPANTE.GRUPO.PERSONA.NOMBRE.TrimEnd(), imputado.GRUPO_PARTICIPANTE.GRUPO.PERSONA.PATERNO.TrimEnd(), imputado.GRUPO_PARTICIPANTE.GRUPO.PERSONA.MATERNO.TrimEnd()) }); } } ListExpediente = imputados_busqueda; if (ListExpediente.Count > 0) { EmptyBusquedaVisible = false; } else { EmptyBusquedaVisible = true; } } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al realizar la busqueda de participantes.", ex); } } else { ListExpediente = new List <InternosActividad>(); } }); VentanaBusqueda.ShowDialog(); }
private async void clickSwitch(Object obj) { try { if (!PConsultar) { new Dialogos().ConfirmacionDialogo("Validación", "Su usuario no tiene privilegios para realizar esta acción"); return; } switch (obj.ToString()) { #region Buscar case "nueva_busqueda": if (ListExpediente != null) { ListExpediente.Clear(); } SelectExpediente = null; ApellidoPaternoBuscar = ApellidoMaternoBuscar = NombreBuscar = string.Empty; FolioBuscar = AnioBuscar = null; ImagenIngreso = ImagenImputado = new Imagenes().getImagenPerson(); break; case "buscar_menu": if (!PConsultar) { new Dialogos().ConfirmacionDialogo("Validación", "Su usuario no tiene privilegios para realizar esta acción"); break; } AuxIngreso = SelectIngreso; SelectExpediente = null; SelectIngreso = null; ListExpediente = null; ApellidoPaternoBuscar = ApellidoMaternoBuscar = NombreBuscar = string.Empty; FolioBuscar = AnioBuscar = null; ImagenIngreso = ImagenImputado = new Imagenes().getImagenPerson(); PopUpsViewModels.ShowPopUp(this, PopUpsViewModels.TipoPopUp.BUSQUEDA); break; case "buscar_salir": SelectExpediente = null; SelectIngreso = null; if (AuxIngreso != null) { SelectIngreso = AuxIngreso; AuxIngreso = null; } PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA); break; case "buscar_seleccionar": if (SelectIngreso == null) { new Dialogos().ConfirmacionDialogo("Validación", "Favor de seleccionar ingreso"); break; } else { if (SelectIngreso.ID_UB_CENTRO != GlobalVar.gCentro) { SelectIngreso = null; new Dialogos().ConfirmacionDialogo("Validación", "El ingreso no pertenece a su centro"); break; } if (EstatusInactivos.Contains(SelectIngreso.ID_ESTATUS_ADMINISTRATIVO)) { SelectIngreso = null; new Dialogos().ConfirmacionDialogo("Validación", "El estatus delingreso no esta activo en el centro"); break; } #region Datos Generales AnioD = SelectIngreso.ID_ANIO; FolioD = SelectIngreso.ID_IMPUTADO; PaternoD = SelectIngreso.IMPUTADO.PATERNO; MaternoD = SelectIngreso.IMPUTADO.MATERNO; NombreD = SelectIngreso.IMPUTADO.NOMBRE; NoControlD = string.Empty; var cama = SelectIngreso.CAMA; IngresosD = SelectIngreso.ID_INGRESO; UbicacionD = string.Format("{0}-{1}-{2}-{3}", cama.CELDA.SECTOR.EDIFICIO.DESCR.Trim(), cama.CELDA.SECTOR.DESCR.Trim(), cama.ID_CELDA.Trim(), cama.ID_CAMA); TipoSeguridadD = SelectIngreso.TIPO_SEGURIDAD.DESCR; FecIngresoD = SelectIngreso.FEC_INGRESO_CERESO.Value; ClasificacionJuridicaD = SelectIngreso.CLASIFICACION_JURIDICA.DESCR; EstatusD = SelectIngreso.ESTATUS_ADMINISTRATIVO.DESCR; if (SelectIngreso.INGRESO_BIOMETRICO != null) { var biometrico = SelectIngreso.INGRESO_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_SEGUIMIENTO).FirstOrDefault(); if (biometrico != null) { ImagenIngreso = biometrico.BIOMETRICO; } else { ImagenIngreso = new Imagenes().getImagenPerson(); } } else { ImagenIngreso = new Imagenes().getImagenPerson(); } #endregion PopUpsViewModels.ClosePopUp(PopUpsViewModels.TipoPopUp.BUSQUEDA); } break; #endregion case "ver_historico": VerHistorico(); break; case "guardar_menu": Guardar(); break; case "reporte_menu": if (!PImprimir) { new Dialogos().ConfirmacionDialogo("Validación", "Su usuario no tiene privilegios para realizar esta acción"); break; } ImprimirHistorico(); break; case "limpiar_menu": StaticSourcesViewModel.SourceChanged = false; ((System.Windows.Controls.ContentControl)PopUpsViewModels.MainWindow.FindName("contentControl")).Content = new NotaTecnicaView(); ((System.Windows.Controls.ContentControl)PopUpsViewModels.MainWindow.FindName("contentControl")).DataContext = new NotaTecnicaViewModel(); break; case "salir_menu": PrincipalViewModel.SalirMenu(); break; } } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al seleccionaropción", ex); } }