Exemplo n.º 1
0
        public void GetChildNodes(List <Mes_Sys_Organization> list, Mes_Sys_Organization node, StringBuilder jsonStr)
        {
            List <Mes_Sys_Organization> childList = list.Where(p => p.ParentID == node.ID).ToList();

            if (childList == null || childList.Count == 0)
            {
                return;
            }

            foreach (var item in childList)
            {
                jsonStr.Append(_treeItemContent.Replace("[0]", item.ID.ToString())
                               .Replace("[1]", item.ParentID.ToString())
                               .Replace("[2]", item.OrgName)
                               .Replace("[3]", "true")
                               .Replace("[4]", item.OrgLevel.ToString())
                               );
            }
        }
Exemplo n.º 2
0
        public void GetChildNodesByList(List <Mes_Sys_Organization> list, Mes_Sys_Organization node, StringBuilder jsonStr)
        {
            List <Mes_Sys_Organization> childList = list.Where(p => p.ParentID == node.ID).ToList();

            if (childList == null || childList.Count == 0)
            {
                return;
            }

            jsonStr.Append(",\"children\":[");
            foreach (var item in childList)
            {
                jsonStr.Append("{");
                jsonStr.AppendFormat("\"id\":\"{0}\",\"text\":\"{1}\"", item.ID, item.OrgName);
                GetChildNodesByList(list, item, jsonStr);
                jsonStr.Append("},");
            }
            jsonStr = jsonStr.Remove(jsonStr.Length - 1, 1);
            jsonStr.Append("]");
        }
Exemplo n.º 3
0
        public ActionResult OrganizationMgt_FindTree(Mes_Sys_Organization obj)
        {
            string stationTree = MesSysOrganizationDao.Instance.GetTree(obj);

            return(Json(new { IsSuccess = true, Message = stationTree }, JsonRequestBehavior.AllowGet));
        }