Example #1
0
 //INCLUI PESSOA NA LISTA
 private void IncluirPessoaLista(PresencaEventoEntidade entidade)
 {
     using (SQLiteConnection conn = new SQLiteConnection(connectionString))
     {
         conn.Open();
         using (SQLiteCommand cmd = new SQLiteCommand(conn))
         {
             cmd.CommandText = "INSERT INTO TB_PESSOA_LISTA_PRESENCA(ID_PESSOA, ID_LISTA_PRESENCA) VALUES (@id_pessoa, @id_lista_presenca)";
             cmd.Prepare();
             cmd.Parameters.AddWithValue("@id_pessoa", entidade.Pessoa.IdPessoa);
             cmd.Parameters.AddWithValue("@id_lista_presenca", entidade.ListaPresenca.IdListaPresenca);
             try
             {
                 cmd.ExecuteNonQuery();
             }
             catch (SQLiteException ex)
             {
                 throw ex;
             }
             finally
             {
                 conn.Close();
             }
         }
     }
 }
Example #2
0
 //REMOVE PESSOA DA LISTA
 private void RemoverPessoaLista(PresencaEventoEntidade entidade)
 {
     using (SQLiteConnection conn = new SQLiteConnection(connectionString))
     {
         conn.Open();
         using (SQLiteCommand cmd = new SQLiteCommand(conn))
         {
             cmd.CommandText = "DELETE FROM TB_PESSOA_LISTA_PRESENCA WHERE ID_LISTA_PRESENCA = @id_lista_presenca AND ID_PESSOA = @id_pessoa";
             cmd.Prepare();
             cmd.Parameters.AddWithValue("@id_lista_presenca", entidade.ListaPresenca.IdListaPresenca);
             cmd.Parameters.AddWithValue("@id_pessoa", entidade.Pessoa.IdPessoa);
             try
             {
                 cmd.ExecuteNonQuery();
             }
             catch (SQLiteException ex)
             {
                 throw ex;
             }
             finally
             {
                 conn.Close();
             }
         }
     }
 }
Example #3
0
 private PresencaEventoEntidade GetDadosDoGrid()
 {
     try
     {
         int linha;
         linha = dataGridView1.CurrentRow.Index;
         var entidade = new PresencaEventoEntidade();
         entidade.PresenteLista   = dataGridView1[0, linha].Value.ToString().Equals("SIM") ? true : false;
         entidade.Pessoa.Nome     = dataGridView1[1, linha].Value.ToString();
         entidade.Pessoa.IdPessoa = Convert.ToInt32(dataGridView1[2, linha].Value);
         return(entidade);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }