Example #1
0
        public SaidaMovimento(int id, Estabelecimentos est, ConfigMovimento config, Funcionarios fun, Form tela)
        {
            InitializeComponent();

            groupBox4.TabStop      = false;
            rbInteiro.TabStop      = false;
            rbManual.TabStop       = false;
            rbProporcional.TabStop = false;
            rbZero.TabStop         = false;

            this.est    = est;                 // Estabelecimento
            this.config = config;              // Configuração de Movimento
            this.fun    = fun;                 // Funcionário
            telaMov     = (TelaPrincipal)tela; // Tela de Movimento

            CarregaServico();

            CarregaFormaPagamento();

            CarregaFaturaExcedentePadrao();

            //busca um movimento caso venha um ID
            if (id != 0)
            {
                obj = mDAO.GetById(id);

                PreencheMovimento();
            } //ok
        }
 public void PreencherTotaisPorFormaPagamento()
 {
     TotalDinheiro      = 0;
     TotalCheque        = 0;
     TotalCartaoDebito  = 0;
     TotalCartaoCredito = 0;
     TotalBoleto        = 0;
     if (Movimentos != null)
     {
         foreach (var receita in Movimentos.Where(x => x.TipoOperacao.Equals((int)Operacoes.Receita)))
         {
             if (receita.FormaPagamentoID.Equals((int)FormasPagamento.Dinheiro))
             {
                 TotalDinheiro += receita.Valor;
             }
             else if (receita.FormaPagamentoID.Equals((int)FormasPagamento.CartaoCredito))
             {
                 TotalCartaoCredito += receita.Valor;
             }
             else if (receita.FormaPagamentoID.Equals((int)FormasPagamento.CartaoDebito))
             {
                 TotalCartaoDebito += receita.Valor;
             }
             else if (receita.FormaPagamentoID.Equals((int)FormasPagamento.Cheque))
             {
                 TotalCheque += receita.Valor;
             }
             else if (receita.FormaPagamentoID.Equals((int)FormasPagamento.Boleto))
             {
                 TotalBoleto += receita.Valor;
             }
         }
     }
 }
Example #3
0
        public void Alterar(Movimentos obj)
        {
            try
            {
                con = new Conexao();
                con.Conectar();

                String sql = "UPDATE movimentos SET";
                sql += " dh_saida = '" + obj.DhSaida.Replace("'", "''") + "', ";
                sql += " placa = '" + obj.Placa.Replace("'", "''") + "', ";
                sql += " tipo_veiculo = '" + obj.TipoVeiculo + "', ";
                sql += " veiculo = '" + obj.Placa.Replace("'", "''") + "', ";
                sql += " vaga = '" + obj.Vaga + "', ";
                sql += " idservico = '" + obj.Idservico + "', ";
                sql += " idfuncionario = '" + obj.Idfuncionario + "', ";
                sql += " idcontrato = '" + obj.Idcontrato + "', ";
                sql += " permanencia = '" + obj.Permanencia + "', ";
                sql += " excedente = '" + obj.Excedente + "', ";
                sql += " periodos = '" + obj.Periodos + "', ";
                sql += " doc_fed = '" + obj.DocFed.Replace("'", "''") + "' ";
                sql += " WHERE idmovimento = " + obj.Idmovimento + ";";
                sql  = sql.Replace("''", "NULL");
                con.ExecutarComandoSQL(sql);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao atualizar o Movimento!!! \n" + ex.Message, "ERRO !!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                con = null;
            }
        }
        public MovimentosAdapter(Movimentos movimento, varejo_config context)
        {
            //    try
            //    {
            Movimentos = movimento;

            if (movimento.Cliente_id > 0)
            {
                Cliente = (from cliente in context.Clientes
                           where cliente.Id == movimento.Cliente_id
                           select cliente.Nome).SingleOrDefault();
            }

            if (movimento.Fornecedor_id > 0)
            {
                Fornecedor = (from fornecedor in context.Fornecedores
                              where fornecedor.Id == movimento.Fornecedor_id
                              select fornecedor.Nome).SingleOrDefault();
            }

            Tipo_movimento = (from tm in context.Tipos_movimento
                              where tm.Id == movimento.Tipo_movimento_id
                              select tm).FirstOrDefault();

            Usuario = (from u in context.Usuarios
                       where u.Id == movimento.Usuario_id
                       select u.Nome).SingleOrDefault();
            //     }
            //    catch (Exception ex) { }
        }
Example #5
0
        protected void btnIncluir_Click(object sender, EventArgs e)
        {
            try
            {
                movimentacao = new Movimentos();
                controle.salvarMovimento(movimentacao);
                if (validaCampos())
                {
                    movimentacao.data    = Convert.ToDateTime(txtData.Text);
                    movimentacao.desc    = txtDescricao.Text;
                    movimentacao.id_tipo = controle.pesquisaCompletaIDTipoMov(descricao, subTipo, formaPg);
                    movimentacao.valor   = Convert.ToDecimal(txtMovValor.Text);
                    controle.salvaAtualiza();

                    btnLimparMov_Click(sender, e);
                    btnMostrar_Click(sender, e);
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('É obrigatório o preenchimento dos campos para a inclusão de uma nova movimentação.');", true);
                }
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('Falha na inserção, por favor, tente novamente.');", true);
            }
        }
        public async Task <ActionResult <Movimentos> > DeleteById([FromBody] VwMovimentos movimentos)
        {
            var movi = new Movimentos
            {
                Areceber      = movimentos.Areceber,
                Comprado      = movimentos.Comprado,
                Demanda       = movimentos.Demanda,
                Dia           = movimentos.Dia,
                GrupoId       = movimentos.GrupoId,
                MovimentoId   = movimentos.MovimentoId,
                Prazo         = movimentos.Prazo,
                Recebido      = movimentos.Recebido,
                SaldoFinal    = movimentos.SaldoFinal,
                SaldoInicial  = movimentos.SaldoInicial,
                SaldoMedioDia = movimentos.SaldoMedioDia,
                Vendido       = movimentos.Vendido
            };

            try
            {
                _context.Movimentos.Update(movi);
                await _context.SaveChangesAsync();

                return(Ok(new GenericResult <Movimentos> {
                    Sucesso = true
                }));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                return(BadRequest(new GenericResult <Movimentos> {
                    Sucesso = false, Mensagem = "Não foi possível atender essa solicitação. Tente novamente."
                }));
            }
        }
Example #7
0
        private void FecharCaminhoEncontrado()
        {
            if (Movimentos.EstaVazia)
            {
                todosOsCaminhosEncontrados = true;
                return;
            }

            int            i     = Movimentos.OTopo().Coordenada[0, 0];
            int            j     = Movimentos.OTopo().Coordenada[0, 1];
            List <int[, ]> lista = new List <int[, ]>();

            for (int i2 = 0; i2 < Matriz.GetLength(0); i2++)
            {
                for (int j2 = 0; j2 < Matriz.GetLength(1); j2++)
                {
                    if (Matriz[i2, j2].ToString().Equals("O"))
                    {
                        int[,] arr = new int[, ] {
                            { i2, j2 }
                        };
                        lista.Add(arr);
                    }
                }
            }

            Matriz       = (char[, ])MatrizOriginal.Clone();
            Matriz[i, j] = 'O';

            for (int i3 = 0; i3 < lista.Count; i3++)
            {
                Matriz[lista[i3][0, 0], lista[i3][0, 1]] = 'O';
            }
        }
Example #8
0
 private void SalvarCaminho(int linha, int col)
 {
     Movimentos.Empilhar(new Movimento(0, new int[, ] {
         { linha, col }
     }));
     CaminhosEncontrados.Add(Movimentos);
     Movimentos.Desempilhar();
 }
Example #9
0
 public override bool Mover(Movimentos movimento, Movimento.Tipo tipo)
 {
     if (tipo == Movimento.Tipo.posicao && InclinacaoAtual == STATE_INCLINACAO_PARA_BAIXO)
     {
         throw new System.Exception("Movimento não pode ser realizado na inclinação " + STATE_INCLINACAO_PARA_BAIXO);
     }
     return(base.Mover(movimento, tipo));
 }
Example #10
0
 public Pacman(GameObject pacmanObject, int linhaInicial, int colunaInicial)
 {
     movimentos         = new Movimentos(pacmanObject, linhaInicial, colunaInicial);
     this.linhaInicial  = linhaInicial;
     this.colunaInicial = colunaInicial;
     PacmanObject       = pacmanObject;
     PacmanObject.transform.position = movimentos.Posicao();
 }
        private void Run_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Itens_pagamentoController itens_pg = new Itens_pagamentoController();
            Movimentos movimento = itens_pg.FindMovimentoByCodItemPg(Parcela.Item_pagamento_id);

            DetalhesMovimento detalhesMov = new DetalhesMovimento(movimento.Id);

            detalhesMov.ShowDialog();
        }
Example #12
0
        public Movimentos GetByCampo(string campo, string busca, char saida)
        {
            Movimentos obj = new Movimentos();

            try
            {
                con = new Conexao();
                con.Conectar();
                String sql = "SELECT idmovimento, dh_entrada, dh_saida, placa, tipo_veiculo, veiculo, vaga, idservico, idfuncionario, idcontrato, permanencia, excedente, periodos, doc_fed FROM movimentos";
                sql += " WHERE " + campo + busca;
                if (saida == 'S')
                {
                    sql += " AND dh_saida IS NULL";
                }
                else if (saida == 'N')
                {
                    sql += " dh_saida IS NOT NULL";
                }
                sql += " ORDER BY 1 ASC LIMIT 1";

                var dados = con.RetDataReader(sql);

                if (dados.Read())
                {
                    obj.Idmovimento   = Convert.ToInt32(dados["idmovimento"]);
                    obj.DhEntrada     = Convert.ToDateTime(dados["dh_entrada"]).ToString("dd/MM/yyyy HH:mm");
                    obj.Placa         = dados["placa"].ToString();
                    obj.TipoVeiculo   = dados["tipo_veiculo"].ToString()[0];
                    obj.Veiculo       = dados["veiculo"].ToString();
                    obj.Vaga          = Convert.ToInt32(dados["vaga"]);
                    obj.Idservico     = Convert.ToInt32(dados["idservico"]);
                    obj.Idfuncionario = Convert.ToInt32(dados["idfuncionario"]);
                    obj.Idcontrato    = Convert.ToInt32(dados["idcontrato"]);
                    obj.Permanencia   = Convert.ToInt32(dados["permanencia"]);
                    obj.Excedente     = Convert.ToInt32(dados["excedente"]);
                    obj.Periodos      = Convert.ToInt32(dados["periodos"]);
                    obj.DocFed        = dados["doc_fed"].ToString();
                }
                else
                {
                    obj = null;
                }
            }
            catch (FormatException e)
            {
                MessageBox.Show("Erro ao converter !!! \n" + e.Message, "ERRO !!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao buscar os registros (BY ID) !!! \n" + ex.Message, "ERRO !!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            con = null;
            return(obj);
        }
Example #13
0
        private void Mover(int linhaProx, int colProx, ref int linha, ref int col, int direcao)
        {
            linha = linhaProx;
            col   = colProx;
            var movimento = new Movimento(direcao, new int[, ] {
                { linha, col }
            });

            Movimentos.Empilhar(movimento);
            Matriz[linha, col] = 'X';
        }
Example #14
0
 public EntradaMovimento(Estabelecimentos est, ConfigMovimento config, Funcionarios fun, Form tela)
 {
     InitializeComponent();
     txtHoraEntrada.Text = DateTime.Now.ToString("dd/MM/yyyy HH:mm");
     this.est            = est;
     this.config         = config;
     this.fun            = fun;
     CarregaServico();
     obj     = new Movimentos();
     oDAO    = new MovimentoDAO();
     telaMov = (TelaPrincipal)tela;
     MontaCupom();
 }
        public decimal SomarTotalDespesas()
        {
            decimal total = 0;

            if (Movimentos != null)
            {
                foreach (var despesa in Movimentos.Where(x => x.TipoOperacao.Equals((int)Operacoes.Despesa)))
                {
                    total += despesa.Valor;
                }
            }

            return(total);
        }
Example #16
0
 private void txtVaga_Leave(object sender, EventArgs e)
 {
     if (txtVaga.Value != 0)
     {
         Movimentos test = oDAO.GetByCampo("vaga = '", txtVaga.Value.ToString() + "' ", 'S');
         if (test != null)
         {
             btnSalvar.Enabled = false;
             MessageBox.Show("Vaga OCUPADA, Placa: " + test.Placa, "RTPark", MessageBoxButtons.OK, MessageBoxIcon.Error);
             txtVaga.Focus();
         }
         return;
     }
     btnSalvar.Enabled = true;
     MontaCupom();
 }
Example #17
0
        public void AbreMovimento(int cliente_fornecedor_id, int tipo_movimento)
        {
            Movimento = new Movimentos();

            Tipos_movimento tipo = new Tipos_movimentoController().Find(tipo_movimento);

            if (tipo.Utiliza_fornecedor)
            {
                InformarFornecedor(cliente_fornecedor_id);
            }
            else
            {
                InformarCliente(cliente_fornecedor_id);
            }

            Movimento.Tipo_movimento_id = tipo_movimento;
            BStatus.Success("Movimento iniciado...");
        }
        private void LoadMov(int movimento_id)
        {
            varejo_config context = new varejo_config();

            Movimentos movimento = controller.Find(movimento_id);

            txCod.Text      = movimento.Id.ToString();
            txTipo_mov.Text = movimento.Tipos_movimento.Descricao;
            txCliente.Text  = (movimento.Cliente_id == 0
                ? string.Empty
                : (from cliente in context.Clientes
                   where cliente.Id == movimento.Cliente_id
                   select cliente.Nome).SingleOrDefault());
            txFornecedor.Text = (movimento.Fornecedor_id == 0
                ? string.Empty
                : (from fornecedor in context.Fornecedores
                   where fornecedor.Id == movimento.Fornecedor_id
                   select fornecedor.Nome).SingleOrDefault());
            txData_mov.Text = movimento.Data.ToString("dd/MM/yyyy HH:mm:ss");
            txUsuario.Text  = movimento.Usuarios.Nome;

            Caixas cx = (from caixa in context.Caixas
                         join mov_caixa in context.Movimentos_caixas on caixa.Id equals mov_caixa.Caixa_id
                         where mov_caixa.Movimento_id == movimento.Id

                         select caixa).FirstOrDefault();

            txCaixa.Text = (cx == null
                ? string.Empty
                : cx.Nome);

            dataGrid_produtos.ItemsSource   = movimento.Itens_movimento;
            dataGrid_pagamentos.ItemsSource = movimento.Itens_pagamento;

            List <ParcelaAdapter> listAdp  = new List <ParcelaAdapter>();
            List <Parcelas>       parcelas = new ParcelasController().ListByItens_pagamento(movimento.Itens_pagamento.ToList());

            parcelas.ForEach(e => listAdp.Add(new ParcelaAdapter(e, context)));

            dataGrid_parcelas.ItemsSource = listAdp;
        }
Example #19
0
        private void txtPlaca_Leave(object sender, EventArgs e)
        {
            Movimentos test = oDAO.GetByCampo("placa = '", txtPlaca.Text + "' ", 'S');

            txtPlaca.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            txtPlaca.Text           = txtPlaca.Text.Trim().Replace(" ", "");
            if (txtPlaca.Text.Length < 7 && txtPlaca.Text.Length >= 0)
            {
                txtPlaca.Focus();
                btnSalvar.Enabled = false;
                txtPlaca.Clear();
            }
            else if (txtPlaca.Text.Length == 7)
            {
                if (test != null)
                {
                    btnSalvar.Enabled = false;
                    MessageBox.Show("Veiculo Já Estacionado! Placa: " + test.Placa, "RTPark", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPlaca.Focus();
                }
                else
                {
                    txtPlaca.TextMaskFormat = MaskFormat.IncludeLiterals;
                    BuscaPlaca();
                    btnSalvar.Enabled       = true;
                    txtPlaca.TextMaskFormat = MaskFormat.IncludeLiterals;
                    txtPlaca.TabStop        = false;
                    txtPlaca.ReadOnly       = true;
                    txtPlaca.BackColor      = Color.White;
                    txtPlaca.ForeColor      = Color.Blue;
                }
            }
            else
            {
                MessageBox.Show("O campo [ PLACA ] está inválido!");
                txtPlaca.Focus();
                btnSalvar.Enabled = false;
            }
        }
Example #20
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            MontaCupom();

            if (obj == null)
            {
                obj = new Movimentos();
            }

            obj.DhEntrada     = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
            obj.Placa         = txtPlaca.Text;
            obj.TipoVeiculo   = gbTipoVeiculo.Controls.OfType <RadioButton>().SingleOrDefault(rad => rad.Checked == true).Text[0];
            obj.Veiculo       = txtVeiculo.Text;
            obj.Vaga          = (int)txtVaga.Value;
            obj.Idservico     = Convert.ToInt32(cboServico.SelectedValue);
            obj.Idfuncionario = fun.Idfuncionario;
            obj.Idcontrato    = (contr != null) ? contr.Idcontrato : 0;
            obj.DocFed        = txtDocFed.Text;

            obj.Idmovimento = oDAO.Inserir(obj);

            MontaCupom();
            if (config.ImprimeEntrada == 'P')
            {
                DialogResult dr = MessageBox.Show("Deseja Imprimir o Cupom de Entrada ?", "RTPark", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dr == DialogResult.Yes)
                {
                    Impressao();
                }
            }
            else if (config.ImprimeEntrada == 'S')
            {
                Impressao();
            }

            telaMov.CarregaGrid();
            this.Close();
        }
Example #21
0
        public int Inserir(Movimentos obj)
        {
            try
            {
                con = new Conexao();
                con.Conectar();

                String sql = "INSERT INTO movimentos (dh_entrada, placa, tipo_veiculo, veiculo, vaga, idservico, idfuncionario, " +
                             "idcontrato, permanencia, excedente, periodos, doc_fed) VALUES(";
                sql += "'" + obj.DhEntrada.Replace("'", "''") + "', ";
                //sql += "'" + obj.DhSaida.Replace("'", "''") + "', ";
                sql += "'" + obj.Placa.Replace("'", "''") + "', ";
                sql += "'" + obj.TipoVeiculo + "', ";
                sql += "'" + obj.Veiculo.Replace("'", "''") + "', ";
                sql += "'" + obj.Vaga + "', ";
                sql += "'" + obj.Idservico + "', ";
                sql += "'" + obj.Idfuncionario + "', ";
                sql += "'" + obj.Idcontrato + "', ";
                sql += "'" + obj.Permanencia + "', ";
                sql += "'" + obj.Excedente + "', ";
                sql += "'" + obj.Periodos + "', ";
                sql += "'" + obj.DocFed.Replace("'", "''") + "'); ";
                sql += "SELECT LAST_INSERT_ID();";
                sql  = sql.Replace("''", "NULL");
                Console.WriteLine(sql);
                int id = Convert.ToInt32(con.ExecutarComandoSQLRetorno(sql));

                return(id);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Erro ao cadastrar Movimento !!! \n" + ex.Message, "ERRO !!!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(0);
            }
            finally
            {
                con = null;
            }
        }
Example #22
0
        public IList <Movimento> GetMovimentosByProdutoAndFilial(int IdProduto, int IdFilial)
        {
            IList <Movimento> movimentos = Movimentos
                                           .Where(m => m.IdProduto == IdProduto)
                                           .OrderBy(m => m.Data)
                                           .ThenBy(m => m.Id).ToList();

            if (IdFilial != 0)
            {
                movimentos = movimentos.Where(m => m.IdFilial == IdFilial).ToList();
            }

            double saldo = 0.0;

            foreach (Movimento movimento in movimentos)
            {
                saldo          += movimento.Quantidade;
                movimento.Saldo = saldo;
            }

            return(movimentos);
        }
Example #23
0
        public virtual bool Mover(Movimentos movimento, Movimento.Tipo tipo)
        {
            try
            {
                Exception e = new Exception("Estado Inválido. Estado do componente resetado para o estado inicial.");
                if (tipo == Movimento.Tipo.posicao)
                {
                    if (movimento == Movimentos.avancar && ++estadoAtualIndex == estados.Length)
                    {
                        throw e;
                    }
                    if (movimento == Movimentos.retroceder && --estadoAtualIndex < 0)
                    {
                        throw e;
                    }
                }
                else if (tipo == Movimento.Tipo.inclinacao)
                {
                    if (movimento == Movimentos.avancar && ++inclinacaoAtualIndex == estados.Length)
                    {
                        throw e;
                    }
                    if (movimento == Movimentos.retroceder && --inclinacaoAtualIndex < 0)
                    {
                        throw e;
                    }
                }
            }
            catch (Exception e)
            {
                inclinacaoAtualIndex = 1;
                estadoAtualIndex     = GetDefaultEstadoAtualIndex();
                throw e;
            }

            return(true);
        }
Example #24
0
        } //OK

        private void txtPlaca_Leave(object sender, EventArgs e)
        {
            txtPlaca.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals;
            txtPlaca.Text           = txtPlaca.Text.Trim().Replace(" ", "");
            if (txtPlaca.Text.Length < 7 && txtPlaca.Text.Length >= 0)
            {
                txtPlaca.Focus();
                btnSalvar.Enabled = false;
                txtPlaca.Clear();
            }
            else if (txtPlaca.Text.Length == 7)
            {
                txtPlaca.TextMaskFormat = MaskFormat.IncludeLiterals;
                obj = mDAO.GetByCampo("placa = '", txtPlaca.Text + "' ", 'S');
                if (obj != null)
                {
                    btnSalvar.Enabled = true;
                    PreencheMovimento();
                }
                else
                {
                    MessageBox.Show("PLACA INVÁLIDA! \n" +
                                    "Veiculo não estacionado.", "ERRO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    txtPlaca.Focus();
                    btnSalvar.Enabled = false;
                    txtPlaca.Clear();
                }
            }
            else
            {
                MessageBox.Show("O campo [ PLACA ] está inválido!", "ERRO!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                txtPlaca.Focus();
                btnSalvar.Enabled = false;
            }
            txtPlaca.TextMaskFormat = MaskFormat.IncludeLiterals;
        }
Example #25
0
 public Comida(GameObject foodObject, int linha, int coluna)
 {
     movimentos      = new Movimentos(foodObject, linha, coluna);
     this.FoodObject = foodObject;
     this.FoodObject.transform.position = movimentos.Posicao();
 }
Example #26
0
 public Comida(GameObject foodObject)
 {
     movimentos = new Movimentos(foodObject);
     FoodObject = foodObject;
     FoodObject.transform.position = movimentos.Posicao();
 }
Example #27
0
        protected void AdicionarMovimento(Movimento movimento)
        {
            movimento.Conta = this;

            Movimentos.Add(movimento);
        }
Example #28
0
        private void vidaescore_Tick(object sender, EventArgs e)
        {
            Bitmap cidade = Properties.Resources.Cidade;

            //aqui existe um label que mostra a vida do personagem
            vida.Text = "Vida: " + Convert.ToString(barradevida.Width / 3);
            //outro label que mostra os monstros mortos
            monstrosM.Text = "Monstros Mortos: " + Convert.ToString(monstrosmortos);

            if (monstrosmortos == 10 && trocademapa == 0)
            {
                trocademapa++;
                this.BackgroundImage = Properties.Resources.Cidade;
            }
            if (monstrosmortos == 20 && trocademapa == 1)
            {
                trocademapa++;
                this.BackgroundImage = Properties.Resources.neve;
            }
            //se a barra de vida zerar então o jogo acaba e aparece outra tela dizendo que voce morreu
            if (barradevida.Width == 0)
            {
                i += 1;
            }
            if (barradevida.Width == 0 && i == 1)
            {
                TelaMorte morte = new TelaMorte();
                Movimentos.Stop();
                tiros.Stop();
                frequenciatiro.Stop();
                Pulo.Stop();
                Monstros.Stop();
                SpawnMonstros.Stop();
                Colisoes.Stop();
                vidaescore.Stop();
                sons.controls.stop();
                tiro.controls.stop();
                highscore.Stop();
                monstrosmortos  = 0;
                monstroscriados = 0;
                vaiparadireita  = false;
                vaiparaesquerda = false;
                parado          = true;
                atirar          = false;
                pular           = false;
                if (File.Exists("pontuacao.txt"))
                {
                    bool     existe = false;
                    string[] linhas = File.ReadAllLines("pontuacao.txt");
                    for (int i = 0; i < linhas.Length; i++)
                    {
                        if (linhas[i].Contains(Variaveis.login))
                        {
                            existe = true;
                            string[] dados = linhas[i].Split('|');
                            if (Variaveis.highscore > Convert.ToInt32(dados[1]))
                            {
                                dados[1]  = Convert.ToString(Variaveis.highscore);
                                linhas[i] = dados[0] + '|' + dados[1];
                                existe    = true;
                                string texto = "";
                                for (int j = 0; j < linhas.Length; j++)
                                {
                                    texto += linhas[j] + Environment.NewLine;
                                }
                                File.WriteAllText("pontuacao.txt", texto);
                                MessageBox.Show("Pontuação Salva");
                            }
                        }
                    }
                    if (existe == false)
                    {
                        File.AppendAllText("pontuacao.txt", Variaveis.login + "|" +
                                           Convert.ToString(Variaveis.highscore) + Environment.NewLine);
                    }
                }
                else
                {
                    File.AppendAllText("pontuacao.txt", Variaveis.login + "|" +
                                       Convert.ToString(Variaveis.highscore) + Environment.NewLine);
                }
                this.Hide();
                morte.ShowDialog();
                i = 0;
                this.Close();
            }
        }
Example #29
0
        protected void btnSalvar_Click(object sender, EventArgs e)
        {
            movimento = new Movimentos();
            controle.salvarMovimento(movimento);

            gvlProdutos.Enabled = true;

            //condicionais referente a regras de negócio
            //Icms inferior a 25% do preço de custo
            if (Convert.ToDouble(txtIcms.Text) > (Convert.ToDouble(txtCusto.Text) * 0.25))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"ICMS\" corresponde a mais de 25% do custo de compra, Edite o produto caso necessário.');", true);
            }
            //Lucro minimo de 30% sobre o custo
            if (Convert.ToDouble(txtPreco.Text) < (Convert.ToDouble(txtCusto.Text) + (Convert.ToDouble(txtCusto.Text) * gerencia.lucroMinimo)))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"Preco\" está com uma taxa de lucro inferior ao determinado pela Administração.');", true);
            }

            //Condicionais para validação do preenchimento
            //campos preenchidos
            if (!validaCampos())
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('Todos os campos devem ser preenchidos com valores válidos');", true);
            }
            //campo código numérico e com 13 digitos
            else if (txtCodigo.Text.All(char.IsLetter) || txtCodigo.Text.Length != 13)
            {
                txtCodigo.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"Código\" deve ser exclusivamente numérico com 13 caracteres.');", true);
            }
            //campo de custo, icms e preço correspondendo a valor monetário
            else if (!txtCusto.Text.Any(char.IsNumber) || !txtCusto.Text.Any(char.IsPunctuation))
            {
                txtCusto.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"Custo\" deve ser preenchido com o formato \"XX.XX\".');", true);
            }
            else if (!txtIcms.Text.Any(char.IsNumber) || !txtIcms.Text.Any(char.IsPunctuation))
            {
                txtIcms.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"ICMS\" deve ser preenchido com o formato \"XX.XX\".');", true);
            }
            else if (!txtPreco.Text.Any(char.IsNumber) || !txtPreco.Text.Any(char.IsPunctuation))
            {
                txtPreco.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"Preço\" deve ser preenchido com o formato \"XX.XX\".');", true);
            }
            //quantidade numérica
            else if (!txtQnt.Text.All(char.IsNumber))
            {
                txtQnt.Text = "";
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"Qnt\" deve ser preenchido com valores numéricos.');", true);
            }
            //preço superior ao custo
            else if (Convert.ToDouble(txtCusto.Text) >= Convert.ToDouble(txtPreco.Text))
            {
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "message", "alert('O campo \"Preco\" obrigatóriamente deve ser maior que o \"Custo\".');", true);
            }

            //se flag novo = false, novo elemento
            else if (flagNovo)
            {
                movimento.data    = DateTime.Today;
                movimento.desc    = "Aquisição de Estoque";
                movimento.id_tipo = 12;
                movimento.valor   = Convert.ToDecimal(txtCusto.Text) * Convert.ToInt32(txtQnt.Text.Trim());

                txtCusto.Text = Convert.ToDecimal(txtCusto.Text).ToString("0.00");
                txtPreco.Text = Convert.ToDecimal(txtPreco.Text).ToString("0.00");
                txtIcms.Text  = Convert.ToDecimal(txtIcms.Text).ToString("0.00");

                lblAlerta.Visible = false;

                produto = new Produtos();
                controle.salvarProduto(produto);
                produto.cod_produto   = txtCodigo.Text.Trim();
                produto.preco_compra  = Convert.ToDecimal(txtCusto.Text.Trim());
                produto.preco_venda   = Convert.ToDecimal(txtPreco.Text.Trim());
                produto.ICMS_pago     = Convert.ToDecimal(txtIcms.Text.Trim());
                produto.desc_produto  = txtNome.Text.Trim().ToUpper();
                produto.id_fornecedor = Convert.ToInt32(ddlFornecedores.SelectedValue);
                produto.und_medida    = ddlMedida.SelectedItem.Text;
                produto.imagem        = bytes;
                produto.status        = 1;
                controle.salvaAtualiza();

                GridViewRow newLine = new GridViewRow(gvlProdutos.Rows.Count + 1, gvlProdutos.Rows.Count + 1, DataControlRowType.DataRow, DataControlRowState.Normal);
                gvlProdutos.Controls.Add(newLine);

                estoque = new Estoque();
                controle.salvarEstoque(estoque);
                estoque.id_produto  = produto.id;
                estoque.qnt_atual   = Convert.ToInt32(txtQnt.Text.Trim());
                estoque.qnt_minima  = Convert.ToInt32(txtMinimo.Text.Trim());
                estoque.qnt_maxima  = Convert.ToInt32(txtMaximo.Text.Trim());
                estoque.num_local   = Convert.ToInt32(txtNumLocal.Text.Trim());
                estoque.letra_local = txtLetraLocal.Text.Trim().ToUpper();
                estoque.ref_local   = txtRefLocal.Text.Trim().ToUpper();
                controle.salvaAtualiza();

                limpaForm();
                listaCompleta();
            }

            //alteração de elemento existente na base de dados
            else if (!flagNovo)
            {
                movimento.data    = DateTime.Today;
                movimento.desc    = "Aquisição de Estoque";
                movimento.id_tipo = 12;
                movimento.valor   = Convert.ToDecimal(txtCusto.Text) * (Convert.ToInt32(txtQnt.Text.Trim()) - qntTemp);

                txtCusto.Text = Convert.ToDecimal(txtCusto.Text).ToString("0.00");
                txtPreco.Text = Convert.ToDecimal(txtPreco.Text).ToString("0.00");
                txtIcms.Text  = Convert.ToDecimal(txtIcms.Text).ToString("0.00");

                int id = produto.id;
                produto               = new Produtos();
                produto               = controle.pesquisaProdutoId(id);
                lblAlerta.Visible     = false;
                produto.cod_produto   = txtCodigo.Text;
                produto.preco_compra  = Convert.ToDecimal(txtCusto.Text);
                produto.preco_venda   = Convert.ToDecimal(txtPreco.Text);
                produto.ICMS_pago     = Convert.ToDecimal(txtIcms.Text);
                produto.desc_produto  = txtNome.Text;
                produto.id_fornecedor = Convert.ToInt32(ddlFornecedores.SelectedValue);
                produto.und_medida    = ddlMedida.SelectedItem.Text;
                produto.imagem        = bytes;

                estoque             = new Estoque();
                estoque             = controle.pesquisaProdEstoqueId(id);
                estoque.qnt_atual   = Convert.ToInt32(txtQnt.Text);
                estoque.qnt_minima  = Convert.ToInt32(txtMinimo.Text);
                estoque.qnt_maxima  = Convert.ToInt32(txtMaximo.Text);
                estoque.num_local   = Convert.ToInt32(txtNumLocal.Text);
                estoque.letra_local = txtLetraLocal.Text;
                estoque.ref_local   = txtRefLocal.Text;
                controle.salvaAtualiza();

                limpaForm();
                listaCompleta();
            }
        }
Example #30
0
 public void Mover(Movimentos direção)
 {
     Console.WriteLine("O Jogador moveu-se para " + direção);
 }