public ActionResult Create(FormCollection collection) { try { DateTime AgregarMinutos = DateTime.Now; AgregarMinutos = AgregarMinutos.AddHours(2); //Agrega 2Horas a la hora actual Random Ran = new Random(); //Se crea un objeto aleatorio int Visitas = Ran.Next(1, 5); //Crea numeros aleatorios entre 1 a 4 switch (Visitas) //Dependiendo del numero generado se agregan "x" cantidad de minutos { case 1: AgregarMinutos = AgregarMinutos.AddMinutes(90); //Agrega 90 minutos break; case 2: AgregarMinutos = AgregarMinutos.AddMinutes(180); //Agrega 180 minutos break; case 3: AgregarMinutos = AgregarMinutos.AddMinutes(270); //Agrega 270 minutos break; case 4: AgregarMinutos = AgregarMinutos.AddMinutes(360); //Agrega 360 minutos break; } var SueldoFinal = AgregarMinutos.Hour; if (AgregarMinutos.Minute != 00)//En caso que existan minutos { AgregarMinutos = AgregarMinutos.AddHours(1); SueldoFinal = AgregarMinutos.Hour;//Se redondean las horas a +1h } var EmpleadoActual = new cEmpleado { iCodigo = int.Parse(collection["iCodigo"]), sNombre = collection["sNombre"], sEnOficina = collection["sEnOficina"], VisitasEmpleado = Visitas, dHorasTrabajadas = AgregarMinutos.Hour, HoraLlegada = DateTime.Now, HoraVisita = AgregarMinutos, dSueldo = SueldoFinal * 38, }; Datos.Instance.ListaEmpleados.Agregar(EmpleadoActual); Datos.Instance.PilaEmpleados.Agregar(EmpleadoActual); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Simulacion(cEmpleado std) { try { var Empleado = new cEmpleado { }; } catch (Exception) { throw; } return(RedirectToAction("Index")); }
//NIP PARA DAR ENCONTRAR A LOS CUSTODIOS (AUSENTES) private async void CompararNIPAsistenciaCustodio(string nip) { try { ListResultadoCustodio = ListResultadoCustodio ?? new List <ResultadoBusquedaBiometricoCustodio>(); if (BuscarNIP != string.Empty) { long NIP = Convert.ToInt64(nip); //Se busca el custodio por medio del ID obtenido CustodioSelect = new cEmpleado().ObtenerEmpleadoPorDepartamento(NIP, (short)enumAreaTrabajo.COMANDANCIA); if (CustodioSelect != null) { ListResultadoCustodio.Add(new ResultadoBusquedaBiometricoCustodio() { //Se muestra la información del custodio encontrado Nombre = string.IsNullOrEmpty(CustodioSelect.PERSONA.NOMBRE) ? string.Empty : CustodioSelect.PERSONA.NOMBRE.TrimEnd(), CPaterno = string.IsNullOrEmpty(CustodioSelect.PERSONA.PATERNO) ? string.Empty : CustodioSelect.PERSONA.PATERNO.TrimEnd(), CMaterno = string.IsNullOrEmpty(CustodioSelect.PERSONA.MATERNO) ? string.Empty : CustodioSelect.PERSONA.MATERNO.TrimEnd(), IdPersona = CustodioSelect.ID_EMPLEADO, ENCONTRADO = true, Persona = CustodioSelect.PERSONA }); ImagenCustodio = new cPersonaBiometrico().ObtenerTodos(CustodioSelect.ID_EMPLEADO, (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO).Any() ? new cPersonaBiometrico().ObtenerTodos(CustodioSelect.ID_EMPLEADO, (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO).FirstOrDefault().BIOMETRICO : new Imagenes().getImagenPerson(); //SE ENCONTRO CUSTODIO CambiarMensajeNIP(enumMensajeNIP.ENCONTRADO); NIPCapturaVisible = false; } else { //NO SE ENCONTRO CUSTODIO CambiarMensajeNIP(enumMensajeNIP.NO_ENCONTRADO); } } else { //NIP VIENE VACIO CambiarMensajeNIP(enumMensajeNIP.NO_ENCONTRADO); } } catch (Exception ex) { StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al obtener información.", ex); } }
private void GenerarReporte() { var centro = new cCentro().Obtener(GlobalVar.gCentro).FirstOrDefault(); var datosReporte = new List <cReporteDatos>(); datosReporte.Add(new cReporteDatos() { Encabezado1 = Parametro.ENCABEZADO1.Trim(), Encabezado2 = Parametro.ENCABEZADO2.Trim(), Encabezado3 = centro != null ? centro.DESCR.Trim() : string.Empty, Logo1 = Parametro.REPORTE_LOGO1, Logo2 = Parametro.REPORTE_LOGO2, }); var datosReporteEmpleados = new List <PadronEmpleados>(); var predicate = PredicateBuilder.True <EMPLEADO>(); //var DatosEmpleados = SelectTipoEmpl == -1 ? new cEmpleado().ObtenerTodos() : new cEmpleado().ObtenerTodosReporte(GlobalVar.gCentro, SelectTipoEmpl != -1 ? SelectTipoEmpl : null).Where(w.ID_EMPLEADO == 2016150402); var DatosEmpleados = new cEmpleado().ObtenerTodosReporte(GlobalVar.gCentro, SelectTipoEmpl); if (SelectEstatus == 2) { DatosEmpleados = DatosEmpleados.Where(w => w.ESTATUS == "S"); } else if (SelectEstatus == 3) { DatosEmpleados = DatosEmpleados.Where(w => w.ESTATUS == "N"); } int Count = 0; foreach (var itemEmpl in DatosEmpleados) { var objEmpleado = new PadronEmpleados(); var ApellidoPat = !string.IsNullOrEmpty(itemEmpl.PERSONA.PATERNO) ? itemEmpl.PERSONA.PATERNO.Trim() : ""; var Apeliidomat = !string.IsNullOrEmpty(itemEmpl.PERSONA.MATERNO) ? itemEmpl.PERSONA.MATERNO.Trim() : ""; var Nombre = !string.IsNullOrEmpty(itemEmpl.PERSONA.NOMBRE) ? itemEmpl.PERSONA.NOMBRE.Trim() : ""; objEmpleado.nombre = ApellidoPat + " " + Apeliidomat + " " + Nombre; objEmpleado.domicilio = itemEmpl.PERSONA.DOMICILIO_CALLE + " " + itemEmpl.PERSONA.DOMICILIO_NUM_EXT + " " + itemEmpl.PERSONA.DOMICILIO_NUM_INT; objEmpleado.estado = itemEmpl.PERSONA.ENTIDAD.DESCR; objEmpleado.municipio = itemEmpl.PERSONA.MUNICIPIO.MUNICIPIO1; objEmpleado.tel = itemEmpl.PERSONA.TELEFONO == null ? "" : itemEmpl.PERSONA.TELEFONO; objEmpleado.sexo = itemEmpl.PERSONA.SEXO == null ? "" : itemEmpl.PERSONA.SEXO; objEmpleado.fechanac = itemEmpl.PERSONA.FEC_NACIMIENTO != null?itemEmpl.PERSONA.FEC_NACIMIENTO.Value.ToShortDateString() : ""; objEmpleado.rfc = itemEmpl.PERSONA.RFC == null ? "" : itemEmpl.PERSONA.RFC; objEmpleado.curp = itemEmpl.PERSONA.CURP == null ? "" : itemEmpl.PERSONA.CURP; objEmpleado.fecha_reg = itemEmpl.REGISTRO_FEC == null?"":itemEmpl.REGISTRO_FEC.Value.ToShortDateString(); objEmpleado.estatus_visita = itemEmpl.ESTATUS == "S" ? "PERMITIDO" : "NO PERMITIDO"; objEmpleado.num_visitante = itemEmpl.PERSONA.ID_PERSONA.ToString(); objEmpleado.observaciones = itemEmpl.OBSERV == null ? "" : itemEmpl.OBSERV; if (itemEmpl.PERSONA.PERSONA_BIOMETRICO != null) { if (itemEmpl.PERSONA.PERSONA_BIOMETRICO.Any(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO)) { var foto = itemEmpl.PERSONA.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == (short)enumTipoBiometrico.FOTO_FRENTE_REGISTRO).FirstOrDefault().BIOMETRICO; if (foto != null) { objEmpleado.imagen_frente = foto; } else { objEmpleado.imagen_frente = new Imagenes().getImagenPerson(); } } else { objEmpleado.imagen_frente = new Imagenes().getImagenPerson(); } } else { objEmpleado.imagen_frente = new Imagenes().getImagenPerson(); } //if (itemEmpl.PERSONA.PERSONA_BIOMETRICO.Any(w => w.ID_TIPO_BIOMETRICO == 102 || w.ID_TIPO_BIOMETRICO == 105)) //{ // objEmpleado.imagen_frente = itemEmpl.PERSONA.PERSONA_BIOMETRICO.Where(w => w.ID_TIPO_BIOMETRICO == 102 || w.ID_TIPO_BIOMETRICO == 105).FirstOrDefault().BIOMETRICO; //} //else //{ // objEmpleado.imagen_frente = new Imagenes().getImagenPerson(); //} datosReporteEmpleados.Add(objEmpleado); Count++; // else // objEmpleado.imagen_frente = new Imagenes().getImagenPerson(); // objEmpleado.imagen_frente = null; } if (Count == 0) { Application.Current.Dispatcher.Invoke((Action)(delegate { Reporte.Clear(); Reporte.LocalReport.DataSources.Clear(); })); // StaticSourcesViewModel.Mensaje("Aviso", "La Busqueda no contiene Información", StaticSourcesViewModel.enumTipoMensaje.MENSAJE_INFORMACION, 5); } else { #region Reporte Reporte.LocalReport.ReportPath = "Reportes/rPadronEmpleado.rdlc"; Reporte.LocalReport.DataSources.Clear(); Microsoft.Reporting.WinForms.ReportDataSource rds1 = new Microsoft.Reporting.WinForms.ReportDataSource(); rds1.Name = "DataSet1"; rds1.Value = datosReporteEmpleados; Reporte.LocalReport.DataSources.Add(rds1); Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource(); rds2.Name = "DataSet2"; rds2.Value = datosReporte; Reporte.LocalReport.DataSources.Add(rds2); //Microsoft.Reporting.WinForms.ReportDataSource rds2 = new Microsoft.Reporting.WinForms.ReportDataSource(); //rds2.Name = "DataSet2"; //rds2.Value = lstInternos; //Reporte.LocalReport.DataSources.Add(rds2); /* #region Parametros * Reporte.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("MostrarEdad", IncluirEdad ? "N" : "S")); * Reporte.LocalReport.SetParameters(new Microsoft.Reporting.WinForms.ReportParameter("MostrarFoto", IncluirFoto ? "N" : "S")); #endregion*/ Application.Current.Dispatcher.Invoke((Action)(delegate { Reporte.RefreshReport(); })); #endregion } }
private void ConsultarEmpleadoToolStripMenuItem_Click(object sender, EventArgs e) { cEmpleado empleado = new cEmpleado(); empleado.Show(); }
//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; } }