Esempio n. 1
0
        public Tarefa_concluido Buscar(Tarefa tarefa)
        {
            try
            {
                Tarefa_concluido retorno = null;
                DBSession        session = new DBSession();
                Query            query   = session.CreateQuery("SELECT * FROM tarefa_concluido WHERE tarefa_id = @tarefa_id");
                query.SetParameter("tarefa_id", tarefa.tarefa_id);

                IDataReader reader = query.ExecuteQuery();

                if (reader.Read())
                {
                    retorno = new Tarefa_concluido(tarefa, new Painel(Convert.ToInt32(reader["painel"])), Convert.ToDateTime(reader["data"]));
                }
                reader.Close();
                session.Close();

                return(retorno);
            }
            catch (Exception erro)
            {
                throw erro;
            }
        }
Esempio n. 2
0
 public void Salvar(Tarefa_concluido variavel)
 {
     try
     {
         DBSession session = new DBSession();
         Query     query   = session.CreateQuery("INSERT INTO Tarefa_concluido (tarefa_id, painel, data) VALUES (@tarefa_id, @painel, @data) ");
         query.SetParameter("tarefa_id", variavel.tarefa_id.tarefa_id)
         .SetParameter("painel", variavel.painel.codigo)
         .SetParameter("data", variavel.data);
         query.ExecuteUpdate();
         session.Close();
     }
     catch (Exception erro)
     {
         throw erro;
     }
 }