Esempio n. 1
0
        private void BOTAOATUALIZAR_Click(object sender, EventArgs e)
        {
            OcorrenciaModelo ocorrencia = new OcorrenciaModelo();
            Funcoes          funcoes    = new Funcoes();

            if (EDITCODIGOOCORRENCIA.Text != "" && EDITCODIGOOCORRENCIA.Text != null)
            {
                ocorrencia.controle = Convert.ToInt32(EDITCODIGOOCORRENCIA.Text);
            }

            if (funcoes.ApenasNumeros(EDITDATAOCORRENCIA.Text) != "" && funcoes.ApenasNumeros(EDITDATAOCORRENCIA.Text) != null)
            {
                ocorrencia.dataocorrencia = DateTime.Parse(EDITDATAOCORRENCIA.Text, new System.Globalization.CultureInfo("pt-BR"));
            }
            ocorrencia.horaocorrencia  = EDITHORAOCORRENCIA.Text;
            ocorrencia.veiculocodigo   = Convert.ToInt32(EDITVEICULOCODIGO.Text);
            ocorrencia.motoristacodigo = Convert.ToInt32(EDITMOTORISTACODIGO.Text);
            ocorrencia.localocorrencia = EDITLOCALOCORRENCIA.Text;
            ocorrencia.tipoocorrencia  = EDITTIPOOCORRENCIA.Text;
            OcorrenciaControle controleOcorrencia = new OcorrenciaControle();

            controleOcorrencia.alterar(ocorrencia);


            MessageBox.Show("Ocorencia atualizada com sucesso", "Cadastro Ocorrencia");
            limpaTela();
        }
Esempio n. 2
0
        private void BOTAOATUALIZAR_Click(object sender, EventArgs e)
        {
            if (validaProduto())
            {
                Funcoes funcoes = new Funcoes();

                ProdutoModelo produto = new ProdutoModelo();
                if (EDITCODIGO.Text != "" && EDITCODIGO.Text != null)
                {
                    produto.codigo = Convert.ToInt32(EDITCODIGO.Text);
                }
                if (EDITCODIGO.Text != "" && EDITCODIGO.Text != null)
                {
                    produto.codigo = Convert.ToInt32(EDITCODIGO.Text);
                }
                produto.descricao = EDITDESCRICAO.Text;
                produto.unidade   = EDITUNIDADE.Text;
                produto.situacao  = EDITSITUACAO.Text;
                if (EDITGRUPOCODIGO.Text != "" && EDITGRUPOCODIGO.Text != null)
                {
                    produto.grupocodigo = Convert.ToInt32(EDITGRUPOCODIGO.Text);
                }
                if (EDITCUSTO.Text != "" && EDITCUSTO.Text != null)
                {
                    produto.custo = Convert.ToInt32(EDITCUSTO.Text);
                }
                if (EDITCUSTOMEDIO.Text != "" && EDITCUSTOMEDIO.Text != null)
                {
                    produto.customedio = Convert.ToInt32(EDITCUSTOMEDIO.Text);
                }
                if (EDITESTOQUE.Text != "" && EDITESTOQUE.Text != null)
                {
                    produto.estoque = Convert.ToInt32(EDITESTOQUE.Text);
                }
                if (funcoes.ApenasNumeros(EDITDATAULTIMACOMPRA.Text) != "" && funcoes.ApenasNumeros(EDITDATAULTIMACOMPRA.Text) != null)
                {
                    produto.dataultimacompra = Convert.ToDateTime(EDITDATAULTIMACOMPRA.Text);
                }
                if (funcoes.ApenasNumeros(EDITDATAULTIMASAIDA.Text) != "" && funcoes.ApenasNumeros(EDITDATAULTIMASAIDA.Text) != null)
                {
                    produto.dataultimasaida = Convert.ToDateTime(EDITDATAULTIMASAIDA.Text);
                }

                ProdutoControle produtocontrole = new ProdutoControle();
                if (EDITCODIGO.Text != "" || (EDITCODIGO.Text == null))
                {
                    produtocontrole.alterar(produto);
                }
                else
                {
                    produtocontrole.salvar(produto);
                }
                MessageBox.Show("Cadastro atualizado com sucesso", "Cadastro de Produtos");
                limpaTela();
            }
        }
