public void BorrarUnComentario(int id_comentario) { /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Comentario_borrarUnComentario) ENABLED START*/ IComentarioCAD comentarioCAD = null; ComentarioCEN comentarioCEN = null; try { SessionInitializeTransaction(); comentarioCAD = new ComentarioCAD(session); comentarioCEN = new ComentarioCEN(comentarioCAD); // Write here your custom transaction ... EventoEN even = new EventoEN(); even = comentarioCAD.GetID(id_comentario).Evento; RetoEN reten = new RetoEN(); reten = comentarioCAD.GetID(id_comentario).Reto; GymkanaEN gymen = new GymkanaEN(); gymen = comentarioCAD.GetID(id_comentario).Gymkana; if (even != null) { comentarioCAD.UnrelationerComentarioEvento(id_comentario, even.ID); comentarioCAD.Destroy(id_comentario); } else if (reten != null) { comentarioCAD.UnrelationerComentarioReto(id_comentario, reten.ID); comentarioCAD.Destroy(id_comentario); } else if (gymen != null) { comentarioCAD.UnrelationerComentarioGymkana(id_comentario, gymen.ID); comentarioCAD.Destroy(id_comentario); } SessionCommit(); } catch (Exception ex) { SessionRollBack(); throw ex; } finally { SessionClose(); } /*PROTECTED REGION END*/ }
public void BorrarComentarioEvento(int id_evento) { /*PROTECTED REGION ID(WhateverGenNHibernate.CP.Whatever_Comentario_borrarComentarioEvento) ENABLED START*/ IComentarioCAD comentarioCAD = null; ComentarioCEN comentarioCEN = null; try { SessionInitializeTransaction(); comentarioCAD = new ComentarioCAD(session); comentarioCEN = new ComentarioCEN(comentarioCAD); // Write here your custom transaction ... System.Collections.Generic.IList <ComentarioEN> comentarios = new System.Collections.Generic.List <ComentarioEN>(); comentarios = comentarioCAD.FiltrarComentarioPorEvento(id_evento); foreach (ComentarioEN element in comentarios) { comentarioCAD.UnrelationerComentarioEvento() } SessionCommit(); } catch (Exception ex) { SessionRollBack(); throw ex; } finally { SessionClose(); } /*PROTECTED REGION END*/ }