示例#1
0
 void completeReaction(Itens.Reacoes name)
 {
     switch (name)
     {
         case Itens.Reacoes.Apagar:
             Destroy(gameObject);
             break;
     }
 }
示例#2
0
 public void TouchCreditos()
 {
     itens = Itens.Creditos;
     tocou = true;
     mudou = true;
 }
示例#3
0
 internal void CalcularValorCarrinho()
 {
     ValorTotal = Itens.Sum(p => p.CalcularValor());
 }
 internal CarrinhoItens ObterPorProdutoId(Guid produtoId)
 {
     return(Itens.FirstOrDefault(p => p.ProdutoId == produtoId));
 }
 private void SetValorTotal()
 {
     ValorTotal = Itens?.Where(p => !p.Cancelado).Sum(p => p.ValorTotalLiquido) ?? 0;
 }
示例#6
0
 System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
 {
     return(Itens.GetEnumerator());
 }
示例#7
0
 public bool Remove(T item)
 {
     return(Itens.Remove(item));
 }
示例#8
0
        private void Eventos()
        {
            KeyDown   += KeyDowns;
            KeyPreview = true;
            Masks.SetToUpper(this);

            Shown += (s, e) =>
            {
                txtQtdItens.Text = @"0";
                txtValor.Text    = @"R$ 00,00";

                SetHeadersTableItens(GridLista);
                SetHeadersTableSelecionados(GridListaSelecionados);
                LoadItens();
            };

            txtDinheiro.KeyPress += (s, e) => Masks.MaskDouble(s, e);

            txtDinheiro.TextChanged += (s, e) =>
            {
                var txt = (TextBox)s;
                Masks.MaskPrice(ref txt);

                var troco = Validation.ConvertToDouble(txtDinheiro.Text) -
                            Validation.ConvertToDouble(txtValor.Text.Replace("R$ ", ""));
                label6.Text = Validation.FormatPrice(troco, true);
            };

            btnContinuar.Click += (s, e) =>
            {
                Itens.Clear();

                if (GridLista.Rows.Count > 0)
                {
                    foreach (DataGridViewRow row in GridLista.Rows)
                    {
                        Itens.Add(new
                        {
                            Id         = row.Cells[0].Value,
                            CProd      = row.Cells[1].Value,
                            xProd      = row.Cells[2].Value,
                            Quantidade = row.Cells[3].Value,
                            Total      = Validation.ConvertToDouble(row.Cells[4].Value.ToString().Replace("R$ ", ""))
                        });
                    }
                }

                DialogResult = DialogResult.OK;
                Close();
            };

            #region Table Itens

            GridLista.CellClick += (s, e) =>
            {
                if (GridLista.Columns[e.ColumnIndex].Name == "Dividir")
                {
                    ModalDividirValor.Valor = Validation.ConvertToDouble(GridLista.SelectedRows[0].Cells["Valor"].Value
                                                                         .ToString().Replace("R$ ", ""));
                    var form = new ModalDividirValor {
                        TopMost = true
                    };
                    if (form.ShowDialog() == DialogResult.OK)
                    {
                        GridListaSelecionados.Rows.Add(
                            GridLista.SelectedRows[0].Cells["ID"].Value,
                            GridLista.SelectedRows[0].Cells["Referência"].Value,
                            GridLista.SelectedRows[0].Cells["Item"].Value,
                            GridLista.SelectedRows[0].Cells["Qtd."].Value,
                            Validation.FormatPrice(ModalDividirValor.ValorDivido, true),
                            Resources.error20x
                            );

                        RefreshTotal();

                        if (ModalDividirValor.ValorRestante <= 0)
                        {
                            GridLista.Rows.RemoveAt(e.RowIndex);
                        }
                        else
                        {
                            GridLista.Rows[e.RowIndex].Cells[4].Value =
                                Validation.FormatPrice(ModalDividirValor.ValorRestante, true);
                        }

                        Alert.Message("Pronto", "Item adicionado.", Alert.AlertType.success);
                    }
                }

                if (GridLista.Columns[e.ColumnIndex].Name == "Adicionar")
                {
                    GridListaSelecionados.Rows.Add(
                        GridLista.SelectedRows[0].Cells["ID"].Value,
                        GridLista.SelectedRows[0].Cells["Referência"].Value,
                        GridLista.SelectedRows[0].Cells["Item"].Value,
                        GridLista.SelectedRows[0].Cells["Qtd."].Value,
                        GridLista.SelectedRows[0].Cells["Valor"].Value,
                        Resources.error20x
                        );

                    RefreshTotal();

                    GridLista.Rows.RemoveAt(e.RowIndex);

                    Alert.Message("Pronto", "Item adicionado.", Alert.AlertType.success);
                }
            };

            GridLista.CellMouseEnter += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridLista.Columns[e.ColumnIndex].Name == "Adicionar" ||
                    GridLista.Columns[e.ColumnIndex].Name == "Dividir")
                {
                    dataGridView.Cursor = Cursors.Hand;
                }
            };

            GridLista.CellMouseLeave += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridLista.Columns[e.ColumnIndex].Name == "Adicionar" ||
                    GridLista.Columns[e.ColumnIndex].Name == "Dividir")
                {
                    dataGridView.Cursor = Cursors.Default;
                }
            };

            #endregion

            #region Itens Selecionados

            GridListaSelecionados.CellClick += (s, e) =>
            {
                if (GridListaSelecionados.Columns[e.ColumnIndex].Name == "Remover")
                {
                    var notFound = true;
                    foreach (DataGridViewRow row in GridLista.Rows)
                    {
                        if (row.Cells[0].Value.ToString() ==
                            GridListaSelecionados.Rows[e.RowIndex].Cells[0].Value.ToString())
                        {
                            var valor    = Validation.ConvertToDouble(row.Cells[4].Value.ToString().Replace("R$ ", ""));
                            var addValor = Validation.ConvertToDouble(GridListaSelecionados.Rows[e.RowIndex].Cells[4]
                                                                      .Value.ToString().Replace("R$ ", ""));
                            row.Cells[4].Value = Validation.FormatPrice(valor + addValor, true);
                            notFound           = false;
                            break;
                        }
                    }

                    if (notFound)
                    {
                        GridLista.Rows.Add(
                            GridListaSelecionados.SelectedRows[0].Cells["ID"].Value,
                            GridListaSelecionados.SelectedRows[0].Cells["Referência"].Value,
                            GridListaSelecionados.SelectedRows[0].Cells["Item"].Value,
                            GridListaSelecionados.SelectedRows[0].Cells["Qtd."].Value,
                            GridListaSelecionados.SelectedRows[0].Cells["Valor"].Value,
                            Resources.divide20x,
                            Resources.plus20x
                            );
                    }

                    GridListaSelecionados.Rows.RemoveAt(e.RowIndex);

                    RefreshTotal();
                }
            };

            GridListaSelecionados.CellMouseEnter += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridListaSelecionados.Columns[e.ColumnIndex].Name == "Remover")
                {
                    dataGridView.Cursor = Cursors.Hand;
                }
            };

            GridListaSelecionados.CellMouseLeave += (s, e) =>
            {
                if (e.ColumnIndex < 0 || e.RowIndex < 0)
                {
                    return;
                }

                var dataGridView = s as DataGridView;
                if (GridListaSelecionados.Columns[e.ColumnIndex].Name == "Remover")
                {
                    dataGridView.Cursor = Cursors.Default;
                }
            };

            #endregion
        }
