public static DataTable ActualizarEmpleado(EntidadEmpleados Entidad)
        {
            Estado = Funciones.ObtenerEstadoToken(Entidad.txtToken);
            DT.Clear();

            // 0 expirado, 1 vigente
            if (Estado == 1)
            {
                SqlCommand Comando = Conexion.crearComandoProc("RRHH.SPActualizarEmpleado");
                Comando.Parameters.AddWithValue("@_IdRegistro", Entidad.IdEmpleado);
                Comando.Parameters.AddWithValue("@_TxtNit", Entidad.TxtNit);
                Comando.Parameters.AddWithValue("@_TxtDpi", Entidad.TxtDpi);
                Comando.Parameters.AddWithValue("@_TxtNombres", Entidad.TxtNombres);
                Comando.Parameters.AddWithValue("@_TxtApellidos", Entidad.TxtApellidos);
                Comando.Parameters.AddWithValue("@_IdPuesto", Entidad.IdPuesto);
                Comando.Parameters.AddWithValue("@_IdEspecialidad", Entidad.IdEspecialidad);
                Comando.Parameters.AddWithValue("@_IdServicio", Entidad.IdServicio);
                Comando.Parameters.AddWithValue("@_IdRenglon", Entidad.IdRenglon);
                Comando.Parameters.AddWithValue("@_IdInstitucion", Entidad.idInstitucion);

                DT = Conexion.ejecutarComandoSelect(Comando);
                DT = Funciones.AgregarEstadoToken(DT, Estado.ToString());
            }
            else
            {
                DT = Funciones.AgregarEstadoToken(DT, "0");
            }

            return(DT);
        }
        public static DataTable ObtenerEmpleados(EntidadEmpleados entidad)
        {
            Estado = Funciones.ObtenerEstadoToken(entidad.txtToken);
            DT.Clear();

            // 0 expirado, 1 vigente
            if (Estado == 1)
            {
                SqlCommand Comando = Conexion.crearComandoProc("RRHH.SPObtenerEmpleados");
                DT = Conexion.ejecutarComandoSelect(Comando);
                DT = Funciones.AgregarEstadoToken(DT, Estado.ToString());
            }
            else
            {
                DT = Funciones.AgregarEstadoToken(DT, "0");
            }

            return(DT);
        }
Exemple #3
0
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });

            using (EntidadEmpleados db = new EntidadEmpleados())
            {
                int empno    = int.Parse(context.Password);
                var empleado = db.EMP.FirstOrDefault(z => z.APELLIDO == context.UserName && z.EMP_NO == empno);

                if (empleado == null)
                {
                    context.SetError("Acceso denegado", "El usuario/password son incorrectos.");
                    return;
                }
                ClaimsIdentity identidad = new ClaimsIdentity(context.Options.AuthenticationType);
                identidad.AddClaim(new Claim(ClaimTypes.Name, context.Password));
                identidad.AddClaim(new Claim(ClaimTypes.Role, "EMPLEADO"));
                context.Validated(identidad);
            }
        }
        public static DataTable ObtenerDatosEmpleado(EntidadEmpleados entidad)
        {
            Estado = Funciones.ObtenerEstadoToken(entidad.txtToken);
            DT.Clear();

            // 0 expirado, 1 vigente
            if (Estado == 1)
            {
                SqlCommand Comando = Conexion.crearComandoProc("RRHH.SPObtenerDatosEmpleado");
                Comando.Parameters.AddWithValue("@_IdRegistro", entidad.IdEmpleado);

                DT = Conexion.ejecutarComandoSelect(Comando);
                DT = Funciones.AgregarEstadoToken(DT, Estado.ToString());
            }
            else
            {
                DT = Funciones.AgregarEstadoToken(DT, "0");
            }

            return(DT);
        }
 public DataTable EliminarEmpleado(EntidadEmpleados entidad)
 {
     return(DatosEmpleados.EliminarEmpleado(entidad));
 }
 public DataTable ObtenerDatosEmpleado(EntidadEmpleados entidad)
 {
     return(DatosEmpleados.ObtenerDatosEmpleado(entidad));
 }
 public DataTable ActualizarEmpleado(EntidadEmpleados entidad)
 {
     return(DatosEmpleados.ActualizarEmpleado(entidad));
 }
 public DataTable AgregarEmpleado(EntidadEmpleados entidad)
 {
     return(DatosEmpleados.AgregarEmpleado(entidad));
 }