示例#1
0
        public IngredientesPorMenu ArmarObjetoIngrediente(Ingrediente i, int cantidad)
        {
            IngredientesPorMenu ret = new IngredientesPorMenu()
            {
                Ingrediente = i,
                Cantidad    = cantidad
            };

            return(ret);
        }
示例#2
0
        //pIngredientes y pCantidades deberían tener igual tamaño, y corresponderse en sus posiciones entre sí.
        public ExitCode AltaMenuPropio(string pChefDoc, string pChefTipoDoc, List <string> pIngredientes, List <int> pCantidades, decimal pGanancia, string pDesc)
        {
            ExitCode ret = ExitCode.PLACEHOLDER;

            if (pIngredientes.Count == pCantidades.Count)
            {
                Documento d = CDocumento.Get.ArmarDocumento(pChefDoc, pChefTipoDoc);
                Chef      c = CUsuario.Get.BuscarChef(d);

                if (c != null)
                {
                    List <IngredientesPorMenu> ingredientes = new List <IngredientesPorMenu>();
                    int  contador = 0;
                    bool hayError = false;

                    while (contador < pIngredientes.Count && !hayError)
                    {
                        Ingrediente i = CIngrediente.Get.BuscarActivo(pIngredientes[contador]);
                        if (i == null)
                        {
                            hayError = true;
                            ret      = ExitCode.NO_INGREDIENT_ERROR;
                        }
                        else
                        {
                            IngredientesPorMenu ipm = CIngrediente.Get.ArmarObjetoIngrediente(i, pCantidades[contador]);
                            ingredientes.Add(ipm);
                        }

                        contador++;
                    }

                    if (!hayError)
                    {
                        ret = CMenu.Get.AltaMenuPropio(c, ingredientes, pGanancia, pDesc);
                    }
                }
                else
                {
                    ret = ExitCode.NO_CHEF_ERROR;
                }
            }
            else
            {
                ret = ExitCode.INPUT_DATA_ERROR;
            }

            return(ret);
        }
示例#3
0
        public ExitCode ModificarIngredientesDeMenu(int pIdMenu, string pCodIngrediente, int pCantIngrediente)
        {
            var                 exit        = ExitCode.PLACEHOLDER;
            Ingrediente         ingrediente = CIngrediente.Get.BuscarActivo(pCodIngrediente);
            IngredientesPorMenu ipm         = null;

            if (ingrediente != null)
            {
                ipm = CIngrediente.Get.ArmarObjetoIngrediente(ingrediente, pCantIngrediente);
            }
            else
            {
                exit = ExitCode.NO_INGREDIENT_ERROR;
            }

            if (exit != ExitCode.NO_INGREDIENT_ERROR)
            {
                exit = CMenu.Get.ModificarIngredientesDeMenu(pIdMenu, ipm);
            }

            return(exit);
        }
示例#4
0
        public ExitCode ModificarIngredientesDeMenu(int pIdMenu, IngredientesPorMenu pIngrediente)
        {
            var  exit = ExitCode.NO_MENU_ERROR;
            Menu m    = BuscarActivo(pIdMenu);

            if (m != null && m is Propio)
            {
                if (((Propio)m).TieneIngrediente(pIngrediente.Ingrediente))
                {
                    ((Propio)m).ActualizarIngrediente(pIngrediente.Ingrediente, pIngrediente.Cantidad);
                }
                else
                {
                    ((Propio)m).Ingredientes.Add(pIngrediente);
                }

                m.PrecioVenta = m.CalcularPrecioVenta();
                exit          = ExitCode.OK;
            }

            return(exit);
        }