public void Delete(EventBase eventBase) { mEventsInvitationsBO.Delete(eventBase.UniqueID); mEventLocationBO.Delete(eventBase.EventLocation); mResourceDescriptionBO.Delete(eventBase.ResourceDescription); mEventTimeInfoBO.Delete(eventBase.EventTimeInfo); foreach (HoldingsInfo holdingsInfo in eventBase.HoldingsInfo) { mHoldingsInfoBO.Delete(holdingsInfo); } foreach (ItemBase itemBase in eventBase.ItemChildren) { mItemBaseBO.Delete(itemBase); } foreach (EventBase eventChildran in eventBase.EventChildren) { Delete(eventChildran); } mEventBaseDAL.Delete(eventBase); }
public string DeleteItemEvent( string uniqueID, string itemName) { if (!mIsInit) { InitMembers(); } if (mCurrentEvent == null) { return("Event is not Loaded"); } foreach (ItemBase itemBase in mCurrentEvent.ItemChildren) { if (itemBase.UniqueID.ToString() == uniqueID) { if (itemBase.Admin.UniqueID != mCurrentUser.UniqueID) { throw new System.ArgumentException("User is not autorized to delete item", "itemName"); } if (itemBase.Name != itemName) { throw new System.ArgumentException("Item is invalid", "itemName"); } mCurrentEvent.ItemChildren.Remove(itemBase); try { mItemBaseBO.Delete(itemBase); } catch { throw new System.ArgumentException("Delete item failed", "itemName"); } return("Item was saved successfully"); } } return("Failed to save item"); }