private void txtCPF_Leave(object sender, EventArgs e) { txtCPF.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; try { if (txtCPF.Text.Length > 0 && txtCPF.Text.Length < 11) { ListaErro.RetornaErro(42); txtCPF.Clear(); txtCPF.Focus(); } else if (txtCPF.Text.Length == 11 && !Funcoes.ValidaCPF(txtCPF.Text)) { ListaErro.RetornaErro(43); txtCPF.Clear(); txtCPF.Focus(); } } catch (Exception) { ListaErro.RetornaErro(43); txtCPF.Clear(); txtCPF.Focus(); } }
private void Configuracoes_Banco_FormClosing(object sender, FormClosingEventArgs e) { if (Sistema.ProgramaDesativado) { ListaErro.RetornaErro(14); Sistema.ProgramaDesativado = false; } }
private void btnImprimir_Click(object sender, EventArgs e) { if (pdConfigImpressao.ShowDialog() == DialogResult.OK) { try { pPreview.ShowDialog(); } catch (ArgumentOutOfRangeException) { ListaErro.RetornaErro(24); } } }
private void btnApagar_Click(object sender, EventArgs e) { if (ListaMensagens.RetornaDialogo(08) == DialogResult.Yes) { if (Sistema.IDUsuarioLogado != 1 && Sistema.IDUsuarioLogado != 2) { string resposta = Interaction.InputBox(ListaMensagens.RetornaInputBox(09)[0], ListaMensagens.RetornaInputBox(09)[1], ""); if (resposta == Sistema.SenhaADM) { try { Cliente.ApagarCliente(); } catch (Exception) { ListaErro.RetornaErro(37); return; } finally { ListaMensagens.RetornaMensagem(10, MessageBoxIcon.Information); this.Close(); } } } else { if (ListaMensagens.RetornaDialogo(26) == DialogResult.Yes) { try { Cliente.ApagarCliente(); } catch (Exception) { ListaErro.RetornaErro(37); return; } finally { ListaMensagens.RetornaMensagem(10, MessageBoxIcon.Information); this.Close(); } } } } }
private void LocalizarCEP() { txtCep.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; if (txtCep.Text.Length > 0 && txtCep.Text.Length < 8) { ListaErro.RetornaErro(44); txtCep.Clear(); txtCep.Focus(); } else if (txtCep.Text.Length == 8) { try { CEP cep = new CEP(txtCep.Text); if (cep.cep != null) { txtEstado.Text = cep.uf; txtCidade.Text = cep.localidade; txtBairro.Text = cep.bairro; txtEndereco.Text = cep.logradouro; txtComplemento.Text = cep.complemento; txtNumero.Focus(); } else { if (ListaMensagens.RetornaDialogo(25) == DialogResult.Yes) { txtCep.Clear(); txtCep.Focus(); } else { txtCep.Clear(); } } } catch (KeyNotFoundException) { ListaErro.RetornaErro(46); txtCep.Clear(); txtCep.Focus(); } } }
private void btnEntrar_Click(object sender, EventArgs e) { if (txtUser.Text != "") { if (!string.IsNullOrEmpty(txtPwd.Text.Replace(" ", ""))) { if (txtPwd.Text.Length > 3) { if (Sistema.VerificaLogin(txtUser.Text, txtPwd.Text)) { string comando = "select id from tbl_usuarios where user = '******';"; Sistema.IDUsuarioLogado = int.Parse(Sistema.ConsultaSimples(comando)); Log.Login(); Hide(); ShowInTaskbar = false; TInicial telaInicial = new TInicial(); telaInicial.ShowDialog(); } else { txtPwd.Clear(); txtUser.Focus(); } } else { ListaErro.RetornaErro(27); txtPwd.Clear(); txtPwd.Focus(); } } else { ListaErro.RetornaErro(26); txtPwd.Focus(); } } else { ListaErro.RetornaErro(25); txtUser.Focus(); } }
private void btnAlterar_Click(object sender, EventArgs e) { if (txtNome.Text.Length < 3) { ListaErro.RetornaErro(34); tabPageDadosCadastrais.Show(); txtNome.Focus(); } else { Cliente.Nome = txtNome.Text; Cliente.RazaoSocial = txtRazaoSocial.Text; Cliente.Telefone = txtTelefoneComercial.Text; Cliente.Contato = txtContato.Text; Cliente.Setor = txtSetor.Text; Cliente.CPF = txtCPF.Text; Cliente.RG = txtRG.Text; Cliente.CNPJ = txtCNPJ.Text; Cliente.InscricaoEstadual = txtInscEstadual.Text; Cliente.InscricaoMunicipal = txtInscMunicipal.Text; Cliente.Site = txtSite.Text; Cliente.Email = txtEmail.Text; Cliente.Endereco = txtEndereco.Text; Cliente.Numero = txtNumero.Text; Cliente.Bairro = txtBairro.Text; Cliente.Cidade = txtCidade.Text; Cliente.Estado = txtEstado.Text; Cliente.CEP = txtCep.Text; Cliente.Complemento = txtComplemento.Text; Cliente.PontoReferencia = txtPontoReferencia.Text; Cliente.Obs = txtOBS.Text; Cliente.Contrato = cmbContrato.SelectedIndex + 1; Cliente.AtualizarCliente(); } }
private void btnCadastrar_Click(object sender, EventArgs e) { if (txtNome.Text.Length < 3) { ListaErro.RetornaErro(34); tabPageDadosCadastrais.Show(); txtNome.Focus(); } else { Cliente.Contrato = cmbContrato.SelectedIndex + 1; Cliente.DataCadastro = dtpDataCadastro.Value.ToString("yyyy-MM-dd"); Cliente.Nome = txtNome.Text; Cliente.RazaoSocial = txtRazaoSocial.Text; Cliente.Telefone = txtTelefoneComercial.Text; Cliente.Contato = txtContato.Text; Cliente.Setor = txtSetor.Text; Cliente.CPF = txtCPF.Text; Cliente.RG = txtRG.Text; Cliente.CNPJ = txtCNPJ.Text; Cliente.InscricaoEstadual = txtInscEstadual.Text; Cliente.InscricaoMunicipal = txtInscMunicipal.Text; Cliente.Site = txtSite.Text; Cliente.Email = txtEmail.Text; Cliente.Endereco = txtEndereco.Text; Cliente.Numero = txtNumero.Text; Cliente.Bairro = txtBairro.Text; Cliente.Cidade = txtCidade.Text; Cliente.Estado = txtEstado.Text; Cliente.CEP = txtCep.Text; Cliente.Complemento = txtComplemento.Text; Cliente.PontoReferencia = txtPontoReferencia.Text; Cliente.Obs = txtOBS.Text; if (Cliente.CadastrarCliente()) { if (ListaMensagens.RetornaDialogo(12) == DialogResult.Yes) { LimpaCampos(); tabPageDadosCadastrais.Select(); tabPageDadosCadastrais.Show(); txtNome.Focus(); btnSair.Text = "Cancelar"; } else { btnCadastrar.Enabled = false; btnImprimir.Enabled = true; btnAlterar.Enabled = true; btnApagar.Enabled = true; txtCodigo.Text = Cliente.ID.ToString(); btnSair.Text = "Sair"; Cliente.NovoCadastro = false; } } } }