public Boolean verificaLoginEmpresa(String CNPJ, String Senha) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getconnectionString(); String query = "CALL logaEmpresa(?cnpj, ?Senha);"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?cnpj", CNPJ); command.Parameters.AddWithValue("?Senha", Senha); MySqlDataReader MySqlDR = command.ExecuteReader(); return(MySqlDR.Read()); } catch (Exception ex) { MessageBox.Show("Erro: " + ex, "Ocorreu um erro", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } finally { con.Close(); } }
public void cadastraCandidato(string CPF, string NOME, string IDADE, string CURRICULO, string SENHA) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getconnectionString(); string query = "CALL cadastraCandidato(?CPF, ?NOME, ?IDADE, ?CURRICULO, ?SENHA);"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?CPF", CPF); command.Parameters.AddWithValue("?NOME", NOME); command.Parameters.AddWithValue("?IDADE", IDADE); command.Parameters.AddWithValue("?CURRICULO", CURRICULO); command.Parameters.AddWithValue("?SENHA", SENHA); command.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } finally { con.Close(); MessageBox.Show("Cadastro efetuado com sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void cadastraEmpresa(string CNPJ, string NOME, string ENDERECO, string SENHA) { con = new MySqlConnection(); connection = new Connection.Connection(); con.ConnectionString = connection.getconnectionString(); string query = "CALL cadastraEmpresa(?CNPJ, ?NOME, ?ENDERECO, ?SENHA)"; try { con.Open(); MySqlCommand command = new MySqlCommand(query, con); command.Parameters.AddWithValue("?CNPJ", CNPJ); command.Parameters.AddWithValue("?NOME", NOME); command.Parameters.AddWithValue("?ENDERECO", ENDERECO); command.Parameters.AddWithValue("?SENHA", SENHA); command.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } finally { con.Close(); MessageBox.Show("Cadastro efetuado com sucesso!", "Sucesso!", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void carregarDados() { connection = new Connection.Connection(); dataGridView1.DataSource = null; dataGridView1.Rows.Clear(); dataGridView1.Refresh(); string CNPJ = lblEmpresaID.Text; string connectionString = connection.getconnectionString(); string query = "CALL candidaturasRecebidas(?CNPJ);"; using (MySqlConnection con = new MySqlConnection(connectionString)) { using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, con)) { MySqlCommand command = new MySqlCommand(query, con); command.Parameters.Add("?CNPJ", (MySqlDbType)SqlDbType.BigInt); command.Parameters["?CNPJ"].Value = CNPJ; adapter.SelectCommand = command; adapter.InsertCommand = command; try { DataTable dataTable = new DataTable(); adapter.Fill(dataTable); for (int index = 0; index < dataTable.Rows.Count; index++) { dataGridView1.Rows.Add( dataTable.Rows[index][0], dataTable.Rows[index][1], dataTable.Rows[index][2], dataTable.Rows[index][3], dataTable.Rows[index][4], dataTable.Rows[index][5] ); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } } } }
private void carregarDados() { connection = new Connection.Connection(); dataGridView1.DataSource = null; dataGridView1.Rows.Clear(); dataGridView1.Refresh(); string connectionString = connection.getconnectionString(); string query = "SELECT * FROM verVagas;"; using (MySqlConnection con = new MySqlConnection(connectionString)) { using (MySqlDataAdapter adapter = new MySqlDataAdapter(query, con)) { try { DataTable dataTable = new DataTable(); adapter.Fill(dataTable); for (int index = 0; index < dataTable.Rows.Count; index++) { dataGridView1.Rows.Add(dataTable.Rows[index][0], dataTable.Rows[index][1], dataTable.Rows[index][2], dataTable.Rows[index][3], dataTable.Rows[index][4] ); } } catch (Exception ex) { MessageBox.Show("Erro: " + ex); } } } }