示例#9
0
        public void RemoverItem(Guid id)
        {
            var item = this.Itens.Where(x => x.Id == id).FirstOrDefault();

            Itens.Remove(item);
        }
示例#10
0
 public void InserirItem(ItemDoPedido item)
 {
     Itens.Add(item);
 }
示例#11
0
    public static List <Arma> Ferramenta(TextAsset xml)
    {
        XmlReader   reader = XmlReader.Create(new StringReader(xml.text));
        List <Arma> arma   = new List <Arma> ();

        while (reader.Read())
        {
            bool adicionar = false;
            if (reader.IsStartElement("Ferramenta"))
            {
                nomeX        = reader.GetAttribute("nome");
                durabilidade = int.Parse(reader.GetAttribute("durabilidade"));
                dano         = int.Parse(reader.GetAttribute("dano"));
                receita      = reader.GetAttribute("receita");
                tipo         = reader.GetAttribute("type");



                adicionar = true;
            }
            if (reader.IsStartElement("Espada"))
            {
                nomeX        = reader.GetAttribute("nome");
                durabilidade = int.Parse(reader.GetAttribute("durabilidade"));
                dano         = int.Parse(reader.GetAttribute("dano"));
                receita      = reader.GetAttribute("receita");
                tipo         = reader.GetAttribute("type");



                adicionar = true;
            }


            foreach (Arma armas in arma)
            {
                Itens item = armas;
                if (tipo == "ESPADA")
                {
                    _type = Type.ESPADA;
                }
                if (tipo == "CONSTRUCOES")
                {
                    _type = Type.CONSTRUCOES;
                }
                if (tipo == "PA")
                {
                    _type = Type.PA;
                }
                if (tipo == "PICARETA")
                {
                    _type = Type.PICARETA;
                }
                if (tipo == "MACHADO")
                {
                    _type = Type.MACHADO;
                }
                if (nomeX == item.nomes)
                {
                    adicionar = false;
                    break;
                }
            }
            if (adicionar)
            {
                arma.Add(new Arma(nomeX, durabilidade, receita, dano, 1, _type));
            }
        }
        reader.Close();
        return(arma);
    }
        public virtual void AtualizarItem(Produto produto, decimal quantidadeMaterial, UnidadeDeMedida unidadeDeMedida)
        {
            var item = (ProcessoDeCotacaoDeFreteItem)Itens.First();

            item.Atualizar(produto, quantidadeMaterial, unidadeDeMedida);
        }
