public static CategoryType?Convert(this CategoryTypeFilter filter) { switch (filter) { case CategoryTypeFilter.None: return(CategoryType.None); case CategoryTypeFilter.Income: return(CategoryType.Income); case CategoryTypeFilter.Expenditure: return(CategoryType.Expenditure); } return(null); }
/// <summary> /// Initialise the Category /// </summary> /// <param name="ID">ID to use</param> /// <param name="isIDaNodeID">Whether the ID is a Node ID (or H2G2ID)</param> /// <param name="siteID">Site ID</param> /// <param name="type">Filter Type</param> /// <param name="articleType">Article Type</param> /// <param name="show"></param> /// <param name="skip"></param> public void Initialise(int ID, bool isIDaNodeID, int siteID, CategoryTypeFilter type, int articleType, int show, int skip) { string description = String.Empty; string synonyms = String.Empty; int userAdd = 0; int parentID = 0; int typeID = 0; //if the nodeId is zero then we actually want the root for the given site if (isIDaNodeID && ID == 0) { //get the proper nodeID from the table; ID = GetRootNodeFromHierarchy(siteID); if (ID == 0) { throw new DnaException("Category - Initialise - No rootnode for the given siteID"); } } int nodeID = 0; string nodeName = String.Empty; int H2G2ID = 0; int baseLine = 0; XmlElement hierarchyDetails = GetHierarchyNodeDetails(ID, isIDaNodeID, ref nodeName, ref description, ref parentID, ref H2G2ID, ref synonyms, ref userAdd, ref nodeID, ref typeID, 0, ref baseLine); if (hierarchyDetails == null) { Initialise(0, true, siteID); } //Add ancestry ( parents ) information for this Node hierarchyDetails.AppendChild(GetCategoryAncestry(nodeID)); XmlElement members = AddElementTag(hierarchyDetails, "MEMBERS"); members.AppendChild(GetSubjectMembersForNodeID(nodeID)); // Get Articles / Threads Tagged to Node. int rows = 0; if ( (type == CategoryTypeFilter.None ) || (type == CategoryTypeFilter.TypedArticle && GuideEntry.IsTypeOfArticle(articleType)) ) { //If Show param not provided, return default max articles. if ( show == 0 ) { show = MAX_ARTICLE_ROWS; } members.AppendChild(GetArticleMembersForNodeID(nodeID, articleType, show, skip, ref rows )); } //Get Clubs ( Campaigns ) tagged to this Node //if ( (type == CategoryTypeFilter.None ) || (type == CategoryTypeFilter.TypedArticle && GuideEntry.IsTypeOfClub(articleType)) ) //{ // members.AppendChild(GetClubMembersForNodeID(nodeID, show, skip)); //} //Include Notice Board Posts tagged to this node. //if ( type == CategoryTypeFilter.None || type == CategoryTypeFilter.Thread ) //{ // members.AppendChild(GetNoticesForNodeID(nodeID)); //} //Include Notice Board Posts tagged to this node. if ( type == CategoryTypeFilter.None || type == CategoryTypeFilter.User ) { members.AppendChild(GetUsersForNodeID(nodeID)); } //Create the Skip and Show XML if ( skip > 0 ) { AddIntElement(members, "COUNT", show); AddIntElement(members, "SKIP", skip); if ( rows > (show + skip) ) { AddIntElement(members, "MORE", 1); } else { AddIntElement(members, "MORE", 0); } } members.AppendChild(GetNodeAliasMembersForNodeID(nodeID)); if (InputContext.GetSiteOptionValueBool("Category", "IncludeCloseMembers")) { members.AppendChild(GetHierarchyCloseMembers(nodeID, MAX_CLOSE_ROWS - rows)); } // Action network does not use the sort information, so don't do the sort. // Another reason for not doing this action is that it goes through 1.4 million iterations for 1598 items // and takes upto one minute to complete all for nothing!!! if ( siteID != 16) { SetSortOrderForNodeMembers(members, "MEMBERS"); } }