public string CambiarCantidadIngrediente(int idIngrediente, decimal cantidad, int idmenu) { string mensaje = ""; Ingrediente i = CIngrediente.Instancia.BuscarIngrediente(idIngrediente); Menu m = CMenu.Instancia.BuscarMenu(idmenu); if (i != null && m != null) { IngredienteCantidad ing = m.BuscarIngredienteCantidad(i); if (ing != null) { ing.Cantidad = cantidad; mensaje = "Se modifico el la cantidad del ingrediente"; } else { mensaje = "El ingrediente no forma parte del menu"; } } else { mensaje = "El ingrediente o el menu no existen"; } return(mensaje); }
public string AltaIngrediente(int codigo, string descripcion, decimal precio) { string mensaje = ""; if (codigo >= 0 && descripcion != "" && precio > 0) { Ingrediente ing = BuscarIngrediente(codigo); if (ing == null) { ing = new Ingrediente(codigo, descripcion, precio); ingredientes.Add(ing); mensaje = "Se ingreso el ingrediente correctamente"; } else { mensaje = "El ingrediente ya existe"; } } else { mensaje = "Verifique que los datos ingresados sean correctos"; } return(mensaje); }
public List <Menu> MostrarMenusIngrediente(Ingrediente i) { List <Menu> menusIngrediente = new List <Menu>(); if (i != null) { foreach (Menu m in menus) { if (m.ObtenerIngrediente(i)) { menusIngrediente.Add(m); } } } return(menusIngrediente); }
public Ingrediente BuscarIngrediente(int codigo) { int i = 0; Ingrediente ing = null; while (i < ingredientes.Count && ing == null) { if (ingredientes[i].Codigo == codigo) { ing = ingredientes[i]; } i++; } return(ing); }
public override IngredienteCantidad BuscarIngredienteCantidad(Ingrediente i) { int x = 0; IngredienteCantidad ingC = null; while (x > ingredientesCantidad.Count && ingC == null) { if (ingredientesCantidad[x].Equals(i)) { ingC = ingredientesCantidad[x]; } x++; } return(ingC); }
public override bool ObtenerIngrediente(Ingrediente i) { bool tiene = false; int j = 0; while (j < ingredientesCantidad.Count && !tiene) { if (ingredientesCantidad[j].Ingrediente.Equals(i)) { tiene = true; } j++; } return(tiene); }
public string ModificarIngrediente(int codigo, string descripcion, decimal precio) { string mensaje = ""; if (codigo >= 0) { Ingrediente i = BuscarIngrediente(codigo); if (i != null) { if (descripcion != i.Descripcion) { i.Descripcion = descripcion; mensaje = "Se cambio la descripcion del ingrediente a: " + descripcion; } if (precio != i.Precio) { i.Precio = precio; mensaje = "Se cambio el precio del ingrediente a: " + precio; } } else { mensaje = "El ingrediente no existe"; } } else { mensaje = "El codigo tiene que ser un numero mayor a 0"; } return(mensaje); }
public string BajaIngrediente(int codigo) { string mensaje = ""; if (codigo >= 0) { Ingrediente i = BuscarIngrediente(codigo); if (i != null) { ingredientes.Remove(i); mensaje = "Se removio el ingrediente"; } else { mensaje = "El ingrediente no existe"; } } else { mensaje = "No se igreso el codigo del ingrediente"; } return(mensaje); }
public void AgregarIngrediente(Ingrediente i, int cantidad) { this.ingredientesCantidad.Add(new IngredienteCantidad(i, cantidad)); }
public override IngredienteCantidad BuscarIngredienteCantidad(Ingrediente i) { return(null); }
public override bool ObtenerIngrediente(Ingrediente i) { bool tiene = false; return(tiene); }
public IngredienteCantidad(Ingrediente ingrediente, decimal cantidad) { this.ingrediente = ingrediente; this.cantidad = cantidad; }
public abstract IngredienteCantidad BuscarIngredienteCantidad(Ingrediente i);
public abstract bool ObtenerIngrediente(Ingrediente i);