示例#13
0
 public Blockchain(byte[] difficulty, IBlock genesis)
 {
     Difficulty   = difficulty;
     genesis.Hash = genesis.MineHash(difficulty);
     Itens.Add(genesis);
 }
示例#14
0
 public bool Remover(Itens i)
 {
     return(itens.Remover(i));
 }
示例#15
0
 public Itens Inserir(Itens i, int produto_id, Venda v)
 {
     return(itens.Inserir(i, produto_id, v));
 }
示例#16
0
 public void TouchSair()
 {
     itens = Itens.Sair;
     tocou = true;
     mudou = true;
 }
示例#17
0
 public double Calcular()
 {
     return(Itens.Sum(x => x.Produto.Preco * x.Quantidade));
 }
示例#18
0
 public List <ItemDaNota> RetornaItens()
 {
     return(Itens.ToList());
 }
示例#19
0
 public void AdicionarItens(ItemOrdemDeCompra item)
 {
     Itens.Add(item);
 }
 internal void CalcularValorTotalCarrinho()
 {
     ValorTotal = Itens.Sum(p => p.CalcularValor());
     CalcularValorTotalDesconto();
 }
示例#21
0
 public IEnumerator <T> GetEnumerator()
 {
     return(Itens.GetEnumerator());
 }
 internal bool CarrinhoItemExistente(CarrinhoItem item) => Itens.Any(p => p.ProdutoId == item.ProdutoId);
