protected ItemBase GetItemBase(UInt64 uniqueID) { ItemBase retItemBase = FindItemInPool(uniqueID); if (retItemBase == null) { retItemBase = new ItemBase(uniqueID); mItemBaseBO.Load(retItemBase); AddItemToPool(retItemBase); } return(retItemBase); }
// Exceptions: // System.ArgumentException: // Load Failed // currentUser is to check validation protected void LoadInternal(EventBase eventBase, UserBase currentUser, bool loadChildren) { try { mEventBaseDAL.Load(eventBase, eventBase.UniqueID); mEventTimeInfoBO.Load(eventBase.EventTimeInfo); mEventLocationBO.Load(eventBase.EventLocation); mResourceDescriptionBO.Load(eventBase.ResourceDescription); if (loadChildren) { List <UInt64> uniqueIDs = mEventBaseDAL.GetChildrenUniqueIDs(eventBase.UniqueID); foreach (UInt64 tempUniqueID in uniqueIDs) { EventBase childEventBase = new EventBase(tempUniqueID); Load(childEventBase, currentUser); eventBase.EventChildren.Add(childEventBase); } uniqueIDs = mItemBaseDAL.GetChildrenUniqueIDsByEventParent(eventBase.UniqueID); foreach (UInt64 tempUniqueID in uniqueIDs) { ItemBase childItemBase = new ItemBase(tempUniqueID); mItemBaseBO.Load(childItemBase); eventBase.ItemChildren.Add(childItemBase); } uniqueIDs = mHoldingsInfoBO.GetUniqueIDsByEventOwner(eventBase.UniqueID); foreach (UInt64 tempUniqueID in uniqueIDs) { HoldingsInfo holdingsInfo = new HoldingsInfo(tempUniqueID); mHoldingsInfoBO.Load(holdingsInfo); // Should I load it here?? eventBase.HoldingsInfo.Add(holdingsInfo); } } } catch { throw new System.ArgumentException("Load Failed", "eventBase"); } }
public string DeleteEvent(string uniqueID) { if (!mIsInit) { InitMembers(); } if (mCurrentUser == null) { return("User is not Loaded"); } string retStr = SetCurrentEvent(uniqueID); if (retStr.Length > 0) { return(retStr); } EventBase eventBase = (EventBase)Session["CurrentEvent"]; foreach (EventBase userEventBase in mCurrentUser.Events) { if (eventBase.UniqueID == userEventBase.UniqueID) { mCurrentUser.Events.Remove(userEventBase); break; } } if (eventBase.Admin.UniqueID != mCurrentUser.UniqueID) { foreach (ItemBase itemBase in eventBase.ItemChildren) { if (!itemBase.IsLoaded()) { mItemBaseBO.Load(itemBase); } foreach (HoldingsInfo holdingsInfo in itemBase.HoldingsInfo) { if (!holdingsInfo.IsLoaded()) { mHoldingsInfoBO.Load(holdingsInfo); } if (holdingsInfo.HoldingUser.UniqueID == mCurrentUser.UniqueID) { holdingsInfo.HoldingUser = new UserBase(); holdingsInfo.HoldingUser.UniqueID = 0; mHoldingsInfoBO.Save(holdingsInfo); } } } foreach (HoldingsInfo holdingsInfo in eventBase.HoldingsInfo) { if (!holdingsInfo.IsLoaded()) { mHoldingsInfoBO.Load(holdingsInfo); } if (holdingsInfo.HoldingUser.UniqueID == mCurrentUser.UniqueID) { mHoldingsInfoBO.Delete(holdingsInfo); break; } } } else // Admin { mEventBaseBO.Delete(eventBase); } Session["CurrentUser"] = mCurrentUser; return(""); }