private void ResetaForm() { txtIdC.Clear(); txtNomeC.Clear(); txtEmail.Clear(); TxtCpf.Clear(); txtNomeC.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 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 buttonLimpa_Click(object sender, EventArgs e) { txtNome.Clear(); TxtCpf.Clear(); txtEmail.Clear(); txtSalario.Clear(); txtTelefone.Clear(); txtEndereco.Clear(); txtNumero.Clear(); txtCep.Clear(); txtCidade.Clear(); txtBairro.Clear(); dtDataContratacao.Value = DateTime.Now; dtDataNascimento.Value = DateTime.Now; }
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 button1_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 = "insert into Funcionarios(Nome,CPF,Rg,DataNasc,Telefone,Celular,Email,Endereco,Bairro,Complemento,DataContrato,SalarioHora) Values('" + TxtNome.Text + "','" + TxtCpf.Text + "','" + TxtRG.Text + "','" + TxtNasc.Text + "','" + TxtTel.Text + "','" + TxtCel.Text + "','" + TxtEmail.Text + "','" + TxtEndereco.Text + "','" + TxtBairro.Text + "','" + TxtComplem.Text + "',+'" + TxtContrato2.Text + "','" + TxtSala + "')"; OleDbCommand cmd = new OleDbCommand(SQL, conn); MetroMessageBox.Show(this, "Cadastro realizado 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(); TxtSala.Clear(); } catch (Exception erro) { MessageBox.Show(erro.Message); } }
private void btnEntrar_Click(object sender, EventArgs e) { try { string strConexao = "Data Source = localhost; Initial Catalog=INVESTMENTNOW; Integrated Security=True"; string salario = txtSalario.Text.Replace(",", "."); TxtCpf.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; var cpfSemMascara = TxtCpf.Text; txtCep.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; var cepSemMascara = txtCep.Text; txtTelefone.TextMaskFormat = MaskFormat.ExcludePromptAndLiterals; var telefoneSemMascara = txtTelefone.Text; DateTime atual = DateTime.Now; var aniversario = dtDataNascimento.Value; var idade = atual.Year - aniversario.Year; if (idade < 18) { dtDataNascimento.Focus(); MessageBox.Show("Somente maiores de idade"); return; } if (dtDataContratacao.Value > atual) { dtDataContratacao.Focus(); MessageBox.Show("Data da contratação não pode ser maior que a atual"); return; } string cmdInsert = "INSERT INTO Funcionario(nome, sexo, data_nasc, data_admissao, email, cpf, salario, celular, cep, uf, cidade, bairro, logradouro, num_residencia, status_func)" + "VALUES ('" + txtNome.Text + "', '" + cboGenero.Text + "', '" + dtDataNascimento.Value + "', '" + dtDataContratacao.Value + "', '" + txtEmail.Text + "', '" + cpfSemMascara + "', '" + salario + "', '" + telefoneSemMascara + "', '" + cepSemMascara + "', '" + cbUf.Text + "','" + txtCidade.Text + "', '" + txtBairro.Text + "', '" + txtEndereco.Text + "', '" + txtNumero.Text + "', '" + 1 + "')"; SqlConnection con = new SqlConnection(strConexao); SqlCommand sqlCommand = new SqlCommand(cmdInsert, con); con.Open(); sqlCommand.ExecuteNonQuery(); con.Close(); lblConfirma.Visible = true; txtNome.Clear(); TxtCpf.Clear(); txtEmail.Clear(); txtSalario.Clear(); txtTelefone.Clear(); txtEndereco.Clear(); txtNumero.Clear(); txtCep.Clear(); txtCidade.Clear(); txtBairro.Clear(); dtDataContratacao.Value = DateTime.Now; dtDataNascimento.Value = DateTime.Now; } catch (Exception) { MessageBox.Show("Verifique todos os campos"); } }
private void LimpaCampos() { TxtCpf.Clear(); TxtNome.Clear(); }