示例#23
0
        public Itens ConsultaItensPedido(string ItemCode, string ItemName)
        {
            Itens _Retorno = new Itens();

            try
            {
                using (HanaConnection conn = new HanaConnection(ConfigurationManager.ConnectionStrings["Hana"].ConnectionString))
                {
                    conn.Open();

                    var Schema = ConfigurationManager.AppSettings["CompanyDB"];

                    string Sql = string.Format(Properties.Resources.ConsultaItensPedido, Schema, ItemCode, ItemName);

                    using (HanaCommand cmd3 = new HanaCommand(Sql, conn))
                    {
                        using (HanaDataReader productInfoReader3 = cmd3.ExecuteReader())
                        {
                            HanaCommand    cmd = new HanaCommand(Sql, conn);
                            HanaDataReader productInfoReader = cmd.ExecuteReader();

                            if (productInfoReader.HasRows)
                            {
                                productInfoReader.Read();

                                string Code  = productInfoReader.GetString(0);
                                string Name  = productInfoReader.GetString(1);
                                string Count = productInfoReader.GetString(2);

                                _Retorno.value         = new Iten[int.Parse(Count)];
                                _Retorno.value[0]      = new Iten();
                                _Retorno.value[0].Code = Code;
                                _Retorno.value[0].Name = Name;

                                int i = 1;
                                while (productInfoReader.Read())
                                {
                                    Code = productInfoReader.GetString(0);
                                    Name = productInfoReader.GetString(1);

                                    _Retorno.value[i]      = new Iten();
                                    _Retorno.value[i].Code = Code;
                                    _Retorno.value[i].Name = Name;

                                    i++;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
            }
            finally
            {
            }

            return(_Retorno);
        }
 internal CarrinhoItem ObterPorProdutoId(Guid produtoId) => Itens.FirstOrDefault(p => p.ProdutoId == produtoId);
 internal void RemoverItem(CarrinhoItens item)
 {
     Itens.Remove(ObterPorProdutoId(item.ProdutoId));
     CalcularValorCarrinho();
 }
示例#26
0
 public void AddItens(ItemPedido item)
 {
     Itens.Add(item);
 }
示例#27
0
 public void AdicionaItem(Item item)
 {
     Itens.Add(item);
 }
示例#28
0
 public void RemoveItens(ItemPedido item)
 {
     Itens.Remove(item);
 }
示例#29
0
 internal bool CarrinhoItemExistente(CarrinhoItem item)
 {
     return(Itens.Any(p => p.ProdutoId == item.ProdutoId));
 }
示例#30
0
 public void Remover(int Id)
 {
     Itens.RemoveAll(i => i.Produto.Id == Id);
 }
示例#31
0
 public void TouchNovoJogo()
 {
     itens = Itens.NovoJogo;
     tocou = true;
     mudou = true;
 }
示例#32
0
        public void AddItemPedido(int idProduto, int qtd)
        {
            var item = new ItemPedido(idProduto, qtd);

            Itens.Add(item);
        }
示例#33
0
    void Update()
    {
        if(ativado)
        {
            if(Input.GetKeyDown(KeyCode.UpArrow))
            {
                itens--;
                mudou = true;
            }
            if(Input.GetKeyDown(KeyCode.DownArrow))
            {
                itens++;
                mudou = true;
            }
            if(mudou){
                if((int)itens<0)
                    itens = Itens.Sair;
                if((int)itens>2)
                    itens= Itens.NovoJogo;
                switch(itens)
                {
                    case Itens.NovoJogo:
                        novoJogo.mainTexture = selecionados[0];
                        creditos.mainTexture = padrao[2];
                        sair.mainTexture = padrao[3];
                        break;

                    case Itens.Creditos:
                        novoJogo.mainTexture = padrao[0];
                        creditos.mainTexture = selecionados[2];
                        sair.mainTexture = padrao[3];
                        break;
                    case Itens.Sair:
                        novoJogo.mainTexture = padrao[0];
                        creditos.mainTexture = padrao[2];
                        sair.mainTexture = selecionados[3];
                        break;
                }
                mudou = false;
            }

            if(Input.GetKeyDown(KeyCode.Return) || tocou)
            {
                if(tocou)
                    tocou = false;
                switch(itens)
                {
                    case Itens.NovoJogo:
                        Debug.Log ("camera");
                        GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MenuCamera>().toNovoJogo();
                        GameObject.FindGameObjectWithTag("MenuTelas").GetComponent<TecladoTelas>().ativar();
                        this.ativado = false;
                        break;
                    case Itens.Creditos:
                        GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MenuCamera>().toCreditos();
                        this.ativado = false;
                        ativaCredito();
                        break;
                    case Itens.Sair:
                        Application.Quit();
                        break;
                }
            }
        }
        if(credito)
        {
            if(Input.GetKeyDown(KeyCode.Escape) || (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began))
            {
                ativa();
                GameObject.FindGameObjectWithTag("MainCamera").GetComponent<MenuCamera>().toMenu();
                credito = false;
            }
        }
        if(ativando)
        {
            if(delay > 0)
            {
                delay -= Time.deltaTime;
            }
            else
            {
                ativado = true;
                ativando = false;
                delay = 1;
            }
        }
        if(ativandoCreditos)
        {
            if(delay > 0)
            {
                delay -= Time.deltaTime;
            }
            else
            {
                credito = true;
                ativandoCreditos = false;
                delay = 1;
            }
        }
    }
示例#34
0
 public decimal Total()
 {
     return(Itens.Sum(p => p.Subtotal));
 }
示例#35
0
 //recebe o GameObject que foi dropado do mob
 public void pegarGameObject(Itens item)
 {
     GameObject itemObject = (GameObject)Resources.Load("Prefabs/" + item.getTipo() + "/" + item.getNome());//carrega o item da ser dropado
     this.itensDropados.Add(itemObject);//adiciona item a lista de itens para serem exibidos na GUI.
 }
示例#36
0
 public void RemoverItensPedido(ItensPedido itens)
 {
     Itens.Remove(itens);
 }