public List <Productos_Ingredientes_E> obt_ingredientes() { List <Productos_Ingredientes_E> ingredientes = new List <Productos_Ingredientes_E>(); using (SqlConnection cn = new SqlConnection(cnSTR)) { cn.Open(); SqlCommand cmd = cn.CreateCommand(); cmd.CommandText = "consultar_almacen"; cmd.CommandType = System.Data.CommandType.StoredProcedure; SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Productos_Ingredientes_E obj = new Productos_Ingredientes_E(); obj.nombres_productos = reader["nombre_producto"].ToString(); obj.cantidad = Convert.ToInt32(reader["cantidad"].ToString()); obj.unidadMedidastr = reader["unidad_de_medida"].ToString(); obj.costo = Convert.ToDecimal(reader["costo"].ToString()); obj.descripcion = reader["descripcion"].ToString(); obj.estado = reader["estados"].ToString(); ingredientes.Add(obj); } return(ingredientes); } }
public object insertar(Productos_Ingredientes_E pe) { using (SqlConnection cn = new SqlConnection(cnSTR)) { cn.Open(); SqlCommand cmd = cn.CreateCommand(); cmd.CommandText = "insertar_Ingredientes"; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@nombre_producto", pe.nombres_productos); cmd.Parameters.AddWithValue("@cantidad", pe.cantidad); cmd.Parameters.AddWithValue("@unidad_de_medida", pe.unidad_de_medida); cmd.Parameters.AddWithValue("@descripcion", pe.descripcion); cmd.Parameters.AddWithValue("@costo", pe.costo); return(cmd.ExecuteScalar()); } }
public static object insertar(string nombreProducto, string cantidad, string unidadM, string descripcionP, string costo) { int cantida1 = Convert.ToInt32(cantidad); decimal unidadM1 = Convert.ToDecimal(unidadM); decimal costo1 = Convert.ToDecimal(costo); Producto_Ingrediente_BL bc = new Producto_Ingrediente_BL(); Productos_Ingredientes_E pe = new Productos_Ingredientes_E(); pe.nombres_productos = nombreProducto; pe.cantidad = cantida1; pe.unidad_de_medida = unidadM1; pe.descripcion = descripcionP; pe.costo = costo1; return(bc.Insertar(pe)); }
public object Insertar(Productos_Ingredientes_E pe) { return(db.insertar(pe)); }