Esempio n. 3
0
        public Boolean validaOcorrencia()
        {
            Boolean resultado = true;

            Funcoes funcoes = new Funcoes();

            if (String.IsNullOrEmpty(EDITVEICULOCODIGO.Text) || !EDITVEICULOCODIGO.Text.All(char.IsNumber))
            {
                MessageBox.Show("Informe o código do veiculo!", "Código Veiculo");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITMOTORISTACODIGO.Text) || !EDITMOTORISTACODIGO.Text.All(char.IsNumber))
            {
                MessageBox.Show("Informe o código do motorista.", "Código Motorista");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITMARCAMODELOCODIGO.Text) || !EDITMARCAMODELOCODIGO.Text.All(char.IsNumber))
            {
                MessageBox.Show("Informe a marca e modelo do veiculo.", "Marca / Modelo");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITTIPOOCORRENCIA.Text))
            {
                MessageBox.Show("Informe o tipo de ocorrencia.", "Tipo Ocorrencia");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(funcoes.ApenasNumeros(EDITDATAOCORRENCIA.Text)) && funcoes.ApenasNumeros(EDITDATAOCORRENCIA.Text) != null)
            {
                MessageBox.Show("A data da ocorrência deve ser informada.", "Data ocorrência");
                resultado = false;
            }
            else if (!funcoes.validaData(EDITDATAOCORRENCIA.Text))
            {
                MessageBox.Show("A data da ocorrência foi informada incorretamente.", "Data ocorrência");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(funcoes.ApenasNumeros(EDITHORAOCORRENCIA.Text)) && funcoes.ApenasNumeros(EDITHORAOCORRENCIA.Text) != null)
            {
                MessageBox.Show("Horario da ocorrência deve ser informado.", "Hora ocorrência");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITLOCALOCORRENCIA.Text))
            {
                MessageBox.Show("Preencher o local da ocorrência.", "Local da ocorrência");
                resultado = false;
            }
            return(resultado);
        }
