예제 #1
0
        // 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);
        }
예제 #2
0
            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);
            }
예제 #3
0
        // Tags

        #region DisplayCategoryTree
        private void DisplayCategoryTree()
        {
            bool boolUserAssignedToTask = false;
            HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();

            HelpDesk_Task objHelpDesk_Tasks = (from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
                                               where HelpDesk_Tasks.TaskID == Convert.ToInt32(Request.QueryString["TaskID"])
                                               select HelpDesk_Tasks).FirstOrDefault();

            //Is user in the Assigned Role?
            RoleController objRoleController = new RoleController();
            RoleInfo       objRoleInfo       = objRoleController.GetRole(objHelpDesk_Tasks.AssignedRoleID, PortalId);

            if (objRoleInfo != null)
            {
                if (UserInfo.IsInRole(objRoleInfo.RoleName))
                {
                    boolUserAssignedToTask = true;
                }
            }

            if (boolUserAssignedToTask || UserInfo.IsInRole(GetAdminRole()) || UserInfo.IsInRole("Administrators") || UserInfo.IsSuperUser)
            {
                // Show all Tags
                TagsTreeExistingTasks.Visible     = true;
                TagsTreeExistingTasks.TagID       = Convert.ToInt32(Request.QueryString["TaskID"]);
                TagsTreeExistingTasks.DisplayType = "Administrator";
                TagsTreeExistingTasks.Expand      = false;
            }
            else
            {
                // Show only Visible Tags
                TagsTreeExistingTasks.Visible     = true;
                TagsTreeExistingTasks.TagID       = Convert.ToInt32(Request.QueryString["TaskID"]);
                TagsTreeExistingTasks.DisplayType = "Requestor";
                TagsTreeExistingTasks.Expand      = false;
            }

            // Select Existing values
            if (objHelpDesk_Tasks.HelpDesk_TaskCategories.Select(x => x.CategoryID).ToArray <int>().Count() > 0)
            {
                int[]  ArrStrCategories = objHelpDesk_Tasks.HelpDesk_TaskCategories.Select(x => x.CategoryID).ToArray <int>();
                int?[] ArrIntHelpDesk   = Array.ConvertAll <int, int?>(ArrStrCategories, new Converter <int, int?>(ConvertToNullableInt));

                TagsTreeExistingTasks.SelectedCategories = ArrIntHelpDesk;
            }

            // Set visibility of Tags
            bool RequestorR7_HelpDesk = (TagsTreeExistingTasks.DisplayType == "Administrator") ? false : true;

            int CountOfHelpDesk = (from WebserverCategories in CategoriesTable.GetCategoriesTable(PortalId, RequestorR7_HelpDesk)
                                   where WebserverCategories.PortalID == PortalId
                                   where WebserverCategories.Level == 1
                                   select WebserverCategories).Count();

            imgTags.Visible    = (CountOfHelpDesk > 0);
            lbltxtTags.Visible = (CountOfHelpDesk > 0);
        }
예제 #4
0
            public IHierarchyData GetParent()
            {
                HelpDeskEnumerable parentContainer = new HelpDeskEnumerable();

                AttributeCollection objAttributeCollection = objListItem.Attributes;
                int  intPortalID = Convert.ToInt32(objAttributeCollection["PortalID"]);
                bool boolRequestorR7_HelpDesk = Convert.ToBoolean(objAttributeCollection["RequestorR7_HelpDesk"]);

                var ParentResult = (from WebserverCategories in CategoriesTable.GetCategoriesTable(intPortalID, boolRequestorR7_HelpDesk)
                                    where WebserverCategories.ParentCategoryID == Convert.ToInt32(objListItem.Value)
                                    select WebserverCategories).FirstOrDefault();

                // 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}", ParentResult.CategoryName);
                objChildListItem.Value = ParentResult.CategoryID.ToString();
                objChildListItem.Attributes.Add("PortalID", intPortalID.ToString());
                objChildListItem.Attributes.Add("Selectable", ParentResult.Selectable.ToString());
                objChildListItem.Attributes.Add("RequestorVisible", ParentResult.RequestorVisible.ToString());

                return(new HelpDeskHierarchyData(objChildListItem));
            }
예제 #5
0
        private void SelectTreeNode()
        {
            if (tvCategories.SelectedNode != null)
            {
                if (tvCategories.SelectedNode.Value != "")
                {
                    var result = (from HelpDesk_Categories in CategoriesTable.GetCategoriesTable(PortalId, false)
                                  where HelpDesk_Categories.CategoryID == Convert.ToInt32(tvCategories.SelectedNode.Value)
                                  select HelpDesk_Categories).FirstOrDefault();

                    txtCategory.Text            = result.CategoryName;
                    txtCategoryID.Text          = result.CategoryID.ToString();
                    chkRequesterVisible.Checked = result.RequestorVisible;
                    chkSelectable.Checked       = result.Selectable;

                    // Remove Node from the Bind DropDown drop-down
                    BindDropDown(result.CategoryID);

                    // Set the Parent drop-down
                    ddlParentCategory.SelectedValue = (result.ParentCategoryID == null) ? "0" : result.ParentCategoryID.ToString();
                    txtParentCategoryID.Text        = (result.ParentCategoryID == null) ? "" : result.ParentCategoryID.ToString();
                }
            }
        }
예제 #6
0
 private void GetEntireTable()
 {
     // Get the entire table only once from cache
     EntireTable = CategoriesTable.GetCategoriesTable(_PortalID, false);
 }