public int ModificarIngrediente(Ingredientes entity)
 {
     int r = 0;
     try
     {
         r = objDatos.ModificarIngrediente(entity);
     }
     catch (Exception)
     {
         throw;
     }
     return r;
 }
Пример #2
0
        public int EliminarIngrediente(Ingredientes entity)
        {
            using (SqlConnection cnn = new SqlConnection(conexion))
            {

                using (SqlCommand cmd = new SqlCommand("eliminarIngrediente", cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@id_salida", entity.id_salida);
                    cnn.Open();
                    cmd.ExecuteNonQuery();
                    return 1;

                }

            }
        }
        //
        public int RegistrarIngrediente(Ingredientes entity)
        {
            int r = 0;
            try
            {
                r = objDatos.RegistrarIngredientes(entity);

            }
            catch (Exception)
            {
                throw;

            }
            return 1;
        }
Пример #4
0
        public List<Ingredientes> ListarIngredientes()
        {
            using (SqlConnection cnn = new SqlConnection(conexion))
            {
                using (SqlCommand cmd = new SqlCommand("ListarIngredientes", cnn))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cnn.Open();
                    List<Ingredientes> entities = new List<Ingredientes>();
                    using (SqlDataReader dr = cmd.ExecuteReader())
                    {
                        while (dr.Read())
                        {
                            Ingredientes entity = new Ingredientes();
                            entity.id_salida = dr["id_salida"].ToString();
                            entity.id_producto = dr["id_producto"].ToString();
                            entity.id_mp = dr["id_mp"].ToString();
                            entity.cantidad = dr["cantidad"].ToString();
                            entity.unidad = dr["precio"].ToString();

                            entities.Add(entity);
                        }
                    }
                    return entities;
                }

            }
        }
Пример #5
0
        // fin metodo
        //metodo registrar
        public int RegistrarIngredientes(Ingredientes entity)
        {
            using (SqlConnection cnn = new SqlConnection(conexion))
            {
                using (SqlCommand cmd = new SqlCommand("registrarIngrediente", cnn))
                {

                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@id_salida", entity.id_salida);
                    cmd.Parameters.AddWithValue("@id_producto", entity.id_producto);
                    cmd.Parameters.AddWithValue("@id_mp", entity.id_mp);
                    cmd.Parameters.AddWithValue("@cantidad", entity.cantidad);

                    cmd.Parameters.AddWithValue("@unidad", entity.unidad);

                    cnn.Open();
                    cmd.ExecuteNonQuery();
                    return 1;
                }

            }
        }