Esempio n. 1
0
        private static void BuildFromDirectory(string baseDir, Control level)
        {
            foreach (string idxDir in Directory.GetDirectories(baseDir))
            {
                string dir = idxDir.Replace(baseDir, "");

                // Skipping .svn and similar directories...
                if (dir.IndexOf(".") == 0)
                {
                    continue;
                }
                TreeNode n = new TreeNode {ID = level.ID + dir, Xtra = idxDir, Text = dir};
                level.Controls.Add(n);
                string[] childDirectories = Directory.GetDirectories(idxDir);
                if (childDirectories.Length > 0)
                {
                    // Skipping .svn and similar directories...
                    if (childDirectories.Length == 1)
                    {
                        string tmpDir = childDirectories[0];
                        tmpDir = tmpDir.Substring(tmpDir.LastIndexOf("\\") + 1);
                        if (tmpDir.IndexOf(".") == 0)
                        {
                            continue;
                        }
                    }
                    TreeNodes children = new TreeNodes {ID = "ch" + n.ID};
                    n.Controls.Add(children);
                    BuildFromDirectory(idxDir + "\\", children);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();

            EnterpriseMemberStructureBLL itemService = new EnterpriseMemberStructureBLL(new SessionManager().CurrentUserLoginInfo);

            string key = string.Empty;

            if (Request("node") != null && Request("node") != string.Empty)
            {
                key = Request("node").Trim();
            }

            if (key == "root" || key.Length == 0)
            {
                key = "";
            }
            IList <EnterpriseMemberStructureEntity> list = itemService.GetEnterpriseMemberStructureListByParentId(key);

            var jsonData = new JsonData();

            jsonData.totalCount = list.Count.ToString();
            jsonData.data       = list;

            foreach (var item in list)
            {
                nodes.Add(item.EnterpriseMemberStructureID.ToString(), item.StructureTitle, item.ParentID.ToString(), false);
            }
            return(nodes);
        }
 private void DeleteNode(TreeNode root)
 {
     TreeNodes.Remove(root);
     root.LeftChild  = null;
     root.RightChild = null;
     root.Parent     = null;
 }
Esempio n. 4
0
        /// <summary>
        ///     Get node from the treeNodes
        /// </summary>
        /// <param name="treeNodes"></param>
        /// <param name="path"></param>
        /// <returns></returns>
        private TreeNode GetNodeFromTreeNodes(TreeNodes treeNodes, string path)
        {
            foreach (var subNode in treeNodes)
            {
                if (subNode.HelpText != string.Empty && IgnoreItems.Contains(subNode.HelpText) == false)
                {
                    if (subNode.HelpText.Contains(path))
                    {
                        return(subNode);
                    }
                }
                else if (subNode.Text != string.Empty && IgnoreItems.Contains(subNode.Text) == false)
                {
                    if (subNode.Text.Contains(path))
                    {
                        return(subNode);
                    }
                }
                else
                {
                    var lblnode = QALabel.Get(SearchCriteria.ByText(path), string.Empty, subNode, 500);
                    if (lblnode != null && lblnode.UIItemExists && lblnode.IsVisible)
                    {
                        return(subNode);
                    }
                }
            }

            return(null);
        }
        public bool SelectTargetNode(List <string> LeafPath)
        {
            TreeNode first = TreeNodes.Where(e => e.DisplayName.ToUpper() == LeafPath[0].ToUpper()).FirstOrDefault();

            if (first == null)
            {
                return(false);
            }
            TreeNode second = first.ChildNodes.Where(e => e.DisplayName.ToUpper() == LeafPath[1].ToUpper()).FirstOrDefault();

            if (second == null)
            {
                return(false);
            }
            TreeNode third = second.ChildNodes.Where(e => e.DisplayName.ToUpper() == LeafPath[2].ToUpper()).FirstOrDefault();

            if (third == null)
            {
                return(false);
            }
            third.IsExpanded = true;
            third.IsSelected = true;
            ASFRootPath      = _asfRootPath;
            ComponentName    = second.DisplayName;
            SequenceName     = third.DisplayName;
            string EnvFile = Directory.EnumerateFiles(third.FullPath, "Sequence*_Env.xml").FirstOrDefault();

            // SequenceSelectedMessageSetter.SetSequenceSelected(new SequenceSelectedMessage(Directory.EnumerateFiles(third.FullPath, "Sequence*_Env.xml").FirstOrDefault(), ASFRootPath + @"\Tests\environments\Setup\Config\Template.xml"));
            return(true);
        }
Esempio n. 6
0
 private static void AddTreeNode(IEnumerable<Node> node, Control level)
 {
     foreach (Node idx in node)
     {
         if (idx.Name == "Page")
         {
             TreeNode n = new TreeNode
             {
                 ID = idx.DNA.Replace("-", ""),
                 Text = idx["Name"].Get<string>(),
                 Xtra = idx["URL"].Get<string>()
             };
             if (idx["Children", false] != null)
             {
                 TreeNodes child = new TreeNodes {ID = "l" + n.ID};
                 n.Controls.Add(child);
                 foreach (Node idxInner in idx["Children"])
                 {
                     AddTreeNode(idxInner, child);
                 }
             }
             level.Controls.Add(n);
         }
     }
 }
Esempio n. 7
0
        private TreeNodes SearchNodes(TreeNodes targetNodes, string namePath)
        {
            var       targetPath  = namePath.Split('.');
            bool      validPath   = false;
            TreeNodes existsNodes = null;

            var validNode = from x in targetNodes.Nodes where x.Name.ToLower() == targetPath[0].ToLower() select x;

            if ((validNode != null) && (validNode.Count() > 0))
            {
                existsNodes = validNode.FirstOrDefault();
                validPath   = true;
            }

            if (!validPath)
            {
                return(targetNodes);
            }

            var nextPath = namePath.Substring(targetPath[0].Length, namePath.Length - targetPath[0].Length);

            if (nextPath.StartsWith("."))
            {
                nextPath = nextPath.Substring(1, nextPath.Length - 1);
            }
            if (string.IsNullOrEmpty(nextPath.Trim()))
            {
                return(existsNodes);
            }
            return(this.SearchNodes(existsNodes, nextPath));
        }
        private void AddSubmenu()
        {
            EditState = true;
            Srv.MenuItem mi = null;

            if (CurrentNode == null)
            {
                mi = new Srv.MenuItem()
                {
                    ID = Guid.NewGuid().ToString(), Name = "新增菜单", Layer = 1, Ordinal = TreeNodes.Count + 1
                };
                TreeNodes.Add(new TreeNodeModel()
                {
                    Item = mi, Children = new ObservableCollection <TreeNodeModel>()
                });
            }
            else
            {
                if (CurrentNode.Children != null)
                {
                    mi = new Srv.MenuItem()
                    {
                        ID = Guid.NewGuid().ToString(), Parent = CurrentNode.Item.ID, Name = "新增菜单", Layer = CurrentNode.Item.Layer + 1, Ordinal = CurrentNode.Children.Count
                    };
                    CurrentNode.Children.Add(new TreeNodeModel()
                    {
                        Item = mi, Children = new ObservableCollection <TreeNodeModel>(), ParentNode = CurrentNode,
                    });
                    CurrentNode.IsExpanded = true;
                }
                else
                {
                }
            }
        }
        internal void Insert(long insertionTerm, TreeNode root)
        {
            var parent = Find(insertionTerm, root);

            if (parent.Value == insertionTerm)
            {
                return;
            }

            var newNode = new TreeNode(insertionTerm, null, null, parent);

            TreeNodes.Add(newNode);

            if (insertionTerm < parent.Value && parent.LeftChild == null)
            {
                parent.LeftChild = newNode;
            }
            else
            {
                parent.RightChild = newNode;
            }

            UpdateSum(newNode);
            UpdateSum(root);
            Root = root;
        }
Esempio n. 10
0
        /// <summary>
        /// 获取节点数据
        /// </summary>
        /// <param name="pParentNodeID"></param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            string status = "";

            if (Request("Status") != null && Request("Status") != "")
            {
                status = Request("Status");
            }
            //获取数据
            var bll = new UnitService(this.CurrentUserInfo);
            //var list = bll.getu(status);
            //组织数据
            TreeNodes nodes = new TreeNodes();

            //if (list != null && list.Count > 0)
            //{
            //    foreach (var item in list)
            //    {
            //        TreeNode node = new TreeNode();
            //        node.ID = item.Item_Category_Id;
            //        if (string.IsNullOrWhiteSpace(item.Parent_Id)==false && item.Parent_Id != "-99")
            //        {
            //            node.ParentID = item.Parent_Id;
            //        }
            //        node.Text = item.Item_Category_Name;
            //        node.IsLeaf = true;
            //        //
            //        nodes.Add(node);
            //    }
            //}
            //
            return(nodes);
        }
Esempio n. 11
0
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();

            var service = new WMenuBLL(new SessionManager().CurrentUserLoginInfo);
            IList <WMenuEntity> data = new List <WMenuEntity>();
            string content           = string.Empty;

            string key = string.Empty;

            if (Request("node") != null && Request("node") != string.Empty)
            {
                key = Request("node").ToString().Trim();
            }
            if (key == "root")
            {
                key = "";
            }

            //if (key.Length == 2)
            //{
            //    data = service.GetCityListByProvince(key);
            //}
            //else if (key.Length == 4)
            //{
            //    data = service.GetAreaListByCity(key);
            //}
            //else if (key.Length == 0)
            //{
            //    data = service.GetProvinceList();
            //}

            var queryEntity = new WMenuEntity();

            queryEntity.ParentId      = key;
            queryEntity.ApplicationId = Request("ApplicationId");

            data = service.GetWebWMenu(queryEntity, 0, 1000);

            var jsonData = new JsonData();

            jsonData.totalCount = data.Count.ToString();
            jsonData.data       = data;

            var parentCode = string.Empty;

            foreach (var item in data)
            {
                nodes.Add(item.ID, item.Name,
                          item.ParentId,
                          item.Level == "3" ? true : false);
            }
            //
            //var root = new TreeNodes();
            //root.Add(new TreeNode() { ID = "1", IsLeaf = false, Text = "1" });
            //root.Add(new TreeNode() { ID = "1_1", ParentID = "1", IsLeaf = false, Text = "1_1" });
            //root.Add(new TreeNode() { ID = "1_1_1", ParentID = "1_1", IsLeaf = false, Text = "1_1_1`" });
            return(nodes);
        }
Esempio n. 12
0
 private void SortNodes(TreeNodes targetNodes)
 {
     targetNodes.Nodes.Sort(new ComparerName());
     foreach (var childNode in targetNodes.Nodes)
     {
         this.SortNodes(childNode);
     }
 }
Esempio n. 13
0
        public void AddTreeNode(long[] inputArray)
        {
            var key             = inputArray[0];
            var leftChildIndex  = inputArray[1];
            var rightChildIndex = inputArray[2];

            TreeNodes.Add(new TreeNode(key, (int)leftChildIndex, (int)rightChildIndex));
        }
Esempio n. 14
0
        //private void GetCollection(MongoServer server, uint dbid)
        private void GetCollection(MongoServer server, uint dbid)
        {
            if (MongoObjects.ContainsKey(dbid))
            {
                var database = MongoObjects[dbid] as MongoDatabaseModel;
                var watch    = new Stopwatch();
                watch.Start();

                try
                {
                    var db          = server.GetDatabase(database.Name);
                    var collections = db.GetCollectionNames();

                    if (collections != null)
                    {
                        var tblNodes = new HashSet <uint>();

                        collections.Where(t => !t.Contains("$") && !t.Contains(MongoConst.IndexTableName) && !t.Contains(MongoConst.ProfileTableName)).ToList().ForEach(t =>
                        {
                            var table = db.GetCollection(t);
                            var tbl   = new MongoCollectionModel
                            {
                                ID         = MongoConst.GetRandomId(),
                                Name       = t,
                                Namespace  = table.FullName,
                                TotalCount = table.Count()
                            };

                            tblNodes.Add(tbl.ID);

                            TreeNodes.Add(new MongoTreeNode
                            {
                                ID   = tbl.ID,
                                PID  = database.ID,
                                Name = string.Format("{0} ({1})", tbl.Name, tbl.TotalCount),
                                Type = MongoTreeNodeType.Collection
                            });

                            MongoObjects.Add(tbl.ID, tbl);
                        });

                        //并行
                        Parallel.ForEach(tblNodes, id => GetFieldAndIndex(db, id));
                        //循环
                        //tblNodes.ToList().ForEach(id => GetFieldAndIndex(db, id));
                    }
                }
                catch (Exception ex)
                {
                    LogManager.GetLogger("MongoContext").Error("获取数据表信息时出错", ex);
                }

                LogManager.GetLogger("InfoLog").Info(string.Format("获取服务库{0}的所有表对象共花费了大约{1}毫秒的时间", database.Name, watch.ElapsedMilliseconds));
                watch.Stop();
            }
        }
Esempio n. 15
0
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();

            string            typeCode    = "总部";
            AppSysService     unitService = new AppSysService(new SessionManager().CurrentUserLoginInfo);
            IList <MenuModel> units;

            string key     = string.Empty;
            string content = string.Empty;

            key = pParentNodeID;
            bool bl = false;

            if (!string.IsNullOrEmpty(key))
            {
                if (key.Substring(0, 1) == ",")
                {
                    bl = true;
                }
            }
            if (key == null || key == "-1" || key == "root" || key.Length == 0 || bl)
            {
                MenuModel queryEnity = new MenuModel();
                queryEnity.customer_id = CurrentUserInfo.CurrentUser.customer_id;

                queryEnity.Reg_App_Id = pParentNodeID;
                if (!string.IsNullOrEmpty(pParentNodeID))
                {
                    queryEnity.Reg_App_Id = pParentNodeID.Trim(',');
                }
                units = unitService.GetMenuList(queryEnity, 0, 1000);
            }
            else
            {
                MenuModel queryEnity = new MenuModel();
                queryEnity.Parent_Menu_Id = key;
                if (!string.IsNullOrEmpty(key))
                {
                    string[] str = key.Split(',');
                    if (str != null && str.Length > 1)
                    {
                        queryEnity.Parent_Menu_Id = str[0];
                        queryEnity.Reg_App_Id     = str[1];
                    }
                }
                queryEnity.customer_id = CurrentUserInfo.CurrentUser.customer_id;
                units = unitService.GetMenuList(queryEnity, 0, 1000);
            }

            foreach (var item in units)
            {
                nodes.Add(item.Menu_Id, item.Menu_Name, item.Parent_Menu_Id, false);
            }
            return(nodes);
        }
Esempio n. 16
0
        /// <summary>
        /// 获取节点数据
        /// </summary>
        /// <param name="pParentNodeID"></param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            string status = "";

            if (Request("Status") != null && Request("Status") != "")
            {
                status = Request("Status");
            }
            //获取数据
            var url = ConfigurationManager.AppSettings["ALDApiURL"].ToString() + "/Gateway.ashx";

            var res = new ALDResponse();

            try
            {
                //拼json字符串不能有空格
                var resstr = JIT.Utility.Web.HttpClient.GetQueryString(url,
                                                                       "Action=GetALLALDCategories&ReqContent={\"Locale\":null,\"UserID\":\"\",\"BunessZoneID\":null,\"ClientID\":null,\"Platform\":null,\"Parameters\":null,\"Token\":null,\"CallBack\":null}");
                Loggers.Debug(new DebugLogInfo()
                {
                    Message = "调用ALD获取分类:" + resstr
                });
                res = resstr.DeserializeJSONTo <ALDResponse>();
                //    List<MallALDCategoryEntity> listAld = res.Data.DeserializeJSONTo<>();
            }
            catch (Exception ex)
            {
                Loggers.Exception(new ExceptionLogInfo(ex));
                throw new Exception("调用ALD平台失败:" + ex.Message);
            }
            //var bll = new ItemCategoryService(this.CurrentUserInfo);
            //  var list = bll.GetItemCagegoryList(status);
            var list = res.Data;
            //组织数据
            TreeNodes nodes = new TreeNodes();

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    TreeNode node = new TreeNode();
                    node.ID = item.CategoryID;
                    //如果父类id不为空,也不是-99,赋值给树id。否则树id为空
                    if (!string.IsNullOrEmpty(item.ParentID) && item.ParentID != "-99")
                    {
                        node.ParentID = item.ParentID;
                    }
                    node.Text   = item.CategoryName;
                    node.IsLeaf = true;
                    //
                    nodes.Add(node);
                }
            }
            //
            return(nodes);
        }
Esempio n. 17
0
 public void MidTree(TreeNodes root, ref List <int> list)
 {
     if (root == null)
     {
         return;
     }
     MidTree(root.left, ref list);
     list.Add(root.val);
     MidTree(root.right, ref list);
 }
        private void click(object obj)
        {
            ITreeNode selected = TreeNodes.FirstOrDefault()?.Children.FirstOrDefault(node => node.Id == 1500 && node.Parent != null && node.Children != null && node.Children.Any());

            selected = selected.Children[500];
            if (selected != null)
            {
                MySelectedItem = selected as TreeNode;
            }
        }
Esempio n. 19
0
        private void AddNode(TreeNodes targetNodes, string namePath, bool isNamespace)
        {
            var       targetPath  = namePath.Split('.');
            bool      validPath   = false;
            TreeNodes existsNodes = null;

            var validNode = from x in targetNodes.Nodes where x.Name.ToLower() == targetPath[0].ToLower() select x;

            if ((validNode != null) && (validNode.Count() > 0))
            {
                existsNodes = validNode.FirstOrDefault();
                validPath   = true;
            }

            if (!validPath)
            {
                TreeNodes childNodes = new TreeNodes
                {
                    Name        = targetPath[0],
                    AddStrings  = targetPath[0],
                    ItemType    = isNamespace ? ExpressionEditor.TreeNodes.NodeTypes.Namespace : ExpressionEditor.TreeNodes.NodeTypes.Primitive,
                    Parent      = targetNodes,
                    Description = isNamespace ? string.Format("Namespace {0}", targetPath[0]) : ""
                };
                targetNodes.AddNode(childNodes);

                if (isNamespace)
                {
                    var nextPath = namePath.Substring(targetPath[0].Length, namePath.Length - targetPath[0].Length);
                    if (nextPath.StartsWith("."))
                    {
                        nextPath = nextPath.Substring(1, nextPath.Length - 1);
                    }
                    if (!string.IsNullOrEmpty(nextPath.Trim()))
                    {
                        this.AddNode(childNodes, nextPath);
                    }
                }
            }
            else
            {
                if (isNamespace)
                {
                    var nextPath = namePath.Substring(targetPath[0].Length, namePath.Length - targetPath[0].Length);
                    if (nextPath.StartsWith("."))
                    {
                        nextPath = nextPath.Substring(1, nextPath.Length - 1);
                    }
                    if (!string.IsNullOrEmpty(nextPath.Trim()))
                    {
                        this.AddNode(existsNodes, nextPath);
                    }
                }
            }
        }
Esempio n. 20
0
        public void AddChildNodes(TreeNodes nodes, string ParentID)
        {
            UnitService      unitService = new UnitService(new SessionManager().CurrentUserLoginInfo);
            IList <UnitInfo> units;

            units = unitService.GetSubUnitsByDefaultRelationMode(ParentID);
            foreach (var item in units)
            {
                nodes.Add(item.Id, item.Name, item.Parent_Unit_Id, false);
                AddChildNodes(nodes, item.Id);
            }
        }
Esempio n. 21
0
        public int Method(TreeNodes root)
        {
            var list = new List <int>();

            MidTree(root, ref list);
            int minDiff = int.MaxValue;

            for (int index = 1; index < list.Count; index++)
            {
                minDiff = Math.Min(minDiff, list[index] - list[index - 1]);
            }
            return(minDiff);
        }
 public void Dispose()
 {
     RootNode.Dispose();
     NodesCounter = 0;
     PqNodeSelector.Clear();
     PqNodeSelector = null;
     NodesFrequency.Clear();
     NodesFrequency = null;
     TreeNodes.Clear();
     TreeNodes = null;
     TreePaths.Clear();
     TreePaths = null;
 }
Esempio n. 23
0
        ///// <summary>
        ///// 判断品牌是否有树
        ///// </summary>
        ///// <param name="pParentID">传入</param>
        ///// <returns>success是代表存在树</returns>
        //private string GetSupplierUnit(string pParentID)
        //{
        //    if (GetTreeByParentID("Brand", pParentID))
        //    {
        //        return "success";
        //    }
        //    return "failure";
        //}

        ///// <summary>
        ///// 获取结果集,Json 格式
        ///// </summary>
        ///// <param name="pParentID">传入ParentID</param>
        ///// <param name="pTree">传入</param>
        ///// <returns>Json格式的数据</returns>
        //private string GetBrandByParentID(string pParentID, string pTree, HttpContext pContext)
        //{
        //    ControlBrandEntity[] pBrand = new ControlBLL(new SessionManager().CurrentUserLoginInfo).
        //        GetBrandByClientID(pParentID);
        //    if (pTree == "success")
        //    {
        //        string pParentNodeID = "";
        //        bool pIsMultiSelect = false;
        //        bool pIsSelectLeafOnly = false;
        //        TreeNode[] pModel = null;
        //        InitParams(pContext, out pParentNodeID, out pIsMultiSelect, out pIsSelectLeafOnly, out pModel);
        //        TreeNodes nodes = new TreeNodes();
        //        if (pBrand != null && pBrand.Length > 0)
        //        {
        //            nodes = GetBrandTreeNodes(nodes, pBrand, "");
        //            return nodes.ToTreeStoreJSON(pIsMultiSelect, pIsSelectLeafOnly, pModel);
        //        }
        //    }
        //    else
        //    {
        //        return pBrand.ToJSON();
        //    }
        //    return "";
        //}

        /// <summary>
        /// 循环读取节点数据
        /// </summary>
        /// <param name="pModel">节点对象</param>
        /// <param name="pBrand">渠道对象集合</param>
        /// <param name="pBrandID">上一级的编号</param>
        /// <returns>返回节点对象信息</returns>
        private TreeNodes GetBrandTreeNodes(TreeNodes pModel, ControlBrandEntity[] pBrand, string pBrandID)
        {
            ControlBrandEntity[] Brand = pBrand.Where(i => i.ParentID.ToString() == pBrandID).ToArray();
            for (int i = 0; i < Brand.Length; i++)
            {
                if (Brand[i].ParentID.ToString() == pBrandID)
                {
                    pModel.Add(Brand[i].BrandID.ToString(), Brand[i].BrandName, Brand[i].ParentID.ToString(), true);
                    GetBrandTreeNodes(pModel, pBrand, Brand[i].BrandID.ToString());
                }
            }
            return(pModel);
        }
        /// <summary>
        /// Creates a Hierarchical structure reflecting the containment structure of the model.
        /// </summary>
        /// <returns></returns>
        private TreeNodes GetContainmentStructure()
        {
            Initialise();

            TreeNodes root = new TreeNodes();
            AddRelComposes();
            AddRelContained();

            root.Add(LocateProjectNode());

            // Clear?
            return root;
        }
Esempio n. 25
0
        public TreeNode(IfcRoot entity, bool isRoot, bool isLeaf)
        {
            IsRoot = isRoot;
            IsLeaf = isLeaf;
            if (!IsLeaf)
            {
                Children = new TreeNodes();
            }

            if (entity != null)
            {
                SetDefaults(entity);
            }
        }
Esempio n. 26
0
        public TreeNode(IfcRoot entity, bool isRoot, bool isLeaf)
        {
            IsRoot = isRoot;
            IsLeaf = isLeaf;
            if (!IsLeaf)
            {
                Children = new TreeNodes();
            }

            if (entity != null)
            {
                SetDefaults(entity);
            }
        }
        /// <summary>
        /// Creates a Hierarchical structure reflecting the containment structure of the model.
        /// </summary>
        /// <returns></returns>
        private TreeNodes GetContainmentStructure()
        {
            Initialise();

            TreeNodes root = new TreeNodes();

            AddRelComposes();
            AddRelContained();

            root.Add(LocateProjectNode());

            // Clear?
            return(root);
        }
        public void AddNode(object node)
        {
            var tNode = node as HuffmanNode;

            if (null != tNode)
            {
                TreeNodes.Add(tNode);
                NodesFrequency.Add(tNode.NodeValue, tNode.Frequincy);
            }
            else
            {
                throw new ArgumentNullException();
            }
        }
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();

            var service = new ZCourseBLL(new SessionManager().CurrentUserLoginInfo);
            IList <ZCourseEntity> data = new List <ZCourseEntity>();
            string content             = string.Empty;

            string key = string.Empty;

            if (Request("node") != null && Request("node") != string.Empty)
            {
                key = Request("node").ToString().Trim();
            }
            if (key == "root")
            {
                key = "";
            }

            var queryEntity = new ZCourseEntity();

            queryEntity.ParentId = key;
            //queryEntity.ApplicationId = Request("ApplicationId");
            queryEntity.OrderBy = "CourseName asc";

            data = service.GetCourses(queryEntity, 0, 1000);

            var jsonData = new JsonData();

            jsonData.totalCount = data.Count.ToString();
            jsonData.data       = data;

            var parentCode = string.Empty;

            if (data.Count > 0)
            {
                foreach (var item in data)
                {
                    nodes.Add(item.CourseId, item.CourseName,
                              item.ParentId,
                              item.CourseLevel == 2 ? true : false);
                }
            }
            //
            //var root = new TreeNodes();
            //root.Add(new TreeNode() { ID = "1", IsLeaf = false, Text = "1" });
            //root.Add(new TreeNode() { ID = "1_1", ParentID = "1", IsLeaf = false, Text = "1_1" });
            //root.Add(new TreeNode() { ID = "1_1_1", ParentID = "1_1", IsLeaf = false, Text = "1_1_1`" });
            return(nodes);
        }
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            string status = "";

            if (Request("Status") != null && Request("Status") != "")
            {
                status = Request("Status");
            }
            string bat_id = "";

            if (Request("bat_id") != null && Request("bat_id") != "")
            {
                bat_id = Request("bat_id");
            }
            //获取数据
            var bll        = new ItemCategoryService(this.CurrentUserInfo);
            var list       = bll.GetItemCagegoryList(status, bat_id);
            var parentList = bll.GetItemCagegoryList(status, "all");

            //组织数据
            TreeNodes nodes = new TreeNodes();

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    TreeNode node = new TreeNode();
                    node.ID = item.Item_Category_Id;
                    if (string.IsNullOrWhiteSpace(item.Parent_Id) == false && item.Parent_Id != "-99")
                    {
                        node.ParentID = item.Parent_Id;
                    }
                    node.Text         = item.Item_Category_Name;
                    node.Status       = item.Status;
                    node.IsLeaf       = true;
                    node.NodeLevel    = GetLevel(item.Parent_Id, parentList.ToList());
                    node.DisplayIndex = item.DisplayIndex == null ? 0 : (int)item.DisplayIndex;//排序字段,新加

                    //新添加的节点

                    node.create_time        = string.IsNullOrEmpty(item.Create_Time) ? "" :  DateTime.Parse(item.Create_Time).ToString("yyyy/MM/dd");//Convert.ToDateTime(item.Create_Time).ToShortDateString();
                    node.ImageUrl           = item.ImageUrl;
                    node.PromotionItemCount = item.PromotionItemCount;
                    nodes.Add(node);
                }
            }
            //?
            return(nodes);
        }
Esempio n. 31
0
 private Visual.TreeNode AddNode(TreeNodes nodes, XElement element)
 {
     Visual.TreeNode node = new Visual.TreeNode();
     node.IsExpanded = !_expandOnDemand;
     node.Element    = element;
     foreach (XElement child in element.Elements())
     {
         if (child.Name.LocalName.IndexOf(".") < 1)
         {
             AddNode(node.Children, child);
         }
     }
     nodes.Add(node);
     return(node);
 }
Esempio n. 32
0
        public void Del()
        {
            Window    dialog     = OpenGroupsDialog();
            Tree      tree       = dialog.Get <Tree>("uxAddressTreeView");
            TreeNode  root       = tree.Nodes[0];
            TreeNodes groupNodes = root.Nodes;
            TreeNode  delNode    = groupNodes[0];

            delNode.Click();
            Window delGropuDialog = DelGroupsDialog(dialog);

            delGropuDialog.Get <RadioButton>("uxDeleteAllRadioButton").Click();
            CloseDelGroupsDialog(delGropuDialog);
            CloseGroupsDialog(dialog);
        }
Esempio n. 33
0
        private void BeforeSyncForm_Load(object sender, EventArgs e)
        {
            beforeSyncController = new BeforeSyncController();
            var beforeSyncRootCategories = beforeSyncController.Load();

            var treeNodes = new TreeNodes();
            foreach (var beforeSyncRootCategory in beforeSyncRootCategories)
            {
                var node = new BeforeSyncCatNode(beforeSyncRootCategory);
                treeNodes.Add(node);
            }

            treeBeforeSync.DataSource = treeNodes;
            treeBeforeSync.ExpandAll();
        }
        protected void window_GetChildNodes(object sender, EventArgs e)
        {
            TreeNodes level = sender as TreeNodes;
            for (int idx = 0; idx < 5; idx++)
            {
                TreeNode i = new TreeNode();
                i.ID = level.ID + idx;
                i.Text = "Window " + idx;
                level.Controls.Add(i);

                TreeNodes l = new TreeNodes();
                l.ID = level.ID + "LL" + idx;
                l.GetChildNodes += window_GetChildNodes;
                i.Controls.Add(l);
            }
        }
Esempio n. 35
0
        private void AddNestedTypeNode(TreeNodes targetNodes, Type target)
        {
            System.Threading.Tasks.Parallel.ForEach(target.GetNestedTypes(BindingFlags.Public | BindingFlags.Static |
                                                                          BindingFlags.Instance), (targetmember) =>
            {
                var memberNodes = new TreeNodes()
                {
                    Name       = targetmember.Name,
                    AddStrings = targetmember.Name,
                    ItemType   = ExpressionEditor.TreeNodes.NodeTypes.Method,
                    Parent     = targetNodes
                };

                targetNodes.AddNode(memberNodes);
            });
        }
Esempio n. 36
0
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();

            var cityService          = new CityService(new SessionManager().CurrentUserLoginInfo);
            IList <CityInfo> data    = new List <CityInfo>();
            string           content = string.Empty;

            string key = string.Empty;

            if (Request("node") != null && Request("node") != string.Empty)
            {
                key = Request("node").ToString().Trim();
            }
            if (key == "root")
            {
                key = "";
            }

            if (key.Length == 2)//更具省份获取城市
            {
                data = cityService.GetCityListByProvince(key);
            }
            else if (key.Length == 4)//更具城市获取区县
            {
                data = cityService.GetAreaListByCity(key);
            }
            else if (key.Length == 0)//
            {
                data = cityService.GetProvinceList();
            }

            var jsonData = new JsonData();

            jsonData.totalCount = data.Count.ToString();
            jsonData.data       = data;

            var parentCode = string.Empty;

            foreach (var item in data)
            {
                nodes.Add(item.City_Code, item.City_Name,
                          GetParentCode(item.City_Code),
                          item.City_Code.Length == 6 ? true : false);
            }
            return(nodes);
        }
        /// <summary>
        /// Groups all elements by their Family Type
        /// </summary>
        /// <returns></returns>
        private TreeNodes GetComponentStructure()
        {
            TreeNodes tree = new TreeNodes();

            var familyTypes = from t in GetFamilyElements() orderby t.Name select t;

            foreach (Type type in familyTypes)
            {
                FamilyNode family = new FamilyNode();
                family.Name = type.Name;

                LoadFamilyElements(type, family);

                tree.Add(family);
            }

            return tree;
        }
 private void BuildChildren(Node node, TreeNode treeNode)
 {
     TreeNodes nodes = new TreeNodes();
     nodes.ID = "ch_" + treeNode.ID;
     treeNode.Controls.Add(nodes);
     foreach (Node idx in node)
     {
         string name = idx["Name"].Get<string>();
         string fullName = idx["FullName"].Get<string>();
         TreeNode n = new TreeNode();
         n.CssClass = node.Name;
         n.ID = fullName.Replace(".", "_").Replace(" ", "").Replace("+", "");
         n.Xtra = idx.DNA;
         n.Text = name;
         n.Tooltip = fullName;
         nodes.Controls.Add(n);
     }
 }
        /// <summary>
        /// Searches the tree recursive and looks for the node with the given name
        /// </summary>
        /// <param name="nodesToSearch">the nodes to search</param>
        /// <param name="nodeText">the text on the node we're looking for</param>
        /// <returns></returns>
        private static TreeNode FindTreeNodeByText(TreeNodes nodesToSearch, string nodeText)
        {
            TreeNode nodeToReturn = null;

            foreach (var node in nodesToSearch)
            {
                if (node.Text == nodeText)
                {
                    nodeToReturn = node;
                    break;
                }

                if ((node.Nodes.Count > 0))
                {
                    nodeToReturn = FindTreeNodeByText(node.Nodes, nodeText);
                }
            }

            return nodeToReturn;
        }
Esempio n. 40
0
        private void BuildLevel(Control level, IEnumerable<Node> current)
        {
            foreach (Node idx in current)
            {
                TreeNode t = new TreeNode {ID = "n" + idx.DNA.Replace("-", ""), Xtra = idx.DNA};
                if (idx.Count > 0)
                {
                    if (idx.Count > 1 || idx[0].Name != "Params")
                    {
                        TreeNodes children = new TreeNodes {Xtra = idx.DNA, ID = "l" + idx.DNA.Replace("-", "x")};
                        children.GetChildNodes +=
                            delegate(object sender, EventArgs e)
                            {
                                TreeNodes caller = sender as TreeNodes;
                                if (caller == null) 
                                    return;
                                string dna = caller.Xtra;
                                Node tmp = MenuItems.Find(dna);
                                BuildLevel(caller, tmp);
                            };
                        t.Controls.Add(children);
                    }
                }

                // Creating the LinkButton as a child of TreeNode which is the thing 
                // you click to actually "select" a node...
                LinkButton btn = new LinkButton
                {
                    ID = "b" + idx.DNA.Replace("-", ""),
                    Text = Language.Instance[idx.Name],
                    CssClass = "treeLinkButton",
                    Xtra = idx.DNA
                };
                btn.Click += btn_Click;
                t.Controls.Add(btn);

                // Adding TreeNode to parent...
                level.Controls.Add(t);
            }
        }
Esempio n. 41
0
        internal void BuildSupliersTree()
        {
            var suppliers = context.SupplierSet.ToList();

            // чтобы захешировать и работало быстрее
            var supplierCategories = context.SupplierCategorySet.ToList();
            var supplierProducts = context.SupplierProductSet.ToList();

            var supNodes = new TreeNodes();

            foreach (var s in suppliers)
            {
                var supNode = new SupNode(s);
                supNodes.Add(supNode);
            }

            treeSuppliers.DataSource = supNodes;
            treeSuppliers.Refresh();
            if (treeSuppliers.Nodes.Count > 0)
            {
                treeSuppliers.Nodes[0].Expanded = true;
            }
        }
Esempio n. 42
0
        private void CreateSingleMenuItem(
            Node node,
            Control parent)
        {
            TreeNode item = new TreeNode
            {
                ID = "node" + node.DNA.Replace("-", "x"),
                Text = Language.Instance[node.Name]
            };

            bool hasTrigger = false;

            if (node.Count > 0)
            {
                // Checking to see if the only child node is the "params node"...
                if (!(node.Count == 1 && node["Params"].Value != null))
                {
                    TreeNodes l = new TreeNodes {ID = "ch" + node.DNA.Replace("-", "x")};
                    item.Controls.Add(l);
                    l.Xtra = node.DNA;
                    l.GetChildNodes += l_GetChildNodes;
                    item.Xtra = node.DNA;
                }
                else
                    hasTrigger = true;
            }
            else
            {
                hasTrigger = true;
            }
            if (hasTrigger)
            {
                if (node["Params"].Value != null)
                {
                    item.Xtra = "trigger" +
                        node.Value +
                        "-__params" +
                        node["Params"].Value;
                }
                else
                {
                    item.Xtra = "trigger" + node.Value;
                }
            }
            parent.Controls.Add(item);
        }
Esempio n. 43
0
        private void CreateLevel(TreeNodes level, LazyList<ForumPost> list, int commentToShow, int curLevel)
        {
            list.Sort(
                delegate(ForumPost left, ForumPost right)
                {
                    if (left.Score == right.Score)
                        return left.When.CompareTo(right.When);
                    return right.Score.CompareTo(left.Score);
                });
            curLevel += 1;
            foreach (ForumPost idx in list)
            {
                _commentCount += 1;
                TreeNode n = new TreeNode();
                n.ID = "pst" + idx.ID;
                if (curLevel > 11)
                {
                    n.Load +=
                        delegate(object sender, EventArgs e)
                        {
                            TreeNode n1 = sender as TreeNode;
                            if (!n1.CssClass.Contains("tree-more"))
                                n1.CssClass += " tree-more";
                        };
                }

                Label l = new Label();
                l.ID = "hdr" + idx.ID;
                l.Text = idx.Header;
                l.CssClass = "headerTxtComment";
                l.Style[Styles.width] = (350 - (Math.Min(curLevel, 11) * 16)) + "px";
                n.Controls.Add(l);

                Label lblDate = new Label();
                lblDate.ID = "ldta" + idx.ID;
                lblDate.CssClass = "dateLbl";
                DateTime dateTmp = idx.When;

                // Intentionally deferring Text property to get an *UPDATED* text value of time...!
                lblDate.Load +=
                    delegate(object sender, EventArgs e)
                    {
                        (sender as Label).Text = DateFormatter.FormatDate(dateTmp);
                    };
                n.Controls.Add(lblDate);

                Label lblUser = new Label();
                lblUser.ID = "lusr" + idx.ID;
                lblUser.CssClass = "userLbl";
                if (idx.IsRegisteredPosting)
                {
                    lblUser.Text = string.Format("<a href=\"authors/{0}{2}\">{1}</a>",
                        idx.GetNameOfPoster().Replace(".", "--"),
                        idx.GetNameOfPoster(),
                        ConfigurationManager.AppSettings["DefaultPageExtension"]);
                }
                else
                {
                    lblUser.Text = idx.GetNameOfPoster();
                }
                n.Controls.Add(lblUser);

                Label lblScore = new Label();
                lblScore.ID = "lscr" + idx.ID;
                lblScore.CssClass = "scoreLbl";
                lblScore.Text = FormatScore(idx.Score);
                n.Controls.Add(lblScore);

                Panel pnl = new Panel();
                pnl.ID = "pnlWrp" + idx.ID;
                pnl.CssClass = "bodyOfCommentWrp";

                Panel pnlInner = new Panel();
                pnlInner.ID = "bdy" + idx.ID;
                if (idx.ID == commentToShow)
                {
                    pnl.Xtra = "visible";
                    PreviouslyShownComment = pnl.ID;
                }
                else
                    pnl.Style[Styles.display] = "none";
                pnlInner.CssClass = "bodyOfComment";
                pnlInner.Style[Styles.left] = ((Math.Min(curLevel, 11) * 16)).ToString() + "px";
                pnlInner.Style[Styles.marginRight] = (25 + (Math.Min(curLevel, 11) * 16)).ToString() + "px";
                Label ltext = new Label();
                ltext.ID = "lTxt" + idx.ID;
                string bodyStr = FormatComment(idx);
                bool hasFound = true;
                while (hasFound)
                {
                    if (bodyStr.Contains("\n\n"))
                    {
                        bodyStr = bodyStr.Replace("\n\n", "\n");
                    }
                    else
                        hasFound = false;
                }
                string bodyStrFormatted = "<p";
                bool hasOpened = false;
                bool isFirst = true;
                foreach (char idxChar in bodyStr)
                {
                    if (hasOpened || isFirst)
                    {
                        isFirst = false;
                        if (idxChar == ':')
                            bodyStrFormatted += " class=\"quote\">";
                        else
                            bodyStrFormatted += " class=\"no-quote\">";
                        hasOpened = false;
                        bodyStrFormatted += idxChar;
                    }
                    else if (idxChar == '\n')
                    {
                        bodyStrFormatted += "</p><p";
                        hasOpened = true;
                    }
                    else
                    {
                        bodyStrFormatted += idxChar;
                    }
                }
                bodyStrFormatted += "</p>";
                ltext.Text = bodyStrFormatted;
                pnlInner.Controls.Add(ltext);
                pnl.Controls.Add(pnlInner);
                n.Controls.Add(pnl);

                // Social parts + reply button
                Panel pnlSocial = new Panel();
                pnlSocial.ID = "soc" + idx.ID;
                pnlSocial.CssClass = "downRight";

                if (AllowVoting)
                {
                    // Like button
                    ExtButton like = new ExtButton();
                    like.ID = "lik" + idx.ID;
                    like.CssClass = "button";
                    like.Xtra = idx.ID.ToString();
                    like.Click += like_Click;
                    like.Text = Language.Instance["Like", null, "Like"];
                    pnlSocial.Controls.Add(like);

                    // Dislike button
                    ExtButton dislike = new ExtButton();
                    dislike.ID = "dis" + idx.ID;
                    dislike.CssClass = "button";
                    dislike.Xtra = idx.ID.ToString();
                    dislike.Click += dislike_Click;
                    dislike.Text = Language.Instance["Dislike", null, "Dislike"];
                    pnlSocial.Controls.Add(dislike);
                }

                // Reply button
                ExtButton replyButton = new ExtButton();
                replyButton.ID = "btn" + idx.ID;
                replyButton.CssClass = "button";
                replyButton.Xtra = idx.ID.ToString();
                replyButton.Click += replyButton_Clicked;
                replyButton.Text = Language.Instance["Reply", null, "Reply"];
                pnlSocial.Controls.Add(replyButton);

                if (!string.IsNullOrEmpty(Users.LoggedInUserName))
                {
                    User user = User.SelectFirst(Criteria.Eq("Username", Users.LoggedInUserName));
                    if (user.InRole("Administrator"))
                    {
                        // Delete button
                        ExtButton deleteButton = new ExtButton();
                        deleteButton.ID = "delBtn" + idx.ID;
                        deleteButton.CssClass = "button";
                        deleteButton.Xtra = idx.ID.ToString();
                        deleteButton.Click += deleteButton_Clicked;
                        deleteButton.Text = Language.Instance["Delete", null, "Delete"];
                        pnlSocial.Controls.Add(deleteButton);
                    }
                }

                pnlInner.Controls.Add(pnlSocial);

                level.Controls.Add(n);
                if (idx.Replies.Count > 0)
                {
                    if (curLevel <= 10)
                    {
                        TreeNodes children = new TreeNodes();
                        children.Expanded = true;
                        children.ID = "chl" + idx.ID;
                        CreateLevel(children, idx.Replies, commentToShow, curLevel);
                        n.Controls.Add(children);
                    }
                    else
                    {
                        // We do NOT indent more than 10 levels...!
                        // After 10 levels, we get a funny folder icon to indicate 
                        // that we're at more than 10 levels...!
                        CreateLevel(level, idx.Replies, commentToShow, curLevel);
                    }
                }
            }
        }
Esempio n. 44
0
 private void GetTargets(ITreeNode targetData, ref ShopCatNode targetShopCatNode, ref TreeNodes targetCollection)
 {
     if (targetData == null)
     {
         var shopRoot = treeShop.DataSource as TreeNodes;
         targetCollection = shopRoot;
     }
     else if (targetData is ShopCatNode)
     {
         targetShopCatNode = targetData as ShopCatNode;
         targetCollection = targetShopCatNode.Childs;
     }
     else if (targetData is ShopProdNode)
     {
         targetShopCatNode = (targetData as ShopProdNode).Parent as ShopCatNode;
         targetCollection = targetShopCatNode.Childs;
     }
 }
Esempio n. 45
0
        private void BuildShopTree()
        {
            var shopCats = context.ShopCategorySet.Where(c => c.Parent == null).ToList();
            var shopNodes = new TreeNodes();

            foreach (var s in shopCats)
            {
                var supNode = new ShopCatNode(s, null);
                shopNodes.Add(supNode);
            }

            treeShop.DataSource = shopNodes;
            treeShop.Refresh();
            if (treeSuppliers.Nodes.Count > 0)
            {
                treeSuppliers.Nodes[0].Expanded = true;
            }
        }
Esempio n. 46
0
        private void DropShopCatNode(ShopCatNode sourceCatNode, ShopCatNode targetCatNode, TreeNodes targetCollection)
        {
            var sourceShopCat = sourceCatNode.Base;
            var targetShopCat = targetCatNode == null ? null : targetCatNode.Base;

            bool mergeCategories = false;
            if (targetCatNode != null)
            {
                mergeCategories = MessageBox.Show("Да - Слить, Нет - Добавить?", "Слияние", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
            }

            if (mergeCategories)
                sourceShopCat.Merge(targetShopCat);

            else
                sourceShopCat.Move(targetShopCat);

            context.SaveChanges();

            var rootTreeNodes = treeShop.DataSource as TreeNodes;
            TreeNodes sourceContainer = sourceCatNode.Parent == null ? rootTreeNodes : sourceCatNode.Parent.Childs;
            sourceContainer.Remove(sourceCatNode);

            if (mergeCategories) return;

            targetCollection.Add(sourceCatNode);
            sourceCatNode.Parent = targetCatNode;
        }
Esempio n. 47
0
        //private void InternationalDropNodes(TreeListNode sourceNode, TreeListNode targetNode)
        //{
        //    try
        //    {
        //        var sourceData = GetData(sourceNode);
        //        var targetData = GetData(targetNode);
        //        ShopCatNode targetShopCatNode = null;
        //        TreeNodes targetCollection = null;
        //        GetTargets(targetData, ref targetShopCatNode, ref targetCollection);
        //        if (sourceData is SupNode)
        //        {
        //            DropSupNode(sourceData as SupNode, targetShopCatNode, targetCollection);
        //        }
        //        else if (sourceData is SupCatNode)
        //        {
        //            DropSupCatNode(sourceData as SupCatNode, targetShopCatNode, targetCollection);
        //        }
        //        else if (sourceData is SupProdNode)
        //        {
        //            DropSupProdNode(sourceData as SupProdNode, targetShopCatNode, targetCollection);
        //        }
        //        treeShop.RefreshDataSource();
        //    }
        //    catch (Exception ex)
        //    {
        //        throw;
        //    }
        //}
        private void DropSupProdNode(SupProdNode supProdNode, ShopCatNode parentShopCatNode, TreeNodes targetCollection)
        {
            if (parentShopCatNode == null) return;

            var newShopProd = supProdNode.Base.CreateShopProduct(parentShopCatNode.Base);
            context.SaveChanges();
            var newShopProdNode = new ShopProdNode(newShopProd, parentShopCatNode);
            targetCollection.Add(newShopProdNode);
        }
Esempio n. 48
0
        private void DropShopProdNode(ShopProdNode shopProdNode, ShopCatNode targetShopCatNode, TreeNodes targetCollection)
        {
            if (targetShopCatNode == null) return;

            shopProdNode.Base.Move(targetShopCatNode.Base);
            context.SaveChanges();

            shopProdNode.Parent.Childs.Remove(shopProdNode);
            targetCollection.Add(shopProdNode);
            shopProdNode.Parent = targetShopCatNode;
        }
Esempio n. 49
0
        private void DropSupCatNode(ITreeNode sourceData, ShopCatNode parentShopCatNode, TreeNodes targetCollection)
        {
            var supCatNode = sourceData as SupCatNode;
            var parentShopCat = parentShopCatNode == null ? null : parentShopCatNode.Base;

            bool mergeCategories = false;
            if (parentShopCatNode != null)
            {
                mergeCategories = MessageBox.Show("Да - Слить, Нет - Добавить?", "Слияние", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;
            }

            var newShopCategory = supCatNode.Base.CreateShopCategory(parentShopCat, mergeCategories);
            context.SaveChanges();

            var newShopCatNode = new ShopCatNode(newShopCategory, parentShopCatNode);
            targetCollection.Add(newShopCatNode);
        }
Esempio n. 50
0
        private void DropSupNode(SupNode supNode, ShopCatNode parentShopCatNode, TreeNodes targetCollection)
        {
            List<ShopCategory> newShopCategories = supNode.Base.CreateShopCategories(parentShopCatNode.Base);

            context.SaveChanges();

            targetCollection.Clear();
            foreach (var newShopCategory in newShopCategories)
            {
                var newShopCatNode = new ShopCatNode(newShopCategory, parentShopCatNode);
                targetCollection.Add(newShopCatNode);
            }
        }