void BtnConfirmaClick(object sender, EventArgs e) { string msg = ""; bool result; string codigo = edtCodigo.Text.Trim(); if (acao == 'I') { acao = 'i'; return; } if (acao == 'A') { acao = 'a'; return; } string ativo = ckbAtivo.Checked ? "S" : "N"; if (acao == 'i') { result = contatos.Inclui(parceiro, codigo, edtDescricao.Text, FONE.TiraEdicao(edtFone1.Text), FONE.TiraEdicao(edtFone2.Text), CELULAR.TiraEdicao(edtCelular.Text), edtEmail.Text, edtPapel.Text, dtpNascimento.Checked, dtpNascimento.Value, ativo, ref msg); } else { result = contatos.Altera(parceiro, codigo, edtDescricao.Text, FONE.TiraEdicao(edtFone1.Text), FONE.TiraEdicao(edtFone2.Text), CELULAR.TiraEdicao(edtCelular.Text), edtEmail.Text, edtPapel.Text, dtpNascimento.Checked, dtpNascimento.Value, ativo, ref msg); } if (!result) { if (acao == 'i') { MessageBox.Show(codigo + "\n" + msg, "Erro na inclusão do contato", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(codigo + "\n" + msg, "Erro na alteração do contato", MessageBoxButtons.OK, MessageBoxIcon.Error); } } string where = "where COD_PARCEIRO='" + parceiro + "'"; this.Cursor = Cursors.WaitCursor; contatos.Carrega(dgvCadastro, where); this.Cursor = Cursors.Default; int selecionado = Procura(codigo, true); if (selecionado >= 0) { dgvCadastro.Rows[selecionado].Cells[0].Selected = true; AtualizaDados(selecionado); AtualizaDadosLocal(selecionado); } DesabilitaEdicao(); SetaEdicaoLocal(false); }
void EdtCelularEnter(object sender, EventArgs e) { edtCelular.Text = CELULAR.TiraEdicao(edtCelular.Text); }
void EdtFone3Enter(object sender, EventArgs e) { edtFone3.Text = CELULAR.TiraEdicao(edtFone3.Text); }
void BtnConfirmaClick(object sender, EventArgs e) { string msg = ""; string cpf_cnpj; bool result; string codigo = edtCodigo.Text.Trim(); if (acao == 'I') { acao = 'i'; return; } if (acao == 'A') { acao = 'a'; return; } if (cbxEstados.Text.Trim().CompareTo("") != 0) { if (!cbxEstados.Items.Contains(cbxEstados.Text.Trim())) { MessageBox.Show(cbxEstados.Text, "Estado não Cadastrado", MessageBoxButtons.OK, MessageBoxIcon.Warning); cbxEstados.Focus(); return; } } if (!ckbCliente.Checked && !ckbFornecedor.Checked && !ckbConsultor.Checked) { MessageBox.Show("Tipo: cliente/fornecedor/consultor", "Campo Obrigatório", MessageBoxButtons.OK, MessageBoxIcon.Warning); ckbCliente.Focus(); return; } string cliente = (ckbCliente.Checked) ? "S" : "N"; string fornecedor = (ckbFornecedor.Checked) ? "S" : "N"; string consultor = (ckbConsultor.Checked) ? "S" : "N"; string pessoa = rbtFisica.Checked ? "F" : "J"; string ativo = ckbAtivo.Checked ? "S" : "N"; if (edtCNPJ.MaxLength == 14) { cpf_cnpj = CNPJ.TiraEdicao(edtCNPJ.Text); } else { cpf_cnpj = CPF.TiraEdicao(edtCNPJ.Text); } if (!cpf_cnpj.Replace("0", "").Equals("")) { string nomeCpfCnpj = parceiros.ProcuraPorCpfCnpj(cpf_cnpj); if (nomeCpfCnpj != null) { if ((acao != 'a') || (nomeAlteracao == null) || !nomeAlteracao.Equals(nomeCpfCnpj.Trim())) { MessageBox.Show("Já existe um parceiro com esse cpf/cnpj\r\n" + nomeCpfCnpj, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } } if (acao == 'i') { result = parceiros.Inclui(codigo, edtDescricao.Text, cliente, fornecedor, consultor, pessoa, cpf_cnpj, edtInsEst.Text, edtInsMun.Text, edtLogradouro.Text, edtNumero.Text, edtComplemento.Text, edtBairro.Text, edtCidade.Text, cbxEstados.Text, CEP.TiraEdicao(edtCEP.Text), edtLogradouroEntrega.Text, edtNumeroEntrega.Text, edtComplementoEntrega.Text, edtBairroEntrega.Text, edtCidadeEntrega.Text, cbxEstadosEntrega.Text, CEP.TiraEdicao(edtCEPEntrega.Text), edtLogradouroCobranca.Text, edtNumeroCobranca.Text, edtComplementoCobranca.Text, edtBairroCobranca.Text, edtCidadeCobranca.Text, cbxEstadosCobranca.Text, CEP.TiraEdicao(edtCEPCobranca.Text), FONE.TiraEdicao(edtFone1.Text), FONE.TiraEdicao(edtFone2.Text), CELULAR.TiraEdicao(edtCelular.Text), FONE.TiraEdicao(edtFAX.Text), edtEmail.Text, dtpNascimento.Checked, dtpNascimento.Value, ativo, Globais.StrToInt(edtPedido.Text), ref msg); } else { result = parceiros.Altera(codigo, edtDescricao.Text, cliente, fornecedor, consultor, pessoa, cpf_cnpj, edtInsEst.Text, edtInsMun.Text, edtLogradouro.Text, edtNumero.Text, edtComplemento.Text, edtBairro.Text, edtCidade.Text, cbxEstados.Text, CEP.TiraEdicao(edtCEP.Text), edtLogradouroEntrega.Text, edtNumeroEntrega.Text, edtComplementoEntrega.Text, edtBairroEntrega.Text, edtCidadeEntrega.Text, cbxEstadosEntrega.Text, CEP.TiraEdicao(edtCEPEntrega.Text), edtLogradouroCobranca.Text, edtNumeroCobranca.Text, edtComplementoCobranca.Text, edtBairroCobranca.Text, edtCidadeCobranca.Text, cbxEstadosCobranca.Text, CEP.TiraEdicao(edtCEPCobranca.Text), FONE.TiraEdicao(edtFone1.Text), FONE.TiraEdicao(edtFone2.Text), CELULAR.TiraEdicao(edtCelular.Text), FONE.TiraEdicao(edtFAX.Text), edtEmail.Text, dtpNascimento.Checked, dtpNascimento.Value, ativo, Globais.StrToInt(edtPedido.Text), ref msg); } if (!result) { if (acao == 'i') { MessageBox.Show(codigo + "\n" + msg, "Erro na inclusão do parceiro", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(codigo + "\n" + msg, "Erro na alteração do parceiro", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this.Cursor = Cursors.WaitCursor; parceiros.Carrega(dgvCadastro, where); this.Cursor = Cursors.Default; int selecionado = Procura(codigo, true); if (selecionado >= 0) { dgvCadastro.Rows[selecionado].Cells[0].Selected = true; AtualizaDados(selecionado); AtualizaDadosLocal(selecionado); } DesabilitaEdicao(); SetaEdicaoLocal(false); }
void BtnConfirmaClick(object sender, EventArgs e) { string msg = ""; bool result; string codigo = edtCodigo.Text.Trim(); if (acao == 'I') { acao = 'i'; return; } if (acao == 'A') { acao = 'a'; return; } string idt_ativo = (ckbAtivo.Checked ? "S" : "N"); if (acao == 'i') { result = funcionarios.Inclui(codigo, edtDescricao.Text, edtLogradouro.Text, edtNumero.Text, edtComplemento.Text, edtBairro.Text, edtCidade.Text, cbxEstados.Text, CEP.TiraEdicao(edtCEP.Text), FONE.TiraEdicao(edtFone1.Text), FONE.TiraEdicao(edtFone2.Text), CELULAR.TiraEdicao(edtFone3.Text), cbxCargos.Text, edtEmail.Text, dtpNascimento.Checked, dtpNascimento.Value, edtIdentidade.Text, CPF.TiraEdicao(edtCPF.Text), idt_ativo, ref msg); } else { result = funcionarios.Altera(codigo, edtDescricao.Text, edtLogradouro.Text, edtNumero.Text, edtComplemento.Text, edtBairro.Text, edtCidade.Text, cbxEstados.Text, CEP.TiraEdicao(edtCEP.Text), FONE.TiraEdicao(edtFone1.Text), FONE.TiraEdicao(edtFone2.Text), CELULAR.TiraEdicao(edtFone3.Text), cbxCargos.Text, edtEmail.Text, dtpNascimento.Checked, dtpNascimento.Value, edtIdentidade.Text, CPF.TiraEdicao(edtCPF.Text), idt_ativo, ref msg); } if (!result) { if (acao == 'i') { MessageBox.Show(codigo + "\n" + msg, "Erro na inclusão do funcionário", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(codigo + "\n" + msg, "Erro na alteração do funcionário", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this.Cursor = Cursors.WaitCursor; funcionarios.Carrega(dgvCadastro); this.Cursor = Cursors.Default; int selecionado = Procura(codigo, true); if (selecionado >= 0) { dgvCadastro.Rows[selecionado].Cells[0].Selected = true; AtualizaDados(selecionado); AtualizaDadosLocal(selecionado); } DesabilitaEdicao(); SetaEdicaoLocal(false); }