public Empleado BuscarEmpleadoPorDNI(string DNI)
        {
            Empleado empleado    = null;
            string   consultaSQL = "select * from Empleado where dni = '" + DNI + "'";

            try
            {
                SqlDataReader resultadoSQL = gestorSQL.EjecutarConsulta(consultaSQL);
                if (resultadoSQL.Read())
                {
                    empleado = ObtenerDatosEmpleaods(resultadoSQL);
                }
                else
                {
                    return(null);
                }
                resultadoSQL.Close();
            }
            catch (Exception e)
            {
                MessageBox.Show("Error al buscar el empleadon por DNI: " + e);
                throw;
            }
            return(empleado);
        }
Example #2
0
        public Periodo GetPeriodoActivo()
        {
            List <Periodo> periodos = new List <Periodo>();

            Periodo periodo;
            string  consultaSQL     = "select * from Periodo where estado = 1 ORDER BY fechaFin";
            bool    periodoObtenido = false;

            try
            {
                SqlDataReader resultadoSQL = gestorSQL.EjecutarConsulta(consultaSQL);
                while (resultadoSQL.Read())
                {
                    periodo = ObtenerDatosPeriodo(resultadoSQL);
                    periodos.Add(periodo);
                    periodoObtenido = true;
                }
                if (!resultadoSQL.Read() && !periodoObtenido)
                {
                    return(null);
                }
            }
            catch (Exception er)
            {
                MessageBox.Show("Error obtener periodo activo" + er);
                throw;
            }
            return(periodos[0]);
        }
Example #3
0
        public List <Afp> ListarAfps()
        {
            List <Afp> listaAfp = new List <Afp>();
            Afp        afp;
            string     consultaSQL = "select * from AFP";

            try
            {
                SqlDataReader resultadoSQL = gestorSQL.EjecutarConsulta(consultaSQL);
                while (resultadoSQL.Read())
                {
                    afp = ObtenerDatosAfp(resultadoSQL);
                    listaAfp.Add(afp);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error al listar AFP " + e);
                throw;
            }
            return(listaAfp);
        }
Example #4
0
        public Contrato MostrarDatosContrato(int CodigoEmpleado)
        {
            Contrato contrato;
            string   mostrarContrato = "select idContrato, asignacionFamiliar, cargo, fechaInicial, fechaFinal, horasContradasPorSemana, valorHora, estado, ID_AFP, ID_EMPLEADO from Contrato where ID_EMPLEADO = " + CodigoEmpleado + "and estado = 1 ORDER BY fechaFinal desc";

            try
            {
                SqlDataReader resultadoSQL = gestorSQL.EjecutarConsulta(mostrarContrato);
                if (resultadoSQL.Read())
                {
                    contrato = gestorSQL.ObtenerContrato(resultadoSQL);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show("No existe el Contrato." + err);
                return(null);
            }
            return(contrato);
        }
Example #5
0
        public List <Pago> GetPagosByPeriodo(Periodo periodo)
        {
            List <Pago> pagos = new List <Pago>();
            Pago        pago;
            string      consulta = "SELECT * from Pago where ID_PERIODO = " + periodo.Id_periodo;

            try
            {
                SqlDataReader resultadoSQL = gestorSQL.EjecutarConsulta(consulta);
                while (resultadoSQL.Read())
                {
                    pago = ObtenerPago(resultadoSQL);
                    pagos.Add(pago);
                }
            }
            catch (Exception err)
            {
                MessageBox.Show("No existen Pagos." + err);
                return(new List <Pago>());
            }
            return(pagos);
        }