private void HabilitarCampos() { TxtNome.Enabled = true; TxtCPF.Enabled = true; TxtEndereco.Enabled = true; CbCargo.Enabled = true; TxtTelefone.Enabled = true; TxtNome.Focus(); }
private void TxtCodCliente_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (TxtCodCliente.Text == "") { TxtNome.Focus(); TxtCodCliente.Enabled = false; BtnDeletar.Enabled = false; BtnAlterar.Enabled = false; BtnCadastrar.Enabled = true; TxtCodCliente.Enabled = false; MessageBox.Show("Nenhum Código Digitado!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { conn.Open(); string cadSql = "SELECT * from Clientes inner join usuario on clientes.id_usuario=usuario.Id_usuario where Id_Cliente='" + TxtCodCliente.Text + "'"; SqlCommand comand = new SqlCommand(cadSql, conn); SqlDataReader ler = comand.ExecuteReader(); if (ler.Read() == true) { TxtNome.Text = ler["Nome"].ToString(); CboSexo.Text = ler["Sexo"].ToString(); TxtEndereco.Text = ler["Endereco"].ToString(); TxtBairro.Text = ler["Bairro"].ToString(); TxtCidade.Text = ler["Cidade"].ToString(); MktCep.Text = ler["Cep"].ToString(); CmbEstado.Text = ler["Estado"].ToString(); MktFoneFixo.Text = ler["FoneFixo"].ToString(); MkFoneComercial.Text = ler["FoneComercial"].ToString(); MktCelular.Text = ler["Celular"].ToString(); TxtRG.Text = ler["Rg"].ToString(); TxtEmail.Text = ler["Email"].ToString(); MktCPF.Text = ler["CPF"].ToString(); dataNasc.Text = ler["DataNascimento"].ToString(); CboCadPor.Text = ler["Usuario"].ToString(); DataCad.Text = ler["DataCad"].ToString(); TxtCodCliente.Enabled = false; BtnAlterar.Enabled = true; BtnDeletar.Enabled = true; CboCadPor.Enabled = false; } else { LimpaDados(); TxtCodCliente.Enabled = false; BtnAlterar.Enabled = false; BtnDeletar.Enabled = false; BtnCadastrar.Enabled = true; MessageBox.Show("Cadastro de Cliente não Encontrado!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); } conn.Close(); } } }
protected void btnNovo_Click(object sender, EventArgs e) { TxtNome.Text = ""; TxtEmail.Text = ""; TxtTelefone.Text = ""; TxtEndereco.Text = ""; TxtServico.Text = ""; IdH.Value = "0"; TxtNome.Focus(); }
private void BtnAlterar_Click(object sender, EventArgs e) { BtnIncluir.Enabled = true; BtnAlterar.Enabled = false; BtnExcluir.Enabled = false; HabilitaControles(true); TxtCodigo.Enabled = false; TxtNome.Focus(); incluir = false; }
private void Limpatela() { TxtDetalhes.Clear(); TxtNome.Clear(); TxtPrecoTotal.Clear(); TxtPrecoFornecedor.Clear(); TxtQuantidade.Clear(); TxtPorcentagemLucro.Clear(); TxtPorcentagemImposto.Clear(); }
private void HabilitarCampos() { TxtNome.Enabled = true; TxtDescricao.Enabled = true; TxtValor.Enabled = true; CbFornecedor.Enabled = true; TxtEstoque.Enabled = true; BtnImg.Enabled = true; TxtNome.Focus(); }
private bool ValidaGravar() { try { if (string.IsNullOrEmpty(TxtNome.Text)) { MessageBox.Show("Favor preencher o campo de Nome!", "Campo faltando", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); TxtNome.Focus(); return(false); } if (string.IsNullOrEmpty(txtCpf.Text)) { MessageBox.Show("Favor preencher o campo de CPF!", "Campo faltando", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCpf.Focus(); return(false); } if (ValidadorCpf.ValidaCpf(txtCpf.Text) == false) { MessageBox.Show("CPF Inválido : " + txtCpf.Text, "Campo faltando", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtCpf.Focus(); return(false); } if (string.IsNullOrEmpty(txtEmail.Text)) { MessageBox.Show("Favor preencher o campo de E-mail!", "Campo faltando", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtEmail.Focus(); return(false); } if (CmbPerfil.SelectedIndex == -1) { MessageBox.Show("Favor selecionar um perfil!", "Campo faltando", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); CmbPerfil.Focus(); return(false); } if (txtSenha.Text != txtConfirma.Text) { MessageBox.Show("As senhas não são iguais!", "Campo faltando", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); txtSenha.Focus(); return(false); } return(true); } catch (Exception e) { MessageBox.Show("Erro - ValidaGravar " + e.Message, "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } }
private void BtnNovoL_Click(object sender, EventArgs e) { TxtNome.Enabled = true; TxtAutor.Enabled = true; TxtEditora.Enabled = true; ResetaForm(); novoRegistro = true; MostraBotoes(true); livro = new Livro(); TxtNome.Focus(); }
private void Reset() { BtnAlterar.Enabled = false; BtnExcluir.Enabled = false; btnGravar.Enabled = true; txtMatricula.Clear(); TxtNome.Clear(); TxtMedia.Text = "0,00"; TxtDiasBase.Text = "30"; MktAdmissao.Clear(); MktDemissao.Clear(); }
private bool ValidaCampos() { if (CboSituacao.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboSituacao.Select(); return(false); } if (TxtNome.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); TxtNome.Select(); return(false); } if (CboIdade.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboIdade.Select(); return(false); } if (CboTipoPet.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboTipoPet.Select(); return(false); } if (CboRaca.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboRaca.Select(); return(false); } if (CboSexo.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboSexo.Select(); return(false); } if (CboPorte.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboPorte.Select(); return(false); } if (CboCastrado.Text == string.Empty) { MessageBox.Show("o campo deve ser preenchido", "Sistema Friend of the Owner", MessageBoxButtons.OK, MessageBoxIcon.Warning); CboCastrado.Select(); return(false); } return(true); }
private void limparObjetos() { TxtCodigo.Clear(); TxtNome.Clear(); TxtRg.Clear(); MtbCelular.Clear(); MtbCpf.Clear(); MtbDtNasc.Clear(); MtbFone.Clear(); CbCargo.Text = string.Empty; GC.Collect(); TxtNome.Focus(); }
public void LimpaDados() { TxtIdUsuario.Clear(); TxtNome.Clear(); CboTipoUsuario.Text = "Selecione"; TxtEmail.Clear(); TxtUsuario.Clear(); TxtSenha.Clear(); TxtRepeteSenha.Clear(); CboCadPor.Text = "Selecione"; BtnCadastrar.Enabled = true; CboCadPor.Enabled = true; }
private void LimparFormulario() { TxtNome.Clear(); TxtIdade.Clear(); CmbCategoria.SelectedIndex = -1; TxtCpf.Clear(); TxtDtNasc.Clear(); TxtCnh.Clear(); TxtEmail.Clear(); CmbGenero.SelectedIndex = -1; TxtTelefone.Clear(); TxtCpf.Focus(); }
private void btnCancelarCadastroCliente(object sender, RoutedEventArgs e) { TxtNome.Clear(); TxtIdade.Clear(); TxtCpf.Clear(); TxtEmail.Clear(); TxtCnh.Clear(); TxtTelefone.Clear(); TxtCep.Clear(); TxtSalario.Clear(); CmbGenero.SelectedIndex = -1; TxtDtNasc.Clear(); TxtCpf.Focus(); }
private void btnCancelarCadastroFuncionario(object sender, RoutedEventArgs e) { TxtNome.Clear(); TxtIdade.Clear(); CmbCategoria.SelectedIndex = -1; TxtCpf.Clear(); TxtDtNasc.Clear(); TxtCnh.Clear(); TxtEmail.Clear(); CmbGenero.SelectedIndex = -1; TxtTelefone.Clear(); TxtCpf.Focus(); }
private void BtnNovo_Click(object sender, EventArgs e) { novo = true; BtnPrimeiro.Enabled = false; BtnAnterior.Enabled = false; BtnProximo.Enabled = false; BtnUltimo.Enabled = false; BtnGravar.Enabled = true; TxtCodigo.Text = (ultimoregistro + 1).ToString(); TxtNome.Text = ""; TxtEndereco.Text = ""; MskTelefone.Text = ""; DtpDataCadastro.Text = ""; TxtNome.Focus(); }
private void BtnExcluir_Click(object sender, EventArgs e) { if (TxtNome.Text != string.Empty) { conexaoBanco.executaSql("DELETE FROM FUNCIONARIO WHERE CODIGO = " + TxtCodigo.Text); MessageBox.Show("Dados excluídos com sucesso!", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); atualizaDtGrid(); limparObjetos(); } else { MessageBox.Show("Escolha um registro antes de fazer uma exclusão.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtNome.Focus(); } }
private void TxtCodigo_KeyPress(object sender, KeyPressEventArgs e) { if (!char.IsDigit(e.KeyChar)) { e.Handled = true; } if (e.KeyChar == (char)Keys.Back) { e.Handled = false; } if (e.KeyChar == 13) { TxtNome.Focus(); } }
private void TxtIdUsuario_KeyUp_1(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (TxtIdUsuario.Text == "") { TxtNome.Focus(); TxtIdUsuario.Enabled = false; BtnDeletar.Enabled = false; BtnAlterar.Enabled = false; BtnCadastrar.Enabled = true; MessageBox.Show("Nenhum Código Digitado!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { string cadSql = "SELECT * from Usuario where Id_Usuario='" + TxtIdUsuario.Text + "'"; SqlCommand comand = new SqlCommand(cadSql, conn); conn.Open(); SqlDataReader ler = comand.ExecuteReader(); if (ler.Read() == true) { TxtNome.Text = ler["Nome"].ToString(); TxtEmail.Text = ler["Email"].ToString(); TxtUsuario.Text = ler["Usuario"].ToString(); TxtSenha.Text = ler["Senha"].ToString(); CboTipoUsuario.Text = ler["Tipo"].ToString(); CboCadPor.Text = ler["Id_User"].ToString(); DataCad.Text = ler["DataCad"].ToString(); TxtIdUsuario.Enabled = false; BtnAlterar.Enabled = true; BtnDeletar.Enabled = true; BtnCadastrar.Enabled = false; CboCadPor.Enabled = false; } else { LimpaDados(); TxtIdUsuario.Enabled = false; BtnAlterar.Enabled = false; BtnDeletar.Enabled = false; CboCadPor.Enabled = true; MessageBox.Show("Cadastro de Usuário não Encontrado!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); } conn.Close(); } } }
private void Button2_Click(object sender, EventArgs e) { this.ActiveControl = null; var a = TxtNome.Text; var b = TxtEmail.Text; var c = TxtSenhaEmail.Text; var d = TxtUsuarioInternet.Text; var f = TxtSenhaInternet.Text; var g = TxtUserComputador.Text; var i = TxtSenhaComputador.Text; if (TxtNome.TextLength < 4 || TxtEmail.TextLength < 10 || TxtSenhaEmail.TextLength < 8 || TxtUsuarioInternet.TextLength < 7 || TxtSenhaInternet.TextLength < 8 || TxtUserComputador.TextLength < 6 || TxtSenhaComputador.TextLength < 8) { MessageBox.Show("O Cadastro não foi efetuado! Os dados fornecidos não possuem a quantidade mínima de caracteres exígidos.", "CADASTRO NÃO EFETUADO", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } else { //STRING SUPREMA - FUNCIONA,ESSE MODELO DE STRING string parametros = "Server=localhost;Database=MRDB;Uid=root;Pwd= ;SslMode=none;"; string sql = "INSERT INTO mrdb_users_cadastro VALUES(" + "'" + a + "'" + "," + "'" + b + "'" + "," + "'" + c + "'" + "," + "'" + d + "'" + "," + "'" + f + "'" + "," + "'" + g + "'" + "," + "'" + i + "')"; MySqlConnection connection = new MySqlConnection(parametros); MySqlCommand comando = new MySqlCommand(sql, connection); connection.Open(); MySqlDataReader reader = comando.ExecuteReader(); reader.Read(); connection.Dispose(); MessageBox.Show(String.Format("{0}:FOI CADASTRADO!", a), "CADASTRO EFETUADO COM SUCESSO", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); TxtNome.Clear(); TxtEmail.Clear(); TxtSenhaEmail.Clear(); TxtUsuarioInternet.Clear(); TxtSenhaInternet.Clear(); TxtUserComputador.Clear(); TxtSenhaComputador.Clear(); } }
private void BtnIncluir_Click(object sender, EventArgs e) { if (TxtNome.Text != string.Empty) { setCampos(); conexaoBanco.executaSql("INSERT INTO FUNCIONARIO(" + campos() + ") VALUES(" + valoresInsert() + ")"); MessageBox.Show("Dados inseridos com sucesso", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); atualizaDtGrid(); limparObjetos(); } else { MessageBox.Show("Campo nome não pode estar vazio.", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtNome.Focus(); } }
private void BtnExcluir_Click(object sender, EventArgs e) { if (TxtCodigo.Text != "") { conexaoBanco.executaSql("DELETE FROM FUNCAO WHERE Codigo = " + TxtCodigo.Text + ""); MessageBox.Show("Exclusão feita com sucesso!", "Informção", MessageBoxButtons.OK, MessageBoxIcon.Information); geralVerificacoes.redimensionaDtGrid(DtGridFuncao); atualizarGrid(); limparObjetos(); TxtNome.Focus(); } else { MessageBox.Show("Pesquise uma função antes de fazer uma exclusão.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtNome.Focus(); } }
public void LimpaVenda() { TxtCodVenda.Clear(); TxtNome.Clear(); TxtCodCliente.Clear(); CboFormaPag.Text = "Selecione"; dataGridView1.Rows.Clear(); listBox1.Enabled = false; listBox2.Enabled = false; CboFormaPag.Enabled = false; TxtQtde.Enabled = false; BtnAddProduto.Enabled = false; BtnRemoveItem.Enabled = false; LblValorTotal.Text = ""; listBox1.Items.Clear(); listBox2.Items.Clear(); BtnFimCompra.Enabled = false; }
private void BtnAlterar_Click(object sender, EventArgs e) { if (TxtCodigo.Text != "") { conexaoBanco.executaSql("UPDATE FUNCAO SET NOME = '" + TxtNome.Text + "', " + "CBO = " + TxtCbo.Text + ", " + "SALARIO = " + TxtSalario.Text + " WHERE CODIGO = " + TxtCodigo.Text); MessageBox.Show("Alteração feita com sucesso!", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); atualizarGrid(); limparObjetos(); TxtNome.Focus(); } else { MessageBox.Show("Pesquise uma função antes de fazer uma alteração.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtNome.Focus(); } }
private void Inicializar() { try { if (AlunoVm == null) { AlunoVm = new AlunoVm(); } TxtNome.Focus(); DataContext = AlunoVm; } catch (Exception ex) { MessageBox.Show($"Falha para inicializar a tela de cadastro. {ex.Message}", "Erro", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Btnmodifica_Click(object sender, EventArgs e) { OleDbConnection conn = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Application.StartupPath + @"\Locadora.mdb"); try { conn.Open(); String SQL; SQL = "update clientes set nome='" + TxtNome.Text + "',"; SQL += "CPF='" + TxtCpf.Text + "',"; SQL += "Rg='" + TxtRG.Text + "',"; SQL += "DataNasc='" + TxtNasc.Text + "',"; SQL += "Telefone='" + TxtTel.Text + "',"; SQL += "Celular='" + TxtCel.Text + "',"; SQL += "Email='" + TxtEmail.Text + "',"; SQL += "Endereco='" + TxtEndereco.Text + "',"; SQL += "Bairro='" + TxtBairro.Text + "',"; SQL += "Complemento='" + TxtComplem.Text + "' "; SQL += "where Codigo=" + Codigo; OleDbCommand cmd = new OleDbCommand(SQL, conn); MetroMessageBox.Show(this, "Dados alterados com sucesso", "Dados cadastrados", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); cmd.ExecuteNonQuery(); conn.Close(); TxtNome.Clear(); TxtCpf.Clear(); TxtRG.Clear(); TxtNasc.Clear(); TxtTel.Clear(); TxtCel.Clear(); TxtEmail.Clear(); TxtEndereco.Clear(); TxtBairro.Clear(); TxtComplem.Clear(); TxtCnh.Clear(); } catch (Exception erro) { MessageBox.Show(erro.Message); } }
private void BtnAlterar_Click(object sender, EventArgs e) { if (TxtIdUsuario.Text == "") { MessageBox.Show("Digite ID Válido!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtIdUsuario.Clear(); TxtIdUsuario.Focus(); } else if (TxtSenha.Text != TxtRepeteSenha.Text) { MessageBox.Show("Senhas Não Conferem! Digite Novamente", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); TxtSenha.Text = ""; TxtRepeteSenha.Text = ""; TxtSenha.Focus(); } else { try { conn.Open(); SqlCommand comando = new SqlCommand(@"UPDATE Usuario SET Nome='" + TxtNome.Text + "',Email='" + TxtEmail.Text + "',Usuario='" + TxtUsuario.Text + "',Senha='" + TxtSenha.Text + "',Tipo='" + CboTipoUsuario.Text + "' where (Id_Usuario='" + TxtIdUsuario.Text + "')", conn) { CommandType = System.Data.CommandType.Text }; comando.ExecuteNonQuery(); LimpaDados(); TxtIdUsuario.Clear(); MessageBox.Show("Usuário Atualizado Com Sucesso!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("Erro ao Atualizar Usuário!", "SIG", MessageBoxButtons.OK, MessageBoxIcon.Error); } } conn.Close(); LimpaDados(); TxtIdUsuario.Enabled = false; BtnCadastrar.Enabled = true; BtnAlterar.Enabled = false; BtnDeletar.Enabled = false; TxtNome.Focus(); }
private void BtnIncluir_Click(object sender, EventArgs e) { if (TxtNome.Text != string.Empty) { setCampos(); conexaoBanco.executaSql("INSERT INTO FUNCAO(" + camposInsert() + ") VALUES(" + valoresInsert() + ")"); MessageBox.Show("Dados inseridos com sucesso!", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); atualizarGrid(); DtGridFuncao.Refresh(); limparObjetos(); TxtNome.Focus(); } else { MessageBox.Show("O campo Nome está em branco.\n " + "Por favor informe um nome antes de inserir um novo registro.", "Sistema", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtNome.Focus(); } }
public void LimpaDados() { TxtCodCliente.Clear(); TxtNome.Clear(); CboSexo.Text = "Selecione"; TxtEndereco.Clear(); TxtBairro.Clear(); TxtCidade.Clear(); MktCep.Clear(); CmbEstado.Text = "Selecione"; MktFoneFixo.Clear(); MkFoneComercial.Clear(); MktCelular.Clear(); TxtRG.Clear(); TxtEmail.Clear(); MktCPF.Clear(); dataNasc.Text = ""; CboCadPor.Text = "Selecione"; CboCadPor.Enabled = true; }
private void BtnRecuperarLogin_Click(object sender, EventArgs e) { if (TxtNome.Text == "") { MessageBox.Show("Preencher Nome Completo!"); TxtNome.Focus(); } else if (TxtUsuario.Text == "") { MessageBox.Show("Preencher Usuário!"); TxtUsuario.Focus(); } else if (TxtEmail.Text == "") { MessageBox.Show("Preencher E-mail!"); TxtEmail.Focus(); } else { } }