Esempio n. 4
0
        public Boolean validaDadosCompra()
        {
            Boolean resultado = true;
            Funcoes funcoes   = new Funcoes();

            if (String.IsNullOrEmpty(EDITFORNECEDORCODIGO.Text) || !EDITFORNECEDORCODIGO.Text.All(char.IsNumber))
            {
                MessageBox.Show("O fornecedor da compra deverá ser informado.!", "Fornecedor");
                resultado = false;
            }
            if (String.IsNullOrEmpty(funcoes.ApenasNumeros(EDITDATADACOMPRA.Text)))
            {
                MessageBox.Show("A data da compra deverá ser informada!", "Data da compra");
                resultado = false;
            }

            /*
             * if (String.IsNullOrEmpty(EDITVALORCOMPRA.Text) || !EDITVALORCOMPRA.Text.All(char.IsNumber))
             * {
             *  MessageBox.Show("O valor total está em branco!", "Valor total compra");
             *  resultado = false;
             * }
             * else
             * {
             *  if (Convert.ToDecimal(EDITVALORCOMPRA.Text) <= 0)
             *  {
             *      MessageBox.Show("O valor total da compra está zerado.   Esta informação é gerada a partir da entrada dos itens da compra.!", "Valor total da compra");
             *      resultado = false;
             *  }
             * }*/
            return(resultado);
        }
 private void txtCodigo_KeyPress(object sender, KeyPressEventArgs e) //ao inserir o código carrego a tela
 {
     funcoes.ApenasNumeros(e);
     if ((txtCodigo.Text != "") && (e.KeyChar == (char)Keys.Enter))
     {
         c_contaBancariaEnt.codigo = Convert.ToInt64(txtCodigo.Text);
         string retorno = c_contaBancariaBll.CarregarDados(c_contaBancariaEnt);
         if (retorno == "1")
         {
             try
             {
                 Convert.ToInt32(retorno);
                 PreencherTela();
             }
             catch
             {
                 MessageBox.Show("Inconsistência ao carregar os dados. Detalhes: " + retorno, "Falha", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             }
         }
         else if (retorno == "0")
         {
             MessageBox.Show("Registro inexistente!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
             LimparCampos();
         }
         else
         {
             MessageBox.Show("Inconsitêcia ao carregar os dados. Detalhes: " + retorno, "Falha", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
     }
 }
Esempio n. 6
0
        private void BOTAOATUALIZARCADASTRO_Click_1(object sender, EventArgs e)
        {
            if (validaMotorista())
            {
                MotoristaModelo motorista = new MotoristaModelo();
                Funcoes         funcoes   = new Funcoes();

                if (EDITCODIGOCADASTRO.Text != "" && EDITCODIGOCADASTRO.Text != null)
                {
                    motorista.codigo = Convert.ToInt32(EDITCODIGOCADASTRO.Text);
                }
                motorista.nome = EDITNOMEMOTORISTA.Text;
                motorista.sexo = EDITSEXO.Text;
                motorista.rg   = EDITRG.Text;
                motorista.cpf  = EDITCPF.Text.Replace(',', '.');
                if (funcoes.ApenasNumeros(EDITDATAEMISSAO.Text) != "" && funcoes.ApenasNumeros(EDITDATAEMISSAO.Text) != null)
                {
                    motorista.datavalidade = DateTime.Parse(EDITDATAEMISSAO.Text, new System.Globalization.CultureInfo("pt-BR"));
                }
                motorista.habilitacao    = EDITNUMEROCNH.Text;
                motorista.categoria      = EDITCATEGORIACNH.Text;
                motorista.logradouro     = EDITENDERECO.Text;
                motorista.numero         = EDITNUMERO.Text;
                motorista.complemento    = EDITCOMPLEMENTO.Text;
                motorista.bairro         = EDITBAIRRO.Text;
                motorista.cep            = EDITCEP.Text;
                motorista.ddd            = EDITDDD.Text;
                motorista.telefone       = EDITTELEFONE.Text;
                motorista.dddcelular     = EDITDDD1.Text;
                motorista.celular        = EDITTELEFONE1.Text;
                motorista.email          = EDITEMAIL.Text;
                motorista.cidadecontrole = Convert.ToInt32(EDITCIDADECONTROLE.Text);

                MotoristaControle motoristacontrole = new MotoristaControle();
                if (EDITCODIGOCADASTRO.Text != "" && EDITCODIGOCADASTRO.Text != null)
                {
                    motoristacontrole.alterar(motorista);
                }
                else
                {
                    motoristacontrole.salvar(motorista);
                }
                MessageBox.Show("Cadastro atualizado com sucesso", "Cadastro Motorista");
                limpaTela();
            }
        }
Esempio n. 7
0
        private void BOTAOSALVAR_Click(object sender, EventArgs e)
        {
            if (validaDados())
            {
                LocacaoModelo locacao = new LocacaoModelo();
                Funcoes       funcoes = new Funcoes();

                if (EDITCONTROLE.Text != "" && EDITCONTROLE.Text != null)
                {
                    locacao.controle = Convert.ToInt32(EDITCONTROLE.Text);
                }
                if (EDITVEICULOCODIGO.Text != "" && EDITVEICULOCODIGO.Text != null)
                {
                    locacao.veiculocodigo = Convert.ToInt32(EDITVEICULOCODIGO.Text);
                }
                if (funcoes.ApenasNumeros(EDITDATAINICIOLOCACAO.Text) != "" && funcoes.ApenasNumeros(EDITDATAINICIOLOCACAO.Text) != null)
                {
                    locacao.datainiciolocacao = Convert.ToDateTime(EDITDATAINICIOLOCACAO.Text);
                }
                if (funcoes.ApenasNumeros(EDITDATAFIMLOCACAO.Text) != "" && funcoes.ApenasNumeros(EDITDATAFIMLOCACAO.Text) != null)
                {
                    locacao.datafimlocacao = Convert.ToDateTime(EDITDATAFIMLOCACAO.Text);
                }
                if (funcoes.ApenasNumeros(EDITVALORLOCACAO.Text) != "" && funcoes.ApenasNumeros(EDITVALORLOCACAO.Text) != null)
                {
                    locacao.valorlocacao = Convert.ToInt32(EDITVALORLOCACAO.Text);
                }

                LocacaoControle locacaocontrole = new LocacaoControle();
                if (EDITCONTROLE.Text != "" || (EDITCONTROLE.Text == null))
                {
                    locacaocontrole.alterar(locacao);
                }
                else
                {
                    locacaocontrole.salvar(locacao);
                }
                MessageBox.Show("Cadastro realizado com sucesso");
                limpaTela();
            }
        }
Esempio n. 8
0
        private void BOTAOATUALIZAR_Click(object sender, EventArgs e)
        {
            if (validaVeiculo())
            {
                VeiculoModelo veiculo = new VeiculoModelo();
                Funcoes       funcoes = new Funcoes();

                if (EDITCODIGO.Text != "" && EDITCODIGO.Text != null)
                {
                    veiculo.codigo = Convert.ToInt32(EDITCODIGO.Text);
                }
                if (EDITMARCAMODELOCODIGO.Text != "" && EDITMARCAMODELOCODIGO.Text != null)
                {
                    veiculo.marcamodelocodigo = int.Parse(EDITMARCAMODELOCODIGO.Text);
                }
                veiculo.placa       = EDITPLACA.Text;
                veiculo.chassi      = EDITCHASSI.Text;
                veiculo.combustivel = EDITCOMBUSTIVEL.Text;
                if (EDITANOFABRICA.Text != "" && EDITANOFABRICA.Text != null)
                {
                    veiculo.anofabrica = Convert.ToInt32(EDITANOFABRICA.Text);
                }
                if (EDITANOMODELO.Text != "" && EDITANOMODELO.Text != null)
                {
                    veiculo.anomodelo = Convert.ToInt32(EDITANOMODELO.Text);
                }
                veiculo.codigorenavan = EDITCODIGORENAVAN.Text;
                if (EDITEXERCICIO.Text != "" && EDITEXERCICIO.Text != null)
                {
                    veiculo.exercicio = Convert.ToInt32(EDITEXERCICIO.Text);
                }
                veiculo.situacao = EDITSITUACAO.Text;

                if (funcoes.ApenasNumeros(EDITDATAVENDA.Text) != "" && funcoes.ApenasNumeros(EDITDATAVENDA.Text) != null)
                {
                    veiculo.datavenda = Convert.ToDateTime(EDITDATAVENDA.Text);
                }
                if (EDITVALORVENDA.Text != "" && EDITVALORVENDA.Text != null)
                {
                    veiculo.valorvenda = Convert.ToDecimal(EDITVALORVENDA.Text);
                }
                if (funcoes.ApenasNumeros(EDITDATABAIXA.Text) != "" && funcoes.ApenasNumeros(EDITDATABAIXA.Text) != null)
                {
                    veiculo.databaixa = Convert.ToDateTime(EDITDATABAIXA.Text);
                }
                veiculo.motivobaixa = EDITMOTIVOBAIXA.Text;
                if (EDITSEGURADORA.Text != "" && EDITSEGURADORA.Text != null)
                {
                    veiculo.seguradoracodigo = int.Parse(EDITSEGURADORA.Text);
                }
                if (funcoes.ApenasNumeros(EDITINICIOVIGENCIA.Text) != "" && funcoes.ApenasNumeros(EDITINICIOVIGENCIA.Text) != null)
                {
                    veiculo.datainiciovigencia = Convert.ToDateTime(EDITINICIOVIGENCIA.Text);
                }
                if (funcoes.ApenasNumeros(EDITFIMVIGENCIA.Text) != "" && funcoes.ApenasNumeros(EDITFIMVIGENCIA.Text) != null)
                {
                    veiculo.datafimvigencia = Convert.ToDateTime(EDITFIMVIGENCIA.Text);
                }
                VeiculoControle veiculocontrole = new VeiculoControle();
                if (EDITCODIGO.Text != "" && EDITCODIGO.Text != null)
                {
                    veiculocontrole.alterar(veiculo);
                }
                else
                {
                    veiculocontrole.salvar(veiculo);
                }
            }

            MessageBox.Show("Cadastro atualizado com sucesso", "Cadastro Veiculo");
            limpaTela();
        }
Esempio n. 9
0
        public Boolean validaMotorista()
        {
            Boolean resultado = true;

            Funcoes funcoes = new Funcoes();

            String numerocep = funcoes.ApenasNumeros(EDITCEP.Text);

            if (String.IsNullOrEmpty(EDITNOMEMOTORISTA.Text) || EDITNOMEMOTORISTA.Text.All(char.IsNumber))
            {
                MessageBox.Show("Infomre um nome!", "NOME");
                resultado = false;
            }
            else if (EDITSEXO.SelectedItem == null)
            {
                MessageBox.Show("Informe um sexo!", "SEXO");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITRG.Text))
            {
                MessageBox.Show("Informe o RG", "RG");
                resultado = false;
            }
            else if ((!String.IsNullOrEmpty(EDITCPF.Text)) && (funcoes.validarCpf(funcoes.ApenasNumeros(EDITCPF.Text)) == false))
            {
                MessageBox.Show("Informe um CPF válido!", "CPF");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITNUMEROCNH.Text) || !EDITNUMEROCNH.Text.All(char.IsNumber))
            {
                MessageBox.Show("Informe o numero da categoria CNH!", "NUMERO CNH");
                resultado = false;
            }
            else if (EDITCATEGORIACNH.SelectedItem == null)
            {
                MessageBox.Show("Informe uma categoria CNH!", "Categoria CNH");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITCIDADE.Text) || EDITCIDADE.Text.All(char.IsNumber))
            {
                MessageBox.Show("A cidade deverá ser informada.", "CIDADE");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITENDERECO.Text) || EDITENDERECO.Text.All(char.IsNumber))
            {
                MessageBox.Show("Informe um enderço", "ENDERECO");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITNUMERO.Text))
            {
                MessageBox.Show("Informe um número do endereço", "NUMERO");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITBAIRRO.Text))
            {
                MessageBox.Show("Informe um bairro", "BAIRRO");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(numerocep))
            {
                MessageBox.Show("Informe um CEP", "CEP");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(EDITDDD1.Text))
            {
                MessageBox.Show("Informe o DDD", "DDD CELULAR");
                resultado = false;
            }
            else if (String.IsNullOrEmpty(funcoes.ApenasNumeros(EDITTELEFONE1.Text)))
            {
                MessageBox.Show("Informe o número do Celular", "NUMERO CELULAR");
                resultado = false;
            }
            return(resultado);
        }
