Ejemplo n.º 1
0
        public void AddItem(Produto produto)
        {
            if (produto == null)
            {
                this.AddNotification("AddItem(Produto)", "Produto nulo");
                return;
            }


            if (Itens.Any(x => x.Produto.Equals(produto)))
            {
                foreach (var itemNaComanda in Itens)
                {
                    if (itemNaComanda.Produto.Equals(produto))
                    {
                        if (produto.CompraMaxima != 0 && itemNaComanda.Quantidade >= produto.CompraMaxima)
                        {
                            this.AddNotification("AddItem(Produto)", $"Quantidade maxima do produto \"{produto.Descricao}\" atingida.");
                            return;
                        }

                        itemNaComanda.Quantidade++;
                    }
                }
            }
            else
            {
                Itens.Add(new ComandaItem(produto));
            }
        }
Ejemplo n.º 2
0
        public bool EValidoParaCriar(out string mensagem)
        {
            if (Id == null || Id == Guid.Empty)
            {
                mensagem = "Identificador não informado.";
                return(false);
            }

            if (Estado != EstadoPedido.Ativo)
            {
                mensagem = "O Pedido deve ser criado ativo.";
                return(false);
            }

            if (Cliente == null)
            {
                mensagem = "Cliente não informado.";
                return(false);
            }

            if (Itens == null || !Itens.Any())
            {
                mensagem = "Nenhum item informado.";
                return(false);
            }

            mensagem = string.Empty;
            return(true);
        }
Ejemplo n.º 3
0
 public List <VendaItem> ListaItens()
 {
     if (!Itens.Any())
     {
         return(null);
     }
     else
     {
         return(Itens.ToList());
     }
 }
Ejemplo n.º 4
0
        public void Validar()
        {
            if (IdVendedor <= 0)
            {
                Notificacoes.Add("Vendedor inválido");
            }

            if (!Itens.Any())
            {
                Notificacoes.Add("A lista de itens deve estar preenchida");
            }
        }
Ejemplo n.º 5
0
        public void CalculateValue()
        {
            Value = 0;

            if (Itens != null && Itens.Any())
            {
                foreach (var item in Itens)
                {
                    Value += item.Value;
                }
            }
        }
Ejemplo n.º 6
0
        public void RegistrarCompra()
        {
            if (!Itens.Any())
            {
                throw new BusinessRuleException("A solicitação de compra deve possuir itens!");
            }

            TotalGeral = new Money(Itens.ToList().Sum(x => x.Subtotal.Value));

            if (TotalGeral.Value > 50000)
            {
                CondicaoPagamento = new CondicaoPagamento(30);
            }

            AddEvent(new CompraRegistradaEvent(Id, Itens, TotalGeral.Value));
        }
Ejemplo n.º 7
0
    public void proximoJogo()
    {
        panelContent.SetActive(true);

        grupoMostrarResultado.SetActive(false);

        if (Itens.Any())
        {
            IniciarJogadaGame();
        }
        else
        {
            CarregaMensagemMundacaJogo();

            StartCoroutine(novaFase());
        }
    }
Ejemplo n.º 8
0
        public void AddItem(Produto produto)
        {
            if (produto == null)
            {
                throw new NullReferenceException();
            }

            Itens = Itens ?? new List <Produto>();

            if (Itens.Any(i => i.Codigo == produto.Codigo))
            {
                var produtoDaLista = Itens.First(i => i.Codigo == produto.Codigo);
                produtoDaLista.SetQuantidade(produtoDaLista.Quantidade + produto.Quantidade);
                return;
            }

            Itens.Add(produto);
            SetValorTotal();
        }
Ejemplo n.º 9
0
 internal bool CarrinhoItemExistente(CarrinhoItem item)
 {
     return(Itens.Any(p => p.ProdutoId == item.ProdutoId));
 }
Ejemplo n.º 10
0
 internal bool ItemExists(ItemCart item)
 {
     return(Itens.Any(p => p.IdProduct == item.IdProduct));
 }
Ejemplo n.º 11
0
 internal bool TermoTransferenciaItemExistente(TermoTransferenciaItem item)
 {
     return(Itens.Any(p => p.PatrimonioId == item.PatrimonioId));
 }
 internal bool CarrinhoItemExistente(CarrinhoItem item) => Itens.Any(p => p.ProdutoId == item.ProdutoId);