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;
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
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));
        }
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();

            ItemCategoryService itemService = new ItemCategoryService(
                new SessionManager().CurrentUserLoginInfo);
            IList <ItemCategoryInfo> list = new List <ItemCategoryInfo>();

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

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

            if (key == "root" || key.Length == 0)
            {
                key = "-99";
            }
            list = itemService.GetItemCategoryListByParentId(key);

            var jsonData = new JsonData();

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

            foreach (var item in list)
            {
                if (item.Status == "1")
                {
                    nodes.Add(item.Item_Category_Id, item.Item_Category_Name, item.Parent_Id, false);
                }
            }
            DataSet ds = itemService.GetItemsBytype(key);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0] != null)
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    nodes.Add(item["item_id"].ToString(), item["item_name"].ToString(), key, false);
                }
            }
            return(nodes);
        }
示例#7
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();
            }
        }
示例#8
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);
        }
示例#9
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);
        }
示例#10
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);
            }
        }
示例#11
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;
        }
        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>
        /// 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);
        }
        /// <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);
        }
示例#17
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);
 }
示例#18
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();
        }
示例#19
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);
        }
示例#20
0
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();
            //nodes.Add("1", "上海市", null, false);
            //nodes.Add("2", "普陀区", "1", true);
            //nodes.Add("3", "长宁区", "1", true);
            //nodes.Add("4", "静安区", "1", true);
            //nodes.Add("5", "浦东新区", "1", true);
            //nodes.Add("6", "浙江省", null, false);
            //nodes.Add("7", "杭州市", "6", true);
            //nodes.Add("8", "1浙江省", null, true);
            //nodes.Add("9", "2杭州市", "8", true);
            //nodes.Add("10", "3杭州市", "9", true);
            //nodes.Add("11", "1杭州市", null, false);

            string             typeCode           = "总部";
            UnitService        unitService        = new UnitService(new SessionManager().CurrentUserLoginInfo);
            LoggingSessionInfo loggingSessionInfo = new SessionManager().CurrentUserLoginInfo;
            IList <UnitInfo>   units;

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

            key = pParentNodeID;

            var userUnitId = new SessionManager().CurrentUserLoginInfo.CurrentUserRole.UnitId;

            if (key == null || key == "-1" || key == "root" || key.Length == 0) //如果父节点为空,就取总部的数据
            {
                // units = unitService.GetUnitInfoListByTypeCode(typeCode);//这是原来的方法,就是extjs里只取根节点的方法,
                //现在需要根据用户的userID和customerID来取他权限下面的角色
                //一次吧下面所有的门店信息都取出来了
                units = unitService.GetUnitByUser(loggingSessionInfo.ClientID, loggingSessionInfo.UserID);//获取当前登录人的门店
            }
            else
            {
                units = unitService.GetSubUnitsByDefaultRelationMode(key);
            }

            foreach (var item in units)
            {
                nodes.Add(item.Id, item.Name, item.Parent_Unit_Id, false);
                //  AddChildNodes(nodes, item.Id);  //把子节点也添加进来
            }
            return(nodes);
        }
        protected override Utility.Web.ComponentModel.TreeNodes GetNodes(string pParentNodeID)
        {
            string status = "";

            //var form = Request("form").DeserializeJSONTo<MenuQueryEntity>();

            if (Request("Status") != null && Request("Status") != "")
            {
                status = Request("Status");
            }
            //获取数据
            var       appSysService = new AppSysService(CurrentUserInfo);
            MenuModel queryEntity   = new MenuModel();

            string[] str = pParentNodeID.Split(',');
            if (str != null && str.Length > 1)
            {
                queryEntity.Reg_App_Id = str[1];
            }

            var list = appSysService.GetMenuList(queryEntity, 0, 1000);
            //组织数据
            TreeNodes nodes = new TreeNodes();

            if (list != null && list.Count > 0)
            {
                foreach (var item in list)
                {
                    TreeNode node = new TreeNode();
                    node.ID = item.Menu_Id;
                    //if (item.Menu_Level != 1)
                    //{
                    node.ParentID = item.Parent_Menu_Id;
                    //}

                    //node.Text = item.Menu_Name;
                    node.Text   = "  <a class=\"pointer z_col_light_text\" onclick=\"fnView('" + item.Menu_Id + "')\">" + item.Menu_Name + "</a>";
                    node.IsLeaf = true;
                    //
                    nodes.Add(node);
                }
            }
            //
            return(nodes);
        }
