public List <Empleado> DevolverEmpleados()
        {
            conexion.Open();
            SqlCommand c = conexion.CreateCommand();

            c.CommandType = CommandType.StoredProcedure;
            c.CommandText = "Empleados_DevolverTodos";
            SqlDataReader dn = c.ExecuteReader();

            c.Prepare();
            while (dn.Read())
            {
                string    apellido        = dn.GetString(1);
                string    nombre          = dn.GetString(2);
                string    cuil            = dn.GetString(3);
                double    valorHora       = Convert.ToDouble(dn.GetDecimal(4));
                double    HoraMes         = Convert.ToDouble(dn.GetDecimal(5));
                string    nombreConsorcio = dn.GetString(7);
                string    cuit            = dn.GetString(8);
                Consorcio oConsorocio     = new Consorcio(nombre, cuit);
                oConsorocio.ConsorcioId = dn.GetInt32(6);
                Empleado oEmpleado = new Empleado(apellido, nombre, cuil, valorHora, HoraMes, oConsorocio);
                oEmpleado.EmpleadoId = dn.GetInt32(0);
                ListaEmpleados.Add(oEmpleado);
            }
            dn.Close();
            conexion.Close();
            return(ListaEmpleados);
        }
Beispiel #2
0
 public Empleado(string apellido, string nombre, string cuil, double valorHora, double horaPorMes, Consorcio consorcio)
 {
     this.Apellido   = apellido;
     this.Nombre     = nombre;
     this.Cuil       = cuil;
     this.ValorHora  = valorHora;
     this.HoraPorMes = horaPorMes;
     this.Consorcio  = consorcio;
 }
        //LISTAR CONSORCIO

        public List <Consorcio> DevolverConsorcio()
        {
            conexion.Open();
            SqlCommand c = conexion.CreateCommand();

            c.CommandType = CommandType.StoredProcedure;
            c.CommandText = "Consorcios_DevolverTodos";
            SqlDataReader dn = c.ExecuteReader();

            c.Prepare();
            while (dn.Read())
            {
                string    nombre     = dn.GetString(1);
                string    cuit       = dn.GetString(2);
                Consorcio oConsorcio = new Consorcio(nombre, cuit);
                oConsorcio.ConsorcioId = dn.GetInt32(0);
                ListaConsorcio.Add(oConsorcio);
            }
            dn.Close();
            conexion.Close();
            return(ListaConsorcio);
        }
        public Empleado Buscar(string cuil)
        {
            Empleado oEmpleado = null;

            conexion.Open();
            SqlCommand c = conexion.CreateCommand();

            c.CommandType = CommandType.StoredProcedure;
            c.CommandText = "Buscar_Cuil";

            SqlParameter CuilParameter = c.CreateParameter();

            CuilParameter.ParameterName = "@CUIL";
            CuilParameter.SqlDbType     = SqlDbType.VarChar;
            CuilParameter.Value         = cuil;
            c.Parameters.Add(CuilParameter);
            SqlDataReader dn = c.ExecuteReader();

            while (dn.Read())
            {
                string    apellido        = dn.GetString(1);
                string    nombre          = dn.GetString(2);
                string    CUIL            = dn.GetString(3);
                double    valorHora       = Convert.ToDouble(dn.GetDecimal(4));
                double    HoraMes         = Convert.ToDouble(dn.GetDecimal(5));
                string    nombreConsorcio = dn.GetString(7);
                string    cuit            = dn.GetString(8);
                Consorcio oConsorocio     = new Consorcio(nombre, cuit);
                oConsorocio.ConsorcioId = dn.GetInt32(6);
                oEmpleado            = new Empleado(apellido, nombre, cuil, valorHora, HoraMes, oConsorocio);
                oEmpleado.EmpleadoId = dn.GetInt32(0);
            }
            dn.Close();
            conexion.Close();
            return(oEmpleado);
        }