public override void Delete(ManagedSecurityContext sec) { ManagedDiscussion.FindAndDelete( Session, mInstance.AccountFeed.Account.Id, typeof(AccountFeedItem), mInstance.Id, sec); ManagedFeature.Delete(Session, "AccountFeedItem", Id); base.Delete(sec); }
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 override void Delete(ManagedSecurityContext sec) { ManagedFeature.Delete(Session, "AccountLicense", Id); Collection <AccountLicense> .GetSafeCollection(mInstance.Account.AccountLicenses).Remove(mInstance); base.Delete(sec); }
public override void Delete(ManagedSecurityContext sec) { ManagedDiscussion.FindAndDelete(Session, mInstance.Account.Id, typeof(AccountEvent), mInstance.Id, sec); ManagedFeature.Delete(Session, "AccountEvent", Id); Collection <AccountEvent> .GetSafeCollection(mInstance.Account.AccountEvents).Remove(mInstance); base.Delete(sec); }
public override void Delete(ManagedSecurityContext sec) { foreach (AccountFeedItem item in Collection <AccountFeedItem> .GetSafeCollection(mInstance.AccountFeedItems)) { ManagedAccountFeedItem m_item = new ManagedAccountFeedItem(Session, item); m_item.Delete(sec); } ManagedFeature.Delete(Session, "AccountFeed", Id); base.Delete(sec); }
public override void Delete(ManagedSecurityContext sec) { ManagedDiscussion.FindAndDelete(Session, typeof(AccountGroup), Id, sec); Session.Delete(string.Format("FROM AccountGroupAccountRequest r WHERE r.AccountGroup.Id = {0}", Id)); Session.Delete(string.Format("FROM AccountGroupAccountInvitation i WHERE i.AccountGroup.Id = {0}", Id)); Session.Delete(string.Format("FROM AccountGroupPlace p WHERE p.AccountGroup.Id = {0}", Id)); Session.Delete(string.Format("FROM AccountRssWatch w WHERE w.Url = 'AccountGroupRss.aspx?id={0}'", Id)); Session.Delete(string.Format("FROM AccountInvitation i WHERE i.AccountGroup.Id = {0}", Id)); ManagedFeature.Delete(Session, "AccountGroup", Id); base.Delete(sec); }
public override void Delete(ManagedSecurityContext sec) { // orphan groups foreach (AccountGroup group in Collection <AccountGroup> .GetSafeCollection(mInstance.AccountGroups)) { group.AccountBlog = null; Session.Save(group); } // delete features ManagedFeature.Delete(Session, "AccountBlog", Id); // delete automatic feeds AccountFeed feed = GetSyndicatedFeed(); if (feed != null) { Session.Delete(feed); } base.Delete(sec); }
public void Merge(ManagedSecurityContext sec, int id) { if (id == mInstance.Id) { throw new Exception("Cannot merge a place into itself."); } ManagedPlace p = new ManagedPlace(Session, id); #region Merge AccountEvents foreach (AccountEvent inst in p.Instance.AccountEvents) { inst.Place = mInstance; Session.Save(inst); } #endregion #region Merge AccountGroupPlace foreach (AccountGroupPlace inst in p.Instance.AccountGroupPlaces) { if (!HasAccountGroup(inst.AccountGroup.Id)) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge AccountPlaceFavorite foreach (AccountPlaceFavorite inst in p.Instance.AccountPlaceFavorites) { bool found = false; foreach (AccountPlaceFavorite curr in inst.Account.AccountPlaceFavorites) { if (curr.Place.Id == mInstance.Id) { found = true; break; } } if (!found) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge AccountPlaceRequests foreach (AccountPlaceRequest inst in p.Instance.AccountPlaceRequests) { bool found = false; foreach (AccountPlaceRequest curr in inst.Account.AccountPlaceRequests) { if (curr.Place.Id == mInstance.Id) { found = true; break; } } if (!found) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge AccountPlaces foreach (AccountPlace inst in p.Instance.AccountPlaces) { bool found = false; foreach (AccountPlace curr in inst.Account.AccountPlaces) { if (curr.Place.Id == mInstance.Id) { found = true; break; } } if (!found) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge PlaceAttribute foreach (PlaceAttribute inst in p.Instance.PlaceAttributes) { if (!HasPlaceAttribute(inst.Attribute.Id)) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge PlaceNames // merge place names foreach (PlaceName inst in p.Instance.PlaceNames) { if (!HasPlaceName(inst.Name)) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge PlacePictures foreach (PlacePicture inst in p.Instance.PlacePictures) { inst.Place = mInstance; Session.Save(inst); } #endregion #region Merge PlacePropertyValues foreach (PlacePropertyValue inst in p.Instance.PlacePropertyValues) { if (!HasPlacePropertyValue(inst.PlaceProperty.Id)) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge PlaceQueueItems foreach (PlaceQueueItem inst in p.Instance.PlaceQueueItems) { bool found = false; foreach (PlaceQueue queue in inst.PlaceQueue.Account.PlaceQueues) { foreach (PlaceQueueItem curr in queue.PlaceQueueItems) { if (curr.Place.Id == mInstance.Id) { found = true; break; } } if (found) { break; } } if (!found) { inst.Place = mInstance; Session.Save(inst); } } #endregion #region Merge Discussion // TODO: move into ManagedDiscussion Discussion d_keep = ManagedDiscussion.Find(Session, mInstance.Account.Id, typeof(Place), mInstance.Id, sec); Discussion d_delete = ManagedDiscussion.Find(Session, p.Instance.Account.Id, typeof(Place), p.Instance.Id, sec); if (d_keep == null && d_delete != null) { d_delete.ObjectId = mInstance.Id; Session.Save(d_delete); } else if (d_delete != null) { foreach (DiscussionThread t in d_delete.DiscussionThreads) { t.Discussion = d_keep; if (t.Modified > d_keep.Modified) { d_keep.Modified = t.Modified; Session.Save(d_keep); } Session.Save(t); } } #endregion #region Merge MadLibs IList <MadLibInstance> madlibs = ManagedMadLibInstance.GetMadLibs(Session, "Place", p.Id); foreach (MadLibInstance madlib in madlibs) { madlib.ObjectId = mInstance.Id; Session.Save(madlib); } #endregion #region Merge Features IList <Feature> features = ManagedFeature.GetFeatures(Session, "Place", p.Id); foreach (Feature feature in features) { feature.DataRowId = mInstance.Id; Session.Save(feature); } #endregion Session.Delete(p.Instance); }