示例#1
0
        public List<EntradaArticulo> readEntradaArticulo(int idfactura)
        {
            List<EntradaArticulo> entradaArticuloList = new List<EntradaArticulo>();

            using (SqlConnection con = new SqlConnection(Info.sqlSet()))
            {
                SqlCommand cmd = new SqlCommand("SP_EntradaArticulo_SelectCustom", con);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@IdFactura", idfactura);

                con.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    // Loop through each record.
                    while (reader.Read())
                    {
                        EntradaArticulo tmp = new EntradaArticulo();

                        tmp.IdEntrada = (reader.GetValue(0) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(0)) : tmp.IdEntrada;
                        tmp.IdFactura = (reader.GetValue(1) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(1)) : tmp.IdFactura;
                        tmp.IdArticulo = (reader.GetValue(2) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(2)) : tmp.IdArticulo;
                        tmp.Nombre = (reader.GetValue(3) != DBNull.Value) ? Convert.ToString(reader.GetValue(3)) : tmp.Nombre;
                        tmp.Descripcion = (reader.GetValue(4) != DBNull.Value) ? Convert.ToString(reader.GetValue(4)) : tmp.Descripcion;
                        tmp.Precio = (reader.GetValue(5) != DBNull.Value) ? Convert.ToSingle(reader.GetValue(5)) : tmp.Precio;
                        tmp.Cantidad = (reader.GetValue(6) != DBNull.Value) ? Convert.ToInt32(reader.GetValue(6)) : tmp.Cantidad;

                        entradaArticuloList.Add(tmp);
                    }
                }

                con.Close();
            }

            return entradaArticuloList;
        }
示例#2
0
 private EntradaArticulo EntradaToEntradaArticulo(Entrada nuevo)
 {
     EntradaArticulo entrada = new EntradaArticulo();
     nuevo.IdEntrada = entrada.IdEntrada;
     nuevo.IdArticulo = entrada.IdArticulo;
     nuevo.Cantidad = entrada.Cantidad;
     nuevo.IdFactura = entrada.IdFactura;
     return entrada;
 }