public BindingList <LineaIngresoSalidaProducto> listarProductosSalida(int idSalidaProductos) { BindingList <LineaIngresoSalidaProducto> productos = new BindingList <LineaIngresoSalidaProducto>(); DatosAlmacenProductos dataAlmacenProd = new DatosAlmacenProductos(); try { MySqlConnection con = new MySqlConnection(this.cadenaConexion); con.Open(); MySqlCommand comando = new MySqlCommand(); comando.CommandText = "SELECT * FROM ALM_LINEA_SALIDA_PRODUCTO WHERE SalidaProducto_idSalidaProducto = " + idSalidaProductos.ToString(); comando.Connection = con; MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { int idLineaSalidaProducto = reader.GetInt32("idLineaSalidaProducto"); int cantidadIngreso = reader.GetInt32("cantidadSalida"); string observaciones = reader.GetString("observaciones"); int idProducto = reader.GetInt32("Producto_idProducto"); LineaIngresoSalidaProducto lineaSalidaProducto = new LineaIngresoSalidaProducto(); lineaSalidaProducto.IdLineaIngresoSalidaProducto = idLineaSalidaProducto; lineaSalidaProducto.Producto = dataAlmacenProd.obtenerProducto(idProducto); lineaSalidaProducto.CantidadIngresoSalida = cantidadIngreso; lineaSalidaProducto.Observaciones = observaciones; productos.Add(lineaSalidaProducto); } con.Close(); } catch (Exception e) { } if (productos.Count > 0) { return(productos); } else { return(null); } }
public BindingList <LineaIngresoSalidaProducto> reporteSalidasProducto(int idAlmacen, DateTime fechaIni, DateTime fechaFin) { BindingList <LineaIngresoSalidaProducto> result = null; try { MySqlConnection con = new MySqlConnection(this.cadenaConexion); con.Open(); MySqlCommand comando = new MySqlCommand(); comando.CommandText = "alm_reporte_salidas_producto"; comando.CommandType = System.Data.CommandType.StoredProcedure; comando.Connection = con; comando.Parameters.Add("_idAlmacen", MySqlDbType.Int32).Value = idAlmacen; comando.Parameters.Add("_fechaIni", MySqlDbType.Date).Value = fechaIni; comando.Parameters.Add("_fechaFin", MySqlDbType.Date).Value = fechaFin; MySqlDataReader reader = comando.ExecuteReader(); result = new BindingList <LineaIngresoSalidaProducto>(); while (reader.Read()) { int idProducto = reader.GetInt32("id_producto"); // string nombre = reader.GetString("nombre"); // string descripcion = reader.GetString("descripcion"); int cantidad = reader.GetInt32("sum(cantidad)"); Producto producto = new Producto(); producto.Id = idProducto; producto.Nombre = nombre; producto.Descripcion = descripcion; LineaIngresoSalidaProducto lineaNueva = new LineaIngresoSalidaProducto(); lineaNueva.Producto = producto; lineaNueva.CantidadIngresoSalida = cantidad; result.Add(lineaNueva); } con.Close(); } catch (Exception e) { Console.WriteLine(e.Message); } return(result); }
public BindingList <LineaIngresoSalidaProducto> listarProductosIngreso(int idIngresoProductos) { BindingList <LineaIngresoSalidaProducto> productos = new BindingList <LineaIngresoSalidaProducto>(); try { MySqlConnection con = new MySqlConnection(this.cadenaConexion); con.Open(); MySqlCommand comando = new MySqlCommand(); comando.CommandText = "SELECT * FROM ALM_LINEA_INGRESO_PRODUCTO WHERE IngresoProducto_idIngresoProducto = " + idIngresoProductos.ToString(); comando.Connection = con; MySqlDataReader reader = comando.ExecuteReader(); while (reader.Read()) { int idLineaIngresoProducto = reader.GetInt32("idLineaIngresoProducto"); int cantidadIngreso = reader.GetInt32("cantidadSalida"); string observaciones = reader.GetString("observaciones"); LineaIngresoSalidaProducto lineaSalidaProducto = new LineaIngresoSalidaProducto(); lineaSalidaProducto.IdLineaIngresoSalidaProducto = idLineaIngresoProducto; lineaSalidaProducto.Producto = null; lineaSalidaProducto.CantidadIngresoSalida = cantidadIngreso; lineaSalidaProducto.Observaciones = observaciones; productos.Add(lineaSalidaProducto); } con.Close(); } catch (Exception e) { } return(productos); }