Exemplo n.º 1
0
        public static void EliminarEstudioConsultaPorConsulta(int codigoConsulta)
        {
            ISession     nhSesion = ManejoNHibernate.IniciarSesion();
            ITransaction trans    = nhSesion.BeginTransaction();

            try
            {
                List <EstudioConsulta> listaEstudiosConsulta = CatalogoEstudioConsulta.RecuperarPorCodigoConsulta(codigoConsulta, nhSesion);
                foreach (EstudioConsulta estudioConsulta in listaEstudiosConsulta)
                {
                    CatalogoEstudioConsulta.Eliminar(estudioConsulta, nhSesion);
                }
                trans.Commit();
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw ex;
            }
            finally
            {
                nhSesion.Close();
                nhSesion.Dispose();
            }
        }
Exemplo n.º 2
0
        public static void EliminarEstudioConsulta(int codigoEstudioConsulta)
        {
            EstudioConsulta estudioConsulta;
            ISession        nhSesion = ManejoNHibernate.IniciarSesion();

            try
            {
                estudioConsulta = CatalogoEstudioConsulta.RecuperarPorCodigo(codigoEstudioConsulta, nhSesion);
                CatalogoEstudioConsulta.Eliminar(estudioConsulta, nhSesion);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                nhSesion.Close();
                nhSesion.Dispose();
            }
        }