Esempio n. 10
0
        public Boolean validaFornecedor()
        {
            Boolean resultado = true;

            Funcoes funcoes = new Funcoes();

            if (String.IsNullOrEmpty(EDITNOMERAZAO.Text) || EDITNOMERAZAO.Text.All(char.IsNumber))
            {
                MessageBox.Show("Nome/Razão social invalido!", "NOME");
                resultado = false;
            }
            if ((String.IsNullOrEmpty(EDITCPF.Text) || EDITCPF.Text.All(char.IsNumber)) && (String.IsNullOrEmpty(EDITCNPJ.Text) || EDITCNPJ.Text.All(char.IsNumber)))
            {
                MessageBox.Show("O CNPJ ou o CPF deverá ser informado!", "NOME");
                resultado = false;
            }
            if (!String.IsNullOrEmpty(funcoes.ApenasNumeros(EDITCPF.Text)) && funcoes.ApenasNumeros(EDITCPF.Text) != null)
            {
                if (funcoes.validarCpf(funcoes.ApenasNumeros(EDITCPF.Text)) == false)
                {
                    MessageBox.Show("O CPF informado não é válido!", "CPF");
                    resultado = false;
                }
            }
            if (!String.IsNullOrEmpty(funcoes.ApenasNumeros(EDITCNPJ.Text)) && funcoes.ApenasNumeros(EDITCNPJ.Text) != null)
            {
                if (funcoes.ValidaCnpj(funcoes.ApenasNumeros(EDITCNPJ.Text)) == false)
                {
                    MessageBox.Show("O CNPJ informado não é válido!", "CNPJ");
                    resultado = false;
                }
            }
            if ((!String.IsNullOrEmpty(EDITEMAIL.Text)) && (funcoes.validarEmail(EDITEMAIL.Text) == false))
            {
                MessageBox.Show("Informe um EMAIL válido", "EMAIL");
                resultado = false;
            }
            if (String.IsNullOrEmpty(EDITCIDADE.Text) || EDITCIDADE.Text.All(char.IsNumber))
            {
                MessageBox.Show("A cidade deverá ser informada.", "CIDADE");
                resultado = false;
            }
            if (String.IsNullOrEmpty(EDITLOGRADOURO.Text) || EDITLOGRADOURO.Text.All(char.IsNumber))
            {
                MessageBox.Show("Informe um endereço", "ENDERECO");
                resultado = false;
            }
            if (String.IsNullOrEmpty(EDITNUMERO.Text))
            {
                MessageBox.Show("Informe um número do endereço", "NUMERO");
                resultado = false;
            }
            if (String.IsNullOrEmpty(EDITBAIRRO.Text))
            {
                MessageBox.Show("Informe um bairro", "BAIRRO");
                resultado = false;
            }
            if (String.IsNullOrEmpty(EDITCEP.Text))
            {
                MessageBox.Show("Informe um CEP", "CEP");
                resultado = false;
            }
            return(resultado);
        }