public override void Delete(ManagedSecurityContext sec) { ManagedDiscussion.FindAndDelete( Session, mInstance.Account.Id, typeof(Place), mInstance.Id, sec); foreach (PlacePicture pic in Collection <PlacePicture> .GetSafeCollection(mInstance.PlacePictures)) { new ManagedPlacePicture(Session, pic).Delete(sec); } foreach (AccountEvent evt in Collection <AccountEvent> .GetSafeCollection(mInstance.AccountEvents)) { new ManagedAccountEvent(Session, evt).Delete(sec); } ManagedMadLibInstance.Delete(Session, sec, "Place", Id); Session.Delete(string.Format("FROM AccountPlace f WHERE f.Place.Id = {0}", Id)); Session.Delete(string.Format("FROM AccountGroupPlace f WHERE f.Place.Id = {0}", Id)); Session.Delete(string.Format("FROM AccountPlaceRequest f WHERE f.Place.Id = {0}", Id)); Session.Delete(string.Format("FROM AccountPlaceFavorite f WHERE f.Place.Id = {0}", Id)); Session.Delete(string.Format("FROM PlaceQueueItem q WHERE q.Place.Id = {0}", Id)); Session.Delete(string.Format("FROM PlaceChangeRequest r WHERE r.Place.Id = {0}", Id)); ManagedFeature.Delete(Session, "Place", Id); base.Delete(sec); }
public static void Delete(ISession session, ManagedSecurityContext sec, string table, int id) { IList <MadLibInstance> madlibs = GetMadLibs(session, table, id); foreach (MadLibInstance madlib in madlibs) { ManagedMadLibInstance m_instance = new ManagedMadLibInstance(session, madlib); m_instance.Delete(sec); } }