Example #1
0
        public PedidosVer Pedido(int id)
        {
            PedidosVer    p    = new PedidosVer();
            SqlConnection conn = new SqlConnection(cadena);

            conn.Open();

            SqlCommand    comm = new SqlCommand("exec PedidosDetallesPrecio " + id, conn);
            SqlDataReader dr   = comm.ExecuteReader();

            while (dr.Read())
            {
                int      nro_pedido = dr.GetInt32(0);
                DateTime fecha      = dr.GetDateTime(1);
                string   id_cliente = dr.GetString(2);
                string   vendedor   = dr.GetString(3);
                int      descuento  = dr.GetInt32(4);
                string   id_estado  = dr.GetString(5);
                float    precio     = (float)dr.GetDouble(6);

                p = new PedidosVer(nro_pedido, fecha, id_cliente, vendedor, precio, descuento, id_estado);
            }

            conn.Close();
            return(p);
        }
Example #2
0
        public List <PedidosVer> mostrarPedidos()
        {
            List <PedidosVer> salida = new List <PedidosVer>();
            SqlConnection     conn   = new SqlConnection(cadena);

            conn.Open();

            SqlCommand    comm = new SqlCommand("execute PedidosVer", conn);
            SqlDataReader dr   = comm.ExecuteReader();

            while (dr.Read())
            {
                int      nro_pedido = dr.GetInt32(0);
                DateTime fecha      = dr.GetDateTime(1);
                string   id_cliente = dr.GetString(2);
                string   vendedor   = dr.GetString(3);

                int    descuento = dr.GetInt32(4);
                string id_estado = dr.GetString(5);
                float  precio    = (float)dr.GetDouble(6);

                PedidosVer pv = new PedidosVer(nro_pedido, fecha, id_cliente, vendedor, precio, descuento, id_estado);
                salida.Add(pv);
            }

            conn.Close();
            return(salida);
        }