// Starting with the rootNode, recursively build a list of // nodes, create objects, add them all to the collection, // and return the list. public override IHierarchicalEnumerable Select() { HelpDeskEnumerable CHE = new HelpDeskEnumerable(); // Get the top level var results = from WebserverCategories in CategoriesTable.GetCategoriesTable(_PortalID, _RequestorR7_HelpDesk) where WebserverCategories.PortalID == _PortalID where WebserverCategories.Level == 1 orderby WebserverCategories.CategoryName select WebserverCategories; // Loop thru the top level foreach (HelpDesk_Category objHelpDesk_Category in results) { // Create a top level item ListItem objListItem = new ListItem(); objListItem.Text = objHelpDesk_Category.CategoryName; objListItem.Value = objHelpDesk_Category.CategoryID.ToString(); objListItem.Attributes.Add("PortalId", _PortalID.ToString()); objListItem.Attributes.Add("Selectable", objHelpDesk_Category.Selectable.ToString()); objListItem.Attributes.Add("RequestorVisible", objHelpDesk_Category.RequestorVisible.ToString()); objListItem.Attributes.Add("RequestorR7_HelpDesk", _RequestorR7_HelpDesk.ToString()); // Add a top level item to the final collection CHE.Add(new HelpDeskHierarchyData(objListItem)); } return(CHE); }
public IHierarchicalEnumerable GetChildren() { AttributeCollection objAttributeCollection = objListItem.Attributes; int intPortalID = Convert.ToInt32(objAttributeCollection["PortalID"]); bool boolRequestorR7_HelpDesk = Convert.ToBoolean(objAttributeCollection["RequestorR7_HelpDesk"]); var ChildResults = from WebserverCategories in CategoriesTable.GetCategoriesTable(intPortalID, boolRequestorR7_HelpDesk) where WebserverCategories.ParentCategoryID == Convert.ToInt32(objListItem.Value) orderby WebserverCategories.CategoryName select WebserverCategories; HelpDeskEnumerable children = new HelpDeskEnumerable(); // Loop thru each item foreach (HelpDesk_Category objCategory in ChildResults) { // Create a new list item to add to the collection ListItem objChildListItem = new ListItem(); // AddDots method is used to add the dots to indicate the item is a sub item objChildListItem.Text = String.Format("{0}", objCategory.CategoryName); objChildListItem.Value = objCategory.CategoryID.ToString(); objChildListItem.Attributes.Add("PortalID", intPortalID.ToString()); objChildListItem.Attributes.Add("Selectable", objCategory.Selectable.ToString()); objChildListItem.Attributes.Add("RequestorVisible", objCategory.RequestorVisible.ToString()); objListItem.Attributes.Add("RequestorR7_HelpDesk", boolRequestorR7_HelpDesk.ToString()); children.Add(new HelpDeskHierarchyData(objChildListItem)); } return(children); }
// Starting with the rootNode, recursively build a list of // nodes, create objects, add them all to the collection, // and return the list. public override IHierarchicalEnumerable Select() { HelpDeskEnumerable CHE = new HelpDeskEnumerable(); // Get the top level var results = from WebserverCategories in CategoriesTable.GetCategoriesTable(_PortalID, _RequestorR7_HelpDesk) where WebserverCategories.PortalID == _PortalID where WebserverCategories.Level == 1 orderby WebserverCategories.CategoryName select WebserverCategories; // Loop thru the top level foreach (HelpDesk_Category objHelpDesk_Category in results) { // Create a top level item ListItem objListItem = new ListItem(); objListItem.Text = objHelpDesk_Category.CategoryName; objListItem.Value = objHelpDesk_Category.CategoryID.ToString(); objListItem.Attributes.Add("PortalId", _PortalID.ToString()); objListItem.Attributes.Add("Selectable", objHelpDesk_Category.Selectable.ToString()); objListItem.Attributes.Add("RequestorVisible", objHelpDesk_Category.RequestorVisible.ToString()); objListItem.Attributes.Add("RequestorR7_HelpDesk", _RequestorR7_HelpDesk.ToString()); // Add a top level item to the final collection CHE.Add(new HelpDeskHierarchyData(objListItem)); } return CHE; }
public IHierarchicalEnumerable GetChildren() { AttributeCollection objAttributeCollection = objListItem.Attributes; int intPortalID = Convert.ToInt32(objAttributeCollection["PortalID"]); bool boolRequestorR7_HelpDesk = Convert.ToBoolean(objAttributeCollection["RequestorR7_HelpDesk"]); var ChildResults = from WebserverCategories in CategoriesTable.GetCategoriesTable(intPortalID, boolRequestorR7_HelpDesk) where WebserverCategories.ParentCategoryID == Convert.ToInt32(objListItem.Value) orderby WebserverCategories.CategoryName select WebserverCategories; HelpDeskEnumerable children = new HelpDeskEnumerable(); // Loop thru each item foreach (HelpDesk_Category objCategory in ChildResults) { // Create a new list item to add to the collection ListItem objChildListItem = new ListItem(); // AddDots method is used to add the dots to indicate the item is a sub item objChildListItem.Text = String.Format("{0}", objCategory.CategoryName); objChildListItem.Value = objCategory.CategoryID.ToString(); objChildListItem.Attributes.Add("PortalID", intPortalID.ToString()); objChildListItem.Attributes.Add("Selectable", objCategory.Selectable.ToString()); objChildListItem.Attributes.Add("RequestorVisible", objCategory.RequestorVisible.ToString()); objListItem.Attributes.Add("RequestorR7_HelpDesk", boolRequestorR7_HelpDesk.ToString()); children.Add(new HelpDeskHierarchyData(objChildListItem)); } return children; }