protected void RevistasGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            using (ISession session = HibernateUtil.AbrirSession())
            {
                using (ITransaction transaction = session.BeginTransaction())
                {
                    try
                    {
                        RevistaService revistaService = new RevistaService(session);
                        int id = Convert.ToInt32(RevistasGridView.DataKeys[e.RowIndex].Value.ToString());
                        revistaService.DeletarRevista(revistaService.BuscatPorId(id));
                        transaction.Commit();
                        RevistasGridView.DataSource = revistaService.ListarTudo();
                        RevistasGridView.DataBind();
                    }
                    catch (Exception ex)
                    {
                        if (!transaction.WasCommitted)
                        {
                            transaction.Rollback();
                        }
                        throw;
                    }
                }

            }
        }
 protected void RevistasGridView_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
 {
     using (ISession session = HibernateUtil.AbrirSession())
     {
         RevistaService revistaService = new RevistaService(session);
         int id = Convert.ToInt32(RevistasGridView.DataKeys[e.NewSelectedIndex].Value.ToString());
         Revista revista = revistaService.BuscatPorId(id);
         IdHiddenField.Value = Convert.ToString(revista.Id);
         TituloTextBox.Text = revista.Titulo;
         SubTituloTextBox.Text = revista.SubTitulo;
         ArcoTextBox.Text = revista.Arco;
         AnoTextBox.Text = Convert.ToString(revista.Ano);
         ValorTextBox.Text = Convert.ToString(revista.Valor);
     }
 }