示例#22
0
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            // int hasShop = 0;
            //if (Request("hasShop") != null && Request("hasShop") != "")
            //    hasShop = Convert.ToInt32(Request("hasShop"));
            var t_TypeBLL = new T_TypeBLL(this.CurrentUserInfo);
            var typeTable = t_TypeBLL.GetTypeTree(this.CurrentUserInfo.ClientID, this.CurrentUserInfo.UserID);
            var typeList  = new List <T_TypeEntity>();

            if (typeTable != null && typeTable.Tables.Count != 0)
            {
                typeList = DataTableToObject.ConvertToList <T_TypeEntity>(typeTable.Tables[0]);//直接根据所需要的字段反序列化
            }
            //组织数据
            TreeNodes nodes          = new TreeNodes();
            string    parent_type_id = "-99";

            if (typeList != null && typeList.Count > 0)
            {
                foreach (var item in typeList)
                {
                    TreeNode node = new TreeNode();
                    node.ID = item.type_id;
                    //if (string.IsNullOrWhiteSpace(item.Parent_Id) == false && item.Parent_Id != "-99")
                    //{
                    node.ParentID = parent_type_id;
                    //  }
                    node.Text      = item.type_name;
                    node.Status    = item.status.ToString();
                    node.IsLeaf    = false;
                    node.NodeLevel = (int)item.type_Level;//GetLevel(item.Parent_Id);
                    //成为下一级别的父节点*****
                    parent_type_id = item.type_id;
                    // node.DisplayIndex = item.DisplayIndex == null ? 0 : (int)item.DisplayIndex;//排序字段,新加

                    //新添加的节点
                    //  node.create_time = string.IsNullOrEmpty(item.c) ? "" : Convert.ToDateTime(item.Create_Time).ToShortDateString();
                    //node.ImageUrl = item.ImageUrl;
                    //node.PromotionItemCount = item.PromotionItemCount;
                    nodes.Add(node);
                }
            }
            //
            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;
        }
示例#24
0
        /// <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);
        }
示例#25
0
        private void GetServer()
        {
            var watch = new Stopwatch();

            watch.Start();

            var serverNodes = new HashSet <uint>();
            var xml         = XDocument.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config/servers.config"));

            xml.Descendants("Server").ToList().ForEach(item =>
            {
                var serverModel = new MongoServerModel
                {
                    ID   = MongoConst.GetRandomId(),
                    IP   = item.Attribute("IP").Value,
                    Port = item.Attribute("Port").Value
                };

                //用来做并行计算的临时集合
                serverNodes.Add(serverModel.ID);

                //树节点
                TreeNodes.Add(new MongoTreeNode
                {
                    ID   = serverModel.ID,
                    PID  = 0,
                    Name = serverModel.Name,
                    Type = MongoTreeNodeType.Server
                });

                //对象节点
                MongoObjects.Add(serverModel.ID, serverModel);
            });

            //并行
            Parallel.ForEach(serverNodes, id => GetDB(id));
            //循环
            //serverNodes.ToList().ForEach(id => GetDB(id));

            LogManager.GetLogger("InfoLog").Info(string.Format("**获取所有对象共花费了大约{0}毫秒的时间", watch.ElapsedMilliseconds));
            watch.Stop();
        }
        public TreeViewModel()
        {
            int id = 1;

            TreeNodes.Add(_rootNode);
            for (var i = 0; i < 2000; ++i)
            {
                _rootNode.Children.Add(new TreeNode(i.ToString(), _rootNode, ++id));
            }

            foreach (var child in _rootNode.Children)
            {
                for (var i = 0; i < 2000; ++i)
                {
                    child.Children.Add(new TreeNode(i.ToString(), (TreeNode)child, ++id));
                }
            }

            _rootNode.IsExpanded = true;
        }
        protected override Utility.Web.ComponentModel.TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes               nodes   = new TreeNodes();
            LNewsTypeBLL            service = new LNewsTypeBLL(new SessionManager().CurrentUserLoginInfo);
            IList <LNewsTypeEntity> units;

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

            key = pParentNodeID;

            var orderBy = new OrderBy[] {
                new OrderBy {
                    FieldName = "CreateTime", Direction = OrderByDirections.Desc
                }
            };

            if (key == null || key == "-1" || key == "root" || key.Length == 0)
            {
                units = service.QueryByEntity(new LNewsTypeEntity()
                {
                    IsDelete   = 0,
                    CustomerId = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }
            else
            {
                units = service.QueryByEntity(new LNewsTypeEntity()
                {
                    IsDelete     = 0,
                    ParentTypeId = key,
                    CustomerId   = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }

            foreach (var item in units)
            {
                nodes.Add(item.NewsTypeId, item.NewsTypeName, item.ParentTypeId, false);
            }
            return(nodes);
        }
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes             nodes   = new TreeNodes();
            LEventsBLL            service = new LEventsBLL(new SessionManager().CurrentUserLoginInfo);
            IList <LEventsEntity> units;

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

            key = pParentNodeID;

            var orderBy = new OrderBy[] {
                new OrderBy {
                    FieldName = "DisplayIndex", Direction = OrderByDirections.Asc
                }
            };

            if (key == null || key == "-1" || key == "root" || key.Length == 0)
            {
                units = service.QueryByEntity(new LEventsEntity()
                {
                    IsSubEvent = 0,
                    CustomerId = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }
            else
            {
                units = service.QueryByEntity(new LEventsEntity()
                {
                    ParentEventID = key,
                    CustomerId    = this.CurrentUserInfo.CurrentUser.customer_id
                }, orderBy);
            }

            foreach (var item in units)
            {
                nodes.Add(item.EventID, item.Title, item.ParentEventID, false);
            }
            return(nodes);
        }
示例#29
0
        public override void Update()
        {
            Folder.Update();

            List <Data.Item> currentItems = new List <Data.Item>();

            foreach (Data.Item item in Folder.Items.Values)
            {
                currentItems.Add(item);
            }

            List <NavigatePanelNode> removeNodes = new List <NavigatePanelNode>();

            foreach (NavigatePanelNode node in TreeNodes)
            {
                if (currentItems.Contains(node.Item))
                {
                    currentItems.Remove(node.Item);
                }
                else
                {
                    removeNodes.Add(node);
                }
            }

            foreach (NavigatePanelNode nodes in removeNodes)
            {
                TreeNodes.Remove(nodes);
            }

            foreach (Data.Item item in currentItems)
            {
                if (item == null)
                {
                    continue;
                }
                TreeNodes.Add(item.CreateNode());
            }
        }
示例#30
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;
            }
        }
示例#31
0
        public static TreeNode DoIt(string formula)
        {
            var lex = new abevformulaLexer(new ANTLRStringStream(formula));
            CommonTokenStream tokens = new CommonTokenStream(lex);

            var parser = new abevformulaParser(tokens);

            var items = new TreeNodes();

            try
            {
                var ret = parser.startIt();
                if (ret.Tree == null)
                {
                    Console.WriteLine("Unable to parse formula (no tree): {0}", formula);
                    return(null);
                }
                var ct = (ret.Tree as CommonTree);

                foreach (var c in ct.Children)
                {
                    var tn = new TreeNode(c.ToString());
                    items.Add(tn);
                    BuildTree(tn, c);
                }
            }
            catch (RecognitionException e)
            {
                Console.WriteLine("Unable to parse formula (exception occured): {0}, exception:", formula, e.ToString());
                return(null);
            }
            var root = new TreeNode("FUNC");

            root.Children.AddRange(items);
            return(root);
        }
示例#32
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);
        }
示例#33
0
        /// <summary>
        /// 获取子节点数据
        /// </summary>
        /// <param name="pParentNodeID">父节点ID</param>
        /// <returns></returns>
        protected override TreeNodes GetNodes(string pParentNodeID)
        {
            TreeNodes nodes = new TreeNodes();

            nodes.Add("2", "普陀区", "1", true);
            nodes.Add("3", "长宁区", "1", true);
            nodes.Add("4", "静安区", "1", true);
            nodes.Add("5", "浦东新区", "1", true);
            nodes.Add("6", "浙江省", null, false);
            nodes.Add("7", "杭州市", "6", true);
            nodes.Add("8", "1浙江省", null, true);
            nodes.Add("9", "2杭州市", "8", true);
            nodes.Add("10", "3杭州市", "9", true);
            nodes.Add("11", "1杭州市", null, true);
            nodes.Add("1", "上海市", null, false);
            return(nodes);
        }
示例#34
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;
            }
        }
        internal void ExecuteQueries()
        {
            foreach (var query in Queries)
            {
                var operation = query.Operation;

                var adder   = query.Low;
                var operand = (query.Low + RunningSum) % M;

                var high      = query.High;
                var highRange = (high + RunningSum) % M;
                if (operation != Operations.Sum)
                {
                    highRange = 0;
                }

                switch (operation)
                {
                case Operations.Add:
                    if (!TreeNodes.Any() || Root == null)
                    {
                        TreeNodes.Add(new TreeNode(operand));
                        Root = TreeNodes[0];
                        UpdateSum(Root);
                        break;
                    }
                    SplayInsert(operand, Root);
                    break;

                case Operations.Find:
                    if (!TreeNodes.Any())
                    {
                        QueryResults.Add(Results.NotFound);
                        break;
                    }
                    var foundNode = SplayFind(operand, Root);
                    if (foundNode == null || foundNode.Value != operand)
                    {
                        QueryResults.Add(Results.NotFound);
                        break;
                    }
                    QueryResults.Add(Results.Found);
                    break;

                case Operations.Del:
                    if (!TreeNodes.Any())
                    {
                        break;
                    }
                    SplayDel(operand);
                    break;

                case Operations.Sum:
                    if (!TreeNodes.Any())
                    {
                        QueryResults.Add("0");
                        break;
                    }
                    var rangeSum = SumRange(operand, highRange);
                    QueryResults.Add(rangeSum.ToString());
                    RunningSum = rangeSum;
                    break;
                }
            }
        }
示例#36
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;
        }
示例#37
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);
        }
示例#38
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;
        }
示例#39
0
 /// <summary>
 /// Adds TreeNode to collection of related nodes.
 /// </summary>
 /// <param name="node">Node to add</param>
 public void AddTreeNode(TreeNode node)
 {
     // Add TreeNode to collection
     TreeNodes.Add(node);
     RefreshTreeNodes();
 }
示例#40
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);
            }
        }