/// <summary> /// POBox factory method that constructs a POBox object for the specified user in the specified domain. /// </summary> /// <param name="storeObject">The Store object that the POBox belongs to.</param> /// <param name="domainId">The ID of the domain that the POBox belongs to.</param> /// <param name="userId">The ID of the user that the POBox belongs to.</param> /// <returns></returns> public static POBox FindPOBox(Store storeObject, string domainId, string userId) { POBox poBox = null; // Build the name of the POBox. string name = "POBox:" + domainId + ":" + userId; // Search for the POBox. ICSEnumerator listEnum = storeObject.GetCollectionsByName(name).GetEnumerator() as ICSEnumerator; // There should only be one value returned... if (listEnum.MoveNext()) { ShallowNode shallowNode = (ShallowNode)listEnum.Current; if (listEnum.MoveNext()) { // TODO: multiple values were returned ... throw an exception. } poBox = new POBox(storeObject, shallowNode); } listEnum.Dispose(); return(poBox); }
/// <summary> /// Returns whether this DirNode object contains children. /// </summary> /// <param name="collection">Collection object that this object belongs to.</param> /// <returns>True if DirNode object contains children, otherwise false is returned.</returns> public bool HasChildren(Collection collection) { ICSList results = collection.Search(PropertyTags.Parent, new Relationship(collection.ID, id)); ICSEnumerator e = results.GetEnumerator() as ICSEnumerator; bool hasChildren = e.MoveNext(); e.Dispose(); return(hasChildren); }
/// <summary> /// Gets the specified Member object. /// </summary> /// <param name="userID">User ID of the member to find.</param> /// <returns>The Member object represented by the specified user guid.</returns> public Member GetMember(string userID) { ICSList list = collection.Search(PropertyTags.Ace, userID, SearchOp.Begins); ICSEnumerator e = list.GetEnumerator() as ICSEnumerator; Member member = e.MoveNext() ? new Member(collection, e.Current as ShallowNode) : null; e.Dispose(); return(member); }
/// <summary> /// Dispose( bool disposing ) executes in two distinct scenarios. /// If disposing equals true, the method has been called directly /// or indirectly by a user's code. Managed and unmanaged resources /// can be disposed. /// If disposing equals false, the method has been called by the /// runtime from inside the finalizer and you should not reference /// other objects. Only unmanaged resources can be disposed. /// </summary> /// <param name="disposing">Specifies whether called from the finalizer or from the application.</param> private void Dispose(bool disposing) { // Check to see if Dispose has already been called. if (!disposed) { // Protect callers from accessing the freed members. disposed = true; // If disposing equals true, dispose all managed and unmanaged resources. if (disposing) { // Dispose managed resources. enumerator.Dispose(); } } }