private void AddToCategory(TreeNode tNode, List<AdiCategory> oCategories, String taskMode) { TaskDetailManager mgr = new TaskDetailManager(Constants.ConnectionString); foreach (AdiCategory c in oCategories) { TreeNode tn = new TreeNode(); tn.Text = c.DisplayName; tn.Tag = c.Value; tn.Checked = (mgr.GetDataByTaskDetail(-1, Constants.SiteName.ADIGLOBAL, taskMode, Constants.TaskType.ADI_CATEGORY, c.Value).Count() == 1); if (ReferenceEquals(tNode, null)) //treeCatagory.Nodes.Add(tn); AddTreeRootNode(treeCatagory, tn); else //tNode.Nodes.Add(tn); AddTreeSubNode(tNode, tn); if (c.SubCategory.Count > 0) AddToCategory(tn, c.SubCategory, taskMode); } }
private void AddToBrand(TreeNode tNode, List<AdiBrand> oBrands, String taskMode) { TaskDetailManager mgr = new TaskDetailManager(Constants.ConnectionString); foreach (AdiBrand b in oBrands) { TreeNode tn = new TreeNode(); tn.Text = b.DisplayName; tn.Tag = b.Value; tn.Checked = (mgr.GetDataByTaskDetail(-1, Constants.SiteName.ADIGLOBAL, taskMode, Constants.TaskType.ADI_BRAND, b.Value).Count() == 1); if (ReferenceEquals(tNode, null)) //treeCatagory.Nodes.Add(tn); AddTreeRootNode(treeViewBrands, tn); else //tNode.Nodes.Add(tn); AddTreeSubNode(tNode, tn); } }