コード例 #1
0
ファイル: SysManageController.cs プロジェクト: imbkj/xeasyapp
        public JsonResult QueryAllUserTree(FormCollection form)
        {
            var    nodes    = new List <JsonTreeNode>();
            string parentId = form["id"];// ?? "0";

            if (string.IsNullOrEmpty(parentId))
            {
                Organization root = sysManageService.GetRootOrganization();
                JsonTreeNode node = new JsonTreeNode();
                node.id       = root.OrgCode;
                node.text     = root.OrgName;
                node.classes  = "group";
                node.value    = "1";
                node.isexpand = true;
                node.complete = true;
                GetChild(root.OrgCode, node.ChildNodes);
                node.hasChildren = true;
                nodes.Add(node);
            }
            else
            {
                GetChild(parentId, nodes);
            }
            return(Json(nodes));
        }
コード例 #2
0
        private List <JsonTreeNode> GetRoleClass(string id)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            if (!string.IsNullOrEmpty(id))
            {
                QMXF entity = _refdataRepository.GetClasses(id, null);
                if (entity != null && entity.classDefinitions.Count > 0)
                {
                    JsonTreeNode classNode = new JsonTreeNode
                    {
                        identifier = entity.classDefinitions[0].identifier.Split('#')[1],
                        leaf       = false,
                        children   = null,
                        text       = entity.classDefinitions[0].name[0].value,
                        id         = Guid.NewGuid().ToString(),
                        record     = entity.classDefinitions[0],
                        type       = "ClassNode",
                        icon       = "Content/img/class.png"
                    };
                    nodes.Add(classNode);
                }
            }
            return(nodes);
        }
コード例 #3
0
        public string GetJsonDataSource(string nodeId)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            using (IDataReader reader = Document.GetListDocumentStatus())
            {
                while (reader.Read())
                {
                    int          StatusId = (int)reader["StatusId"];
                    JsonTreeNode node     = new JsonTreeNode();

                    node.iconCls = "iconNodeCls";

                    node.text = reader["StatusName"].ToString();
                    node.cls  = "nodeCls";

                    node.href       = "../../../Documents/default.aspx?DocStatus=" + StatusId.ToString();
                    node.hrefTarget = "right";

                    node.leaf = true;
                    node.id   = "MDocuments41_" + StatusId.ToString();
                    nodes.Add(node);
                }
            }

            if (nodes.Count > 0)
            {
                return(UtilHelper.JsonSerialize(nodes));
            }
            else
            {
                return(String.Empty);
            }
        }
コード例 #4
0
ファイル: SysManageController.cs プロジェクト: imbkj/xeasyapp
        private void GetChild(string OrgCode, List <JsonTreeNode> parentNodes)
        {
            var glist = sysManageService.GetChildOrgsByParentCode(OrgCode);

            if (glist != null)
            {
                foreach (var item in glist)
                {
                    JsonTreeNode gnode = new JsonTreeNode();
                    gnode.id          = item.OrgCode;
                    gnode.text        = item.OrgName;
                    gnode.value       = "1";
                    gnode.hasChildren = true;

                    gnode.classes = "group";
                    parentNodes.Add(gnode);
                }
            }
            var ulist = sysManageService.GetUserListByOrgCode(OrgCode);

            if (ulist != null)
            {
                foreach (var user in ulist)
                {
                    JsonTreeNode unode = new JsonTreeNode();
                    unode.id          = user.UserUID;
                    unode.text        = user.FullName;
                    unode.value       = "2";
                    unode.showcheck   = true;
                    unode.hasChildren = false;
                    unode.classes     = "user";
                    parentNodes.Add(unode);
                }
            }
        }
コード例 #5
0
        public JsonResult GetTreeList(int orgId, int?roleId)
        {
            List <JsonTreeNode> treelist = new List <JsonTreeNode>();

            List <SYS_RIGHT_EX> cuList = _cservice.GetRIGHTSByOrgId(orgId, (roleId.HasValue ? roleId.Value : 0));
            var cuRootList             = cuList.Where(r => r.PARENT_ID == 0);

            if (cuRootList != null && cuRootList.Count() > 0)
            {
                foreach (var p in cuRootList)
                {
                    JsonTreeNode node = new JsonTreeNode();
                    node.hasChildren = (cuList.Count(r => r.PARENT_ID == p.RIGHT_ID) > 0);
                    node.id          = p.RIGHT_ID.ToString();
                    node.text        = p.RIGHT_NAME;
                    node.value       = p.RIGHT_ID.ToString();
                    node.showcheck   = true;//(p.ROLE_RIGHT_ID > 0)
                    node.checkstate  = ((byte)GetCheckStates(cuList, p));
                    node.complete    = true;

                    var childList = cuList.Where(c => c.PARENT_ID == p.RIGHT_ID);
                    if (childList != null && childList.Count() > 0)
                    {
                        node.isexpand = false;
                        SetTreeChildree(childList.ToList(), cuList, ref node, ref treelist);
                    }
                    treelist.Add(node);
                }
            }

            return(Json(treelist));
        }
コード例 #6
0
        private List <JsonTreeNode> GetTemplates(string classId)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            if (!string.IsNullOrEmpty(classId))
            {
                Entities dataEntities = _refdataRepository.GetClassTemplates(classId);
                foreach (var entity in dataEntities)
                {
                    JsonTreeNode node = new JsonTreeNode
                    {
                        nodeType   = "async",
                        type       = "TemplateNode",
                        icon       = "Content/img/template.png",
                        id         = Guid.NewGuid().ToString(),
                        identifier = entity.Uri.Split('#')[1],
                        text       = string.Format("{0}[{1}]", entity.Label, entity.Repository),
                        //    expanded = false,
                        leaf     = false,
                        children = null,
                        record   = entity
                    };

                    nodes.Add(node);
                }
            }

            return(nodes);
        }
コード例 #7
0
ファイル: PrivilegeController.cs プロジェクト: ywscr/Vulcan
        public async Task <IActionResult> QueryPrivilegeTree([FromForm] string id, [FromForm] string value)
        {
            string appCode = value;
            string pCode   = id == value ? "" : id;

            List <IPrivilege> list = await this._service.QueryPrivilegeByParentCode(appCode, pCode);

            List <JsonTreeNode> nodeList = new List <JsonTreeNode>();

            foreach (IPrivilege p in list)
            {
                JsonTreeNode node = new JsonTreeNode
                {
                    text        = p.PrivilegeName,
                    id          = p.PrivilegeCode,
                    value       = value,
                    classes     = p.PrivilegeType == 1 ? "menu" : "privilege",
                    hasChildren = p.HasChild,
                    complete    = false,
                    isexpand    = false
                };
                nodeList.Add(node);
            }
            return(Json(nodeList));
        }
コード例 #8
0
ファイル: RoleController.cs プロジェクト: ywscr/Vulcan
        public async Task <IActionResult> QueryTree([FromForm] string id, [FromForm] string value)
        {
            string           appCode = value;
            string           pCode   = id == value ? "" : id;
            List <IRoleInfo> list;

            if (string.IsNullOrEmpty(pCode))
            {
                list = await this._service.QueryUserTopRole(appCode, base.UserId);
            }
            else
            {
                list = await this._service.QueryRoleByParentCode(appCode, pCode);
            }

            List <JsonTreeNode> nodeList = new List <JsonTreeNode>();

            foreach (IRoleInfo p in list)
            {
                JsonTreeNode node = new JsonTreeNode
                {
                    text        = p.RoleName,
                    id          = p.RoleCode,
                    value       = value,
                    hasChildren = p.HasChild,
                    complete    = false,
                    isexpand    = false
                };
                nodeList.Add(node);
            }
            return(Json(nodeList));
        }
コード例 #9
0
        public string DataLayer(JsonTreeNode node, FormCollection form)
        {
            HttpFileCollectionBase files = Request.Files;
            HttpPostedFileBase     hpf   = files[0] as HttpPostedFileBase;

            string dataLayerName = string.Empty;

            if (string.IsNullOrEmpty(form["Name"]))
            {
                int lastDot = hpf.FileName.LastIndexOf(".");
                dataLayerName = hpf.FileName.Substring(0, lastDot);
            }
            else
            {
                dataLayerName = form["Name"];
            }

            DataLayer dataLayer = new DataLayer()
            {
                Name    = dataLayerName,
                Package = Utility.ToMemoryStream(hpf.InputStream)
            };

            MemoryStream           dataLayerStream = new MemoryStream();
            DataContractSerializer serializer      = new DataContractSerializer(typeof(DataLayer));

            serializer.WriteObject(dataLayerStream, dataLayer);
            dataLayerStream.Position = 0;

            Response response = _repository.UpdateDataLayer(dataLayerStream);

            return(Utility.ToJson <Response>(response));
        }
コード例 #10
0
ファイル: Gltf.cs プロジェクト: vrm-c/UniVRM_1_0
 void Traverse(JsonTreeNode node, JsonFormatter f, Utf8String parentKey)
 {
     if (node.IsObject())
     {
         f.BeginMap();
         foreach (var kv in node.ObjectItems())
         {
             if (parentKey == s_extensions)
             {
                 if (!UsedExtension(kv.Key.GetString()))
                 {
                     continue;
                 }
             }
             f.Key(kv.Key.GetUtf8String());
             Traverse(kv.Value, f, kv.Key.GetUtf8String());
         }
         f.EndMap();
     }
     else if (node.IsArray())
     {
         f.BeginList();
         foreach (var x in node.ArrayItems())
         {
             Traverse(x, f, default(Utf8String));
         }
         f.EndList();
     }
     else
     {
         f.Value(node);
     }
 }
コード例 #11
0
ファイル: HomeController.cs プロジェクト: imbkj/xeasyapp
        private List <JsonTreeNode> BuildTreeNode(List <Privilege> allmenus, List <Privilege> menus, List <string> usermenuids)
        {
            List <JsonTreeNode> treenodelist = new List <JsonTreeNode>();
            bool isSupperAdmin = base.IsInRole(AppConfig.SuperAdminRoleCode);

            foreach (Privilege p in menus)
            {
                if (isSupperAdmin || usermenuids.Contains(p.PrivilegeCode))
                {
                    JsonTreeNode treenode = new JsonTreeNode();
                    treenode.id   = p.PrivilegeCode;
                    treenode.text = p.PrivilegeName;

                    treenode.value     = GetTruePath(p.Uri);
                    treenode.isexpand  = false;
                    treenode.showcheck = false;
                    treenode.complete  = true;
                    List <Privilege> cmenus = allmenus.FindAll(x => x.ParentID == p.PrivilegeCode);
                    if (cmenus != null && cmenus.Count > 0)
                    {
                        treenode.ChildNodes.AddRange(BuildTreeNode(allmenus, cmenus, usermenuids));
                        if (treenode.ChildNodes.Count > 0)
                        {
                            treenode.isexpand    = true;
                            treenode.hasChildren = true;
                        }
                    }
                    treenodelist.Add(treenode);
                }
            }
            return(treenodelist);
        }
コード例 #12
0
ファイル: DocumentGenCatHandler.cs プロジェクト: 0anion0/IBN
        public string GetJsonDataSource(string nodeId)
        {
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();

            using (IDataReader reader = Document.GetListCategoriesAll())
            {
                while (reader.Read())
                {
                    int CategoryId = (int)reader["CategoryId"];
                    JsonTreeNode node = new JsonTreeNode();

                    node.iconCls = "iconNodeCls";

                    node.text = reader["CategoryName"].ToString();
                    node.cls = "nodeCls";

                    node.href = "../../../Documents/default.aspx?GenCat=" + CategoryId.ToString();
                    node.hrefTarget = "right";

                    node.leaf = true;
                    node.id = "MDocuments43_" + CategoryId.ToString();
                    nodes.Add(node);
                }
            }

            if (nodes.Count > 0)
                return UtilHelper.JsonSerialize(nodes);
            else
                return String.Empty;
        }
コード例 #13
0
        private void AddAclGroup2(AclGroup group, JsonTreeNode treeNode)
        {
            JsonTreeNode groupNode = new JsonTreeNode();

            groupNode.id     = _groupNodePrefix + group.ID;
            groupNode.itemid = group.ID;
            groupNode.text   = group.Name;
            treeNode.children.Add(groupNode);

            // add child groups
            foreach (AclGroup childGroup in group.Groups)
            {
                AddAclGroup2(childGroup, groupNode);
            }

            // add permissions
            foreach (AclPermission permission in group.Permissions)
            {
                JsonTreeNode permissionNode = new JsonTreeNode();
                permissionNode.id     = _permissionNodePrefix + permission.ID;
                permissionNode.itemid = permission.ID;
                permissionNode.text   = permission.Name;

                groupNode.children.Add(permissionNode);
            }
        }
コード例 #14
0
        private JsonTreeNode GetSubClasses(string classId, JsonTreeNode subsNode, string repositoryName)
        {
            Repository repository = null;

            if (!string.IsNullOrEmpty(classId))
            {
                if (!string.IsNullOrEmpty(repositoryName))
                {
                    repository = _federation.Repositories.Find(r => r.Name == repositoryName);
                }

                Entities dataEntities = _refdataRepository.GetSubClasses(classId, repository);
                foreach (var entity in dataEntities)
                {
                    JsonTreeNode node = new JsonTreeNode
                    {
                        type       = "ClassNode",
                        icon       = "Content/img/class.png",
                        identifier = entity.Uri.Split('#')[1],
                        id         = Guid.NewGuid().ToString(),
                        text       = entity.Label,
                        //   expanded = false,
                        leaf     = false,
                        children = null,
                        record   = entity
                    };

                    subsNode.children.Add(node);
                }
                subsNode.text = subsNode.text + " (" + subsNode.children.Count() + ")";
            }

            return(subsNode);
        }
コード例 #15
0
        private JsonTreeNode getJTreeNode(DeptTree deptTree)
        {
            JsonTreeNode jTreeNode = new JsonTreeNode();

            jTreeNode.id          = deptTree.deptNode.id;
            jTreeNode.text        = deptTree.deptNode.name;
            jTreeNode.value       = deptTree.deptNode.id;
            jTreeNode.pid         = deptTree.deptNode.parentId;
            jTreeNode.hasChildren = (deptTree.childTreeList.Count > 0 ? true : false);
            jTreeNode.data        = new Dictionary <string, string>()
            {
                { "order", deptTree.deptNode.order }
            };
            if ("1" == deptTree.deptNode.id)
            {
                jTreeNode.isexpand = true;
            }
            else
            {
                jTreeNode.isexpand = false;
            }
            if (jTreeNode.hasChildren)
            {
                foreach (DeptTree childDeptTree in deptTree.childTreeList)
                {
                    jTreeNode.ChildNodes.Add(getJTreeNode(childDeptTree));
                }
            }
            jTreeNode.complete = true;
            return(jTreeNode);
        }
コード例 #16
0
        private JsonTreeNode GetTemplates(string classId, JsonTreeNode tempsNode)
        {
            if (!string.IsNullOrEmpty(classId))
            {
                Entities dataEntities = _refdataRepository.GetClassTemplates(classId);
                foreach (var entity in dataEntities)
                {
                    JsonTreeNode node = new JsonTreeNode
                    {
                        type       = "TemplateNode",
                        icon       = "Content/img/template.png",
                        id         = Guid.NewGuid().ToString(),
                        identifier = entity.Uri.Split('#')[1],
                        text       = string.Format("{0}[{1}]", entity.Label, entity.Repository),
                        //    expanded = false,
                        leaf     = false,
                        children = null,
                        record   = entity
                    };

                    tempsNode.children.Add(node);
                }
                tempsNode.text = tempsNode.text + " (" + tempsNode.children.Count() + ")";
            }

            return(tempsNode);
        }
コード例 #17
0
        private List <JsonTreeNode> GetSuperClasses(string classId, string repositoryName)
        {
            List <JsonTreeNode> nodes      = new List <JsonTreeNode>();
            Repository          repository = null;

            if (!string.IsNullOrEmpty(classId))
            {
                if (!string.IsNullOrEmpty(repositoryName))
                {
                    repository = _federation.Repositories.Find(r => r.Name == repositoryName);
                }
                Entities dataEntities = _refdataRepository.GetSuperClasses(classId, repository);
                foreach (var entity in dataEntities)
                {
                    JsonTreeNode node = new JsonTreeNode
                    {
                        type       = "ClassNode",
                        icon       = "Content/img/class.png",
                        identifier = entity.Uri.Split('#')[1],
                        id         = Guid.NewGuid().ToString(),
                        text       = string.Format("{0}[{1}]", entity.Label, entity.Repository),
                        //   expanded = false,
                        leaf = false,
                        //  children = GetDefaultChildren(entity.Label),
                        record = entity
                    };
                    nodes.Add(node);
                }
            }

            return(nodes);
        }
コード例 #18
0
ファイル: SysManageController.cs プロジェクト: imbkj/xeasyapp
        public JsonResult QueryUserPrivilegeTree(FormCollection form)
        {
            List <JsonTreeNode> treelist = new List <JsonTreeNode>();
            string usercode = form["UserCode"];
            string parentId = form["id"] ?? "";


            List <Privilege> list = sysManageService.GetUserPrivilegesByParentID(usercode, parentId);

            foreach (Privilege pri in list)
            {
                JsonTreeNode node = new JsonTreeNode();
                node.hasChildren = pri.HasChild;
                node.id          = pri.PrivilegeCode;
                node.text        = pri.PrivilegeName;
                node.value       = pri.PrivilegeCode;
                if (parentId == "" && node.hasChildren)
                {
                    List <Privilege> clist = sysManageService.GetUserPrivilegesByParentID(usercode, node.id);
                    foreach (Privilege cpri in clist)
                    {
                        JsonTreeNode cnode = new JsonTreeNode();
                        cnode.hasChildren = cpri.HasChild;
                        cnode.id          = cpri.PrivilegeCode;
                        cnode.text        = cpri.PrivilegeName;
                        cnode.value       = cpri.PrivilegeCode;
                        node.ChildNodes.Add(cnode);
                    }
                    node.isexpand = true;
                    node.complete = true;
                }
                treelist.Add(node);
            }
            return(Json(treelist));
        }
コード例 #19
0
        public JsonResult SwitchDataMode(FormCollection form)
        {
            try
            {
                string   context         = form["nodeid"];
                string   mode            = form["mode"];
                string[] names           = context.Split('/');
                string   scopeName       = names[0];
                string   applicationName = names[1];

                Response response = _repository.SwitchDataMode(scopeName, applicationName, mode);

                List <JsonTreeNode> nodes           = new List <JsonTreeNode>();
                JsonTreeNode        dataObjectsNode = new JsonTreeNode
                {
                    nodeType = "async",
                    type     = "DataObjectsNode",
                    iconCls  = "folder",
                    id       = context + "/DataObjects",
                    text     = "Data Objects",
                    expanded = false,
                    leaf     = false,
                    children = null,
                    property = new Dictionary <string, string>()
                };

                ScopeProject scope = _repository.GetScope(scopeName);

                if (scope != null)
                {
                    ScopeApplication application = scope.Applications.Find(x => x.Name.ToLower() == applicationName.ToLower());

                    if (application != null)
                    {
                        //   dataObjectsNode.property.Add("Data Mode", application.DataMode.ToString());
                        dataObjectsNode.property.Add("Data Mode", mode.ToString());
                    }
                }
                nodes.Add(dataObjectsNode);

                if (response.Level == StatusLevel.Success)
                {
                    return(Json(new { success = true, response, nodes }, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    return(Json(new { success = false, message = response.Messages, stackTraceDescription = response.StatusText }, JsonRequestBehavior.AllowGet));
                }
                //return Json(response, JsonRequestBehavior.AllowGet);
            }

            catch (Exception e)
            {
                _CustomErrorLog = new CustomErrorLog();
                _CustomError    = _CustomErrorLog.customErrorLogger(ErrorMessages.errUISwitchDataMode, e, _logger);
                return(Json(new { success = false, message = "[ Message Id " + _CustomError.msgId + "] - " + _CustomError.errMessage, stackTraceDescription = _CustomError.stackTraceDescription }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #20
0
    /// <summary>
    /// Binds the root.
    /// </summary>
    private void BindRoot()
    {
        List <JsonTreeNode> nodes = new List <JsonTreeNode>();

        nodes.Add(JsonTreeNode.CreateNode("CatalogEntrySearch", String.Empty, "Catalog Entry Search", ModuleName,
                                          "CatalogEntrySearch-List", String.Empty, TreeListType.EntrySearch.ToString(), true));
        nodes.Add(JsonTreeNode.CreateNode("Catalogs", String.Empty, "Catalogs", ModuleName, "Catalog-List", String.Empty, TreeListType.Catalogs.ToString()));
        WriteArray(nodes);
    }
コード例 #21
0
        public string GetJsonDataSource(string nodeId)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            int          userIMGroupId = 0;
            DataTable    dt            = null;
            JsonTreeNode node;

            if (!IMGroup.CanCreate())
            {
                using (IDataReader rdr = Mediachase.IBN.Business.User.GetUserInfo(Mediachase.IBN.Business.Security.CurrentUser.UserID))
                {
                    rdr.Read();
                    userIMGroupId = (int)rdr["IMGroupId"];
                }

                dt = IMGroup.GetListIMGroupsYouCanSee(userIMGroupId);

                string imGroupName = IMGroup.GetIMGroupName(userIMGroupId, null);
                if (imGroupName != null)
                {
                    DataRow dr = dt.NewRow();

                    dr["IMGroupId"]   = userIMGroupId;
                    dr["IMGroupName"] = imGroupName;

                    dt.Rows.InsertAt(dr, 0);
                }
            }
            else
            {
                dt = IMGroup.GetListIMGroup();
            }

            foreach (DataRow dr in dt.Rows)
            {
                int imGroupId = (int)dr["IMGroupId"];
                node            = new JsonTreeNode();
                node.icon       = "../../../Layouts/Images/icons/ibngroup.gif";
                node.iconCls    = "iconStdCls";
                node.text       = dr["IMGroupName"].ToString();
                node.cls        = "nodeCls";
                node.href       = "../../../Directory/Directory.aspx?Tab=1&IMGroupID=" + imGroupId.ToString();
                node.hrefTarget = "right";
                node.leaf       = true;
                nodes.Add(node);
            }

            if (nodes.Count > 0)
            {
                return(UtilHelper.JsonSerialize(nodes));
            }
            else
            {
                return(String.Empty);
            }
        }
コード例 #22
0
ファイル: TreeSource.aspx.cs プロジェクト: 0anion0/IBN
        private void BindFullTree()
        {
            IXPathNavigable navigable;

            if (!String.IsNullOrEmpty(Request.QueryString["UserId"]))
            {
                int userId = int.Parse(Request.QueryString["UserId"]);

                // Selector: ClassName.ViewName.PlaceName.ProfileId.UserId
                Selector selector = new Selector(string.Empty, string.Empty, string.Empty, ProfileManager.GetProfileIdByUser(userId).ToString(), userId.ToString());
                navigable = Mediachase.Ibn.XmlTools.XmlBuilder.GetXml(StructureType.Navigation, selector);
            }
            if (!String.IsNullOrEmpty(Request.QueryString["ProfileId"]))
            {
                // Selector: ClassName.ViewName.PlaceName.ProfileId.UserId
                Selector selector = new Selector(string.Empty, string.Empty, string.Empty, Request.QueryString["ProfileId"], String.Empty);
                navigable = Mediachase.Ibn.XmlTools.XmlBuilder.GetXml(StructureType.Navigation, selector);
            }
            else
            {
                // don't apply profile and user level (empty selector) and don't hide items (GetCustomizationXml instead GetXml)
                navigable = Mediachase.Ibn.XmlTools.XmlBuilder.GetCustomizationXml(null, StructureType.Navigation);
            }

            XPathNavigator tabsNode = navigable.CreateNavigator().SelectSingleNode("Navigation/Tabs");
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();
            foreach (XPathNavigator subItem in tabsNode.SelectChildren("Tab", string.Empty))
            {
                JsonTreeNode node = new JsonTreeNode();

                node.id = subItem.GetAttribute("id", string.Empty);
                node.text = UtilHelper.GetResFileString(subItem.GetAttribute("text", string.Empty));

                string order = subItem.GetAttribute("order", string.Empty);
                if (!string.IsNullOrEmpty(order))
                    node.text += String.Concat("<span class=\"rightColumn\">", order, "</span><span class=\"clearColumn\"></span>");

                node.cls = "nodeCls";

                string iconUrl = subItem.GetAttribute("imageUrl", string.Empty);
                if (!String.IsNullOrEmpty(iconUrl))
                    node.icon = ResolveClientUrl(iconUrl);

                node.children = new List<JsonTreeNode>();
                int count = BindRecursiveNoAsync(node.children, subItem);
                if (count == 0)
                {
                    node.leaf = true;
                    node.children = null;
                }

                nodes.Add(node);
            }

            WriteArray(nodes);
        }
コード例 #23
0
ファイル: OrgController.cs プロジェクト: ywscr/Vulcan
        public async Task <IActionResult> QueryOrgTree([FromForm] string id)
        {
            bool isRootNode = string.IsNullOrEmpty(id);

            if (isRootNode) // 根组织
            {
                isRootNode = true;
                //判断用户是否为超级管理员,如果是超级管理员则 获取所有的组织结构,否则获取当前用户的可见组织结构
                bool admin = await this._contextService.IsInRole(base.UserId, Constans.SUPPER_ADMIN_ROLE);

                if (!admin)
                {
                    var user = await base.GetSignedUser();

                    if (!string.IsNullOrEmpty(user.ViewRootCode))
                    {
                        id = user.ViewRootCode;
                    }
                }
            }

            List <IOrganization> list = await this._service.QueryOrgTreeByParentCode(id == rootId?"" : id);

            List <JsonTreeNode> rlist = new List <JsonTreeNode>();

            if (isRootNode)
            {
                JsonTreeNode root = new JsonTreeNode();
                if (!string.IsNullOrEmpty(id) && id != rootId)
                {
                    var user = await base.GetSignedUser();

                    root.text  = user.ViewRootName;
                    root.value = id;
                    root.id    = id;
                }
                else
                {
                    root.text  = "根组织";
                    root.id    = rootId;
                    root.value = rootId;
                }
                BuildChildNodes(root, list);
                root.hasChildren = root.ChildNodes.Count > 0;
                root.complete    = true;
                root.isexpand    = true;
                rlist.Add(root);
            }
            else
            {
                ConvertListToTree(list, rlist);
            }

            return(Json(rlist));
        }
コード例 #24
0
    /// <summary>
    /// Binds the root.
    /// </summary>
    private void BindRoot()
    {
        List <JsonTreeNode> nodes = new List <JsonTreeNode>();

        nodes.Add(JsonTreeNode.CreateNode("OrderSearch", String.Empty, "Order Search", ModuleName,
                                          "OrderSearch-List", String.Empty, TreeListType.OrderSearch.ToString(), true));

        // PurchaseOrders node
        JsonTreeNode poNode = JsonTreeNode.CreateNode("PurchaseOrders", String.Empty, "Purchase Orders", ModuleName, "Orders-List", String.Empty, TreeListType.PurchaseOrders.ToString());

        poNode.icon     = Mediachase.Commerce.Shared.CommerceHelper.GetAbsolutePath("~/Apps/Order/images/PurchaseOrders.png");
        poNode.children = new List <JsonTreeNode>();
        poNode.children.Add(JsonTreeNode.CreateNode("PO-TodayOrders", "Today", ModuleName, "Orders-List", "filter=today&class=PurchaseOrder", true));
        poNode.children.Add(JsonTreeNode.CreateNode("PO-WeekOrders", "This Week", ModuleName, "Orders-List", "filter=thisweek&class=PurchaseOrder", true));
        poNode.children.Add(JsonTreeNode.CreateNode("PO-MonthOrders", "This Month", ModuleName, "Orders-List", "filter=thismonth&class=PurchaseOrder", true));
        poNode.children.Add(JsonTreeNode.CreateNode("PO-AllOrders", "All", ModuleName, "Orders-List", "filter=all&class=PurchaseOrder", true));
        nodes.Add(poNode);

        // PurchaseOrdersByStatus node
        JsonTreeNode posNode = JsonTreeNode.CreateNode("PurchaseOrdersByStatus", String.Empty, "Purchase Orders By Status", ModuleName, "Orders-List", String.Empty, TreeListType.PurchaseOrdersByStatus.ToString());

        posNode.children = new List <JsonTreeNode>();

        OrderStatusDto statusDto = OrderStatusManager.GetOrderStatus();

        foreach (OrderStatusDto.OrderStatusRow statusRow in statusDto.OrderStatus.Rows)
        {
            posNode.children.Add(JsonTreeNode.CreateNode("PO-Status-" + statusRow.OrderStatusId, statusRow.Name, ModuleName, "Orders-List", String.Format("status={0}", statusRow.Name), true));
        }
        nodes.Add(posNode);

        // Carts node
        JsonTreeNode cartsNode = JsonTreeNode.CreateNode("Carts", "Carts", ModuleName, "Orders-List", "filter=all&class=ShoppingCart", false);

        cartsNode.children = new List <JsonTreeNode>();
        cartsNode.children.Add(JsonTreeNode.CreateNode("CART-TodayOrders", "Today", ModuleName, "Orders-List", "filter=today&class=ShoppingCart", true));
        cartsNode.children.Add(JsonTreeNode.CreateNode("CART-WeekOrders", "This Week", ModuleName, "Orders-List", "filter=thisweek&class=ShoppingCart", true));
        cartsNode.children.Add(JsonTreeNode.CreateNode("CART-MonthOrders", "This Month", ModuleName, "Orders-List", "filter=thismonth&class=ShoppingCart", true));
        cartsNode.children.Add(JsonTreeNode.CreateNode("CART-AllOrders", "All", ModuleName, "Orders-List", "filter=all&class=ShoppingCart", true));
        nodes.Add(cartsNode);

        // PaymentPlans node
        JsonTreeNode ppNode = JsonTreeNode.CreateNode("PaymentPlans", "Payment Plans (recurring)", ModuleName, "Orders-List", "filter=all&class=PaymentPlan", false);

        ppNode.children = new List <JsonTreeNode>();
        ppNode.children.Add(JsonTreeNode.CreateNode("PP-TodayOrders", "Today", ModuleName, "Orders-List", "filter=today&class=PaymentPlan", true));
        ppNode.children.Add(JsonTreeNode.CreateNode("PP-WeekOrders", "This Week", ModuleName, "Orders-List", "filter=thisweek&class=PaymentPlan", true));
        ppNode.children.Add(JsonTreeNode.CreateNode("PP-MonthOrders", "This Month", ModuleName, "Orders-List", "filter=thismonth&class=PaymentPlan", true));
        ppNode.children.Add(JsonTreeNode.CreateNode("PP-AllOrders", "All", ModuleName, "Orders-List", "filter=all&class=PaymentPlan", true));
        nodes.Add(ppNode);

        WriteArray(nodes);
    }
コード例 #25
0
ファイル: SysManageController.cs プロジェクト: imbkj/xeasyapp
        public JsonResult QueryOrgTree(string ExtId, FormCollection form)
        {
            var    nodes    = new List <JsonTreeNode>();
            string parentId = form["id"];// ?? "0";

            if (string.IsNullOrEmpty(parentId))
            {
                Organization root = sysManageService.GetRootOrganization();
                JsonTreeNode node = new JsonTreeNode();
                node.id       = root.OrgCode;
                node.text     = root.OrgName;
                node.value    = root.OrgCode;
                node.isexpand = true;
                node.complete = true;
                var clist = sysManageService.GetChildOrgsByParentCode(root.OrgCode);
                if (clist != null)
                {
                    node.hasChildren = true;
                    foreach (var item in clist)
                    {
                        if (item.OrgCode == ExtId)
                        {
                            continue;
                        }
                        JsonTreeNode cnode = new JsonTreeNode();
                        cnode.id          = item.OrgCode;
                        cnode.text        = item.OrgName;
                        cnode.value       = item.OrgCode;
                        cnode.hasChildren = item.HasChild;
                        node.ChildNodes.Add(cnode);
                    }
                }
                nodes.Add(node);
            }
            else
            {
                var list = sysManageService.GetChildOrgsByParentCode(parentId);
                foreach (var item in list)
                {
                    if (item.OrgCode == ExtId)
                    {
                        continue;
                    }
                    JsonTreeNode cnode = new JsonTreeNode();
                    cnode.id          = item.OrgCode;
                    cnode.text        = item.OrgName;
                    cnode.value       = item.OrgCode;
                    cnode.hasChildren = item.HasChild;
                    nodes.Add(cnode);
                }
            }
            return(Json(nodes));
        }
コード例 #26
0
ファイル: OrgController.cs プロジェクト: ywscr/Vulcan
        private static void BuildChildNodes(JsonTreeNode pNode, List <IOrganization> list)
        {
            List <IOrganization> clist = pNode.id == rootId?
                                         list.FindAll(x => string.IsNullOrEmpty(x.ParentCode))
                                             :
                                             list.FindAll(x => x.ParentCode == pNode.id);

            if (clist.Count > 0)
            {
                ConvertListToTree(list, pNode.ChildNodes);
            }
        }
コード例 #27
0
ファイル: ContactGroupsHandler.cs プロジェクト: 0anion0/IBN
        public string GetJsonDataSource(string nodeId)
        {
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();

            int userIMGroupId = 0;
            DataTable dt = null;
            JsonTreeNode node;

            if (!IMGroup.CanCreate())
            {
                using (IDataReader rdr = Mediachase.IBN.Business.User.GetUserInfo(Mediachase.IBN.Business.Security.CurrentUser.UserID))
                {
                    rdr.Read();
                    userIMGroupId = (int)rdr["IMGroupId"];
                }

                dt = IMGroup.GetListIMGroupsYouCanSee(userIMGroupId);

                string imGroupName = IMGroup.GetIMGroupName(userIMGroupId, null);
                if (imGroupName != null)
                {
                    DataRow dr = dt.NewRow();

                    dr["IMGroupId"] = userIMGroupId;
                    dr["IMGroupName"] = imGroupName;

                    dt.Rows.InsertAt(dr, 0);
                }
            }
            else
            {
                dt = IMGroup.GetListIMGroup();
            }

            foreach (DataRow dr in dt.Rows)
            {
                int imGroupId = (int)dr["IMGroupId"];
                node = new JsonTreeNode();
                node.icon = "../../../Layouts/Images/icons/ibngroup.gif";
                node.iconCls = "iconStdCls";
                node.text = dr["IMGroupName"].ToString();
                node.cls = "nodeCls";
                node.href = "../../../Directory/Directory.aspx?Tab=1&IMGroupID=" + imGroupId.ToString();
                node.hrefTarget = "right";
                node.leaf = true;
                nodes.Add(node);
            }

            if (nodes.Count > 0)
                return UtilHelper.JsonSerialize(nodes);
            else
                return String.Empty;
        }
コード例 #28
0
ファイル: TreeSource.aspx.cs プロジェクト: hdgardner/ECF
    /// <summary>
    /// Binds the expressions.
    /// </summary>
    private void BindExpressions()
    {
        List <JsonTreeNode> nodes = new List <JsonTreeNode>();

        // Expressions child nodes
        foreach (string key in ExpressionCategory.Categories.Keys)
        {
            nodes.Add(JsonTreeNode.CreateNode(key, ExpressionCategory.Categories[key], ModuleName, "Expression-List", "group=" + key, true));
        }

        WriteArray(nodes);
    }
コード例 #29
0
ファイル: TreeSource.aspx.cs プロジェクト: hdgardner/ECF
    /// <summary>
    /// Binds the policies.
    /// </summary>
    private void BindPolicies()
    {
        List <JsonTreeNode> nodes = new List <JsonTreeNode>();

        // Policies child nodes
        foreach (string key in PromotionGroup.Groups.Keys)
        {
            nodes.Add(JsonTreeNode.CreateNode(key, PromotionGroup.Groups[key], ModuleName, "Policy-List", "group=" + key, true));
        }

        WriteArray(nodes);
    }
コード例 #30
0
ファイル: SecureGroupsHandler.cs プロジェクト: alex765022/IBN
        private string BindOrdinaryTree(int parentId)
        {
            List <JsonTreeNode> nodes = new List <JsonTreeNode>();

            using (IDataReader reader = SecureGroup.GetListChildGroups(parentId))
            {
                while (reader.Read())
                {
                    int          iGroupId = (int)reader["GroupId"];
                    JsonTreeNode node     = new JsonTreeNode();
                    node.icon = "../../../Layouts/Images/icons/regular.gif";
                    if (iGroupId < 9 && iGroupId != 6)
                    {
                        node.icon = "../../../Layouts/Images/icons/Admins.gif";
                    }
                    if (SecureGroup.IsPartner(iGroupId) || iGroupId == 6)
                    {
                        node.icon = "../../../Layouts/Images/icons/Partners.gif";
                    }
                    node.iconCls = "iconStdCls";

                    node.leaf = true;
                    using (IDataReader rdr = SecureGroup.GetListChildGroups(iGroupId))
                    {
                        if (rdr.Read())
                        {
                            node.leaf = false;
                        }
                    }
                    node.text = CHelper.GetResFileString(reader["GroupName"].ToString());
                    node.cls  = "nodeCls";

                    node.href       = "../../../Directory/Directory.aspx?Tab=0&SGroupID=" + iGroupId.ToString(CultureInfo.InvariantCulture);
                    node.hrefTarget = "right";

                    node.id             = Guid.NewGuid().ToString("N");
                    node.itemid         = iGroupId.ToString();
                    node.staticParentId = _rootId;

                    nodes.Add(node);
                }
            }

            if (nodes.Count > 0)
            {
                return(UtilHelper.JsonSerialize(nodes));
            }
            else
            {
                return(String.Empty);
            }
        }
コード例 #31
0
    /// <summary>
    /// Binds the purchase orders by status.
    /// </summary>
    private void BindPurchaseOrdersByStatus()
    {
        List <JsonTreeNode> nodes = new List <JsonTreeNode>();

        // PurchaseOrdersByStatus node
        OrderStatusDto statusDto = OrderStatusManager.GetOrderStatus();

        foreach (OrderStatusDto.OrderStatusRow statusRow in statusDto.OrderStatus.Rows)
        {
            nodes.Add(JsonTreeNode.CreateNode("PO-Status-" + statusRow.OrderStatusId, statusRow.Name, ModuleName, "Orders-List", String.Format("status={0}", statusRow.Name), true));
        }

        WriteArray(nodes);
    }
コード例 #32
0
        private List <JsonTreeNode> GetClasses(string query, int start, int limit, bool isReset)
        {
            List <JsonTreeNode> nodes    = new List <JsonTreeNode>();
            string          prefix       = string.Empty;
            string          ident        = string.Empty;
            RefDataEntities dataEntities = new RefDataEntities();

            if (isReset)
            {
                dataEntities = _refdataRepository.SearchReset(query);
            }
            else
            {
                dataEntities = _refdataRepository.Search(query, start, limit);
            }

            foreach (Entity entity in dataEntities.Entities.Values.ToList <Entity>())
            {
                string label = entity.Label + '[' + entity.Repository + ']';
                if (entity.Uri.Contains("#"))
                {
                    prefix = _namespaces.Find(n => n.Uri == entity.Uri.Substring(0, entity.Uri.IndexOf("#") + 1)).Prefix;
                    ident  = entity.Uri.Split('#')[1];
                }
                else
                {
                    prefix = _namespaces.Find(n => n.Uri == entity.Uri.Substring(0, entity.Uri.LastIndexOf("/") + 1)).Prefix;
                    ident  = entity.Uri.Substring(entity.Uri.LastIndexOf("/") + 1);
                }

                JsonTreeNode node = new JsonTreeNode
                {
                    type       = (prefix.Contains("rdl")) ? "ClassNode" : "TemplateNode",
                    icon       = (prefix.Contains("rdl")) ? "Content/img/class.png" : "Content/img/template.png",
                    identifier = ident,
                    id         = Guid.NewGuid().ToString(),
                    text       = label,
                    //     expanded = false,
                    leaf = false,
                    // children = new List<JsonTreeNode>(),
                    record = entity
                };

                nodes.Add(node);
            }

            return(nodes);
        }
コード例 #33
0
        private void BindJsTree()
        {
            string str = string.Empty;

            if (this.Request["tab"] != null)
            {
                str = this.Request["tab"];
            }
            if (string.IsNullOrEmpty(str))
            {
                return;
            }
            List <JsonTreeNode> nodes      = new List <JsonTreeNode>();
            Navigation          navigation = XmlModelHelper.GetNavigation("LeftMenu", string.Empty);

            if (navigation == null || navigation.Tabs == null)
            {
                return;
            }
            foreach (Tab tab in navigation.Tabs.Tab)
            {
                if (!string.IsNullOrEmpty(str) && str == tab.id || string.IsNullOrEmpty(str))
                {
                    JsonTreeNode jsonTreeNode = new JsonTreeNode();
                    jsonTreeNode.id   = tab.id;
                    jsonTreeNode.text = UtilHelper.GetResFileString(tab.text);
                    jsonTreeNode.cls  = "nodeCls";
                    if (!string.IsNullOrEmpty(tab.imageUrl))
                    {
                        jsonTreeNode.icon = this.ResolveUrl(tab.imageUrl);
                    }
                    jsonTreeNode.children = new List <JsonTreeNode>();
                    jsonTreeNode.expanded = true;
                    int num = 0;
                    if (tab.Items != null)
                    {
                        num = this.BindRecursive(jsonTreeNode.children, tab.Items);
                    }
                    if (num == 0)
                    {
                        jsonTreeNode.leaf     = true;
                        jsonTreeNode.children = (List <JsonTreeNode>)null;
                    }
                    nodes.Add(jsonTreeNode);
                }
            }
            this.WriteArray(nodes);
        }
コード例 #34
0
ファイル: SecureGroupsHandler.cs プロジェクト: 0anion0/IBN
        public string GetJsonDataSource(string nodeId)
        {
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();

            int parentId;
            if (!int.TryParse(nodeId, out parentId) || parentId < 1)
            {
                parentId = 1;
            }

            if (Mediachase.IBN.Business.Security.IsUserInGroup(InternalSecureGroups.Partner) && (parentId == 1 || parentId == 6))
            {
                int iCurGroupId = -1;
                ArrayList VisiblePartnerGroups = new ArrayList();
                ArrayList VisibleUnpartnerGroups = new ArrayList();
                using (IDataReader reader = Mediachase.IBN.Business.User.GetListSecureGroup(Mediachase.IBN.Business.Security.CurrentUser.UserID))
                {
                    if (reader.Read())
                    {
                        iCurGroupId = (int)reader["GroupId"];
                    }
                }
                VisiblePartnerGroups.Clear();
                VisibleUnpartnerGroups.Clear();
                VisiblePartnerGroups.Add(iCurGroupId);
                using (IDataReader reader = SecureGroup.GetListGroupsByPartner(iCurGroupId))
                {
                    while (reader.Read())
                    {
                        int iGroupId = (int)reader["GroupId"];
                        if (SecureGroup.IsPartner(iGroupId))
                            VisiblePartnerGroups.Add(iGroupId);
                        else
                            VisibleUnpartnerGroups.Add(iGroupId);
                    }
                }
                ClearUnpartnerGroups(VisibleUnpartnerGroups);
                if (VisibleUnpartnerGroups.Contains(1))
                {
                    return BindOrdinaryTree(parentId);
                }

                ArrayList children = new ArrayList();
                if (parentId == 1)
                {
                    children.AddRange(VisibleUnpartnerGroups);
                    children.Add(6);
                }
                else if (parentId == 6)
                {
                    children.AddRange(VisiblePartnerGroups);
                }
                children.Sort();
                foreach (int iGroupId in children)
                {
                    JsonTreeNode node = new JsonTreeNode();
                    node.icon = "../../../Layouts/Images/icons/regular.gif";
                    if (iGroupId < 9 && iGroupId != 6)
                        node.icon = "../../../Layouts/Images/icons/Admins.gif";
                    if (SecureGroup.IsPartner(iGroupId) || iGroupId == 6)
                        node.icon = "../../../Layouts/Images/icons/Partners.gif";
                    node.iconCls = "iconStdCls";

                    using (IDataReader rdr = SecureGroup.GetGroup(iGroupId))
                    {
                        if (rdr.Read())
                            node.text = CHelper.GetResFileString(rdr["GroupName"].ToString());
                    }
                    node.cls = "nodeCls";

                    node.href = "../../../Directory/Directory.aspx?Tab=0&SGroupID=" + iGroupId.ToString();
                    node.hrefTarget = "right";

                    node.id = Guid.NewGuid().ToString("N");
                    node.itemid = iGroupId.ToString();
                    node.staticParentId = _rootId;

                    node.leaf = true;
                    if (iGroupId == 6)
                    {
                        node.leaf = false;
                    }
                    else
                        using (IDataReader rdr = SecureGroup.GetListChildGroups(iGroupId))
                        {
                            if (rdr.Read())
                                node.leaf = false;
                        }

                    nodes.Add(node);
                }
            }
            else
                return BindOrdinaryTree(parentId);

            if (nodes.Count > 0)
                return UtilHelper.JsonSerialize(nodes);
            else
                return String.Empty;
        }
コード例 #35
0
ファイル: TreeSource.aspx.cs プロジェクト: 0anion0/IBN
        private int BindRecursive(List<JsonTreeNode> nodes, XPathNavigator linkItem)
        {
            int retVal = 0;
            foreach (XPathNavigator subItem in linkItem.SelectChildren(string.Empty, string.Empty))
            {
                JsonTreeNode node = new JsonTreeNode();

                string text = UtilHelper.GetResFileString(subItem.GetAttribute("text", string.Empty));
                string id = subItem.GetAttribute("id", string.Empty);

                node.text = text;
                node.id = id;

                node.cls = "nodeCls";

                node.iconCls = "iconNodeCls";

                string iconUrl = subItem.GetAttribute("iconUrl", string.Empty);
                if (!String.IsNullOrEmpty(iconUrl))
                    node.icon = ResolveClientUrl(iconUrl);

                string iconCss = subItem.GetAttribute("iconCss", string.Empty);
                if (!String.IsNullOrEmpty(iconCss))
                    node.iconCls = iconCss;

                string command = subItem.GetAttribute("command", string.Empty);
                if (!String.IsNullOrEmpty(command))
                {
                    if (!CommandManager.IsEnableCommand("", "", "", ProfileManager.GetProfileIdByUser().ToString(), Mediachase.IBN.Business.Security.UserID.ToString(), command))
                        continue;
                    string cmd = CommandManager.GetCommandString(command, null);
                    cmd = cmd.Replace("\"", "&quot;");
                    node.href = String.Format("javascript:{0}", cmd);
                }

                bool isAsyncLoad = false;
                string treeLoader = subItem.GetAttribute("treeLoader", string.Empty);
                if (!String.IsNullOrEmpty(treeLoader))
                {
                    isAsyncLoad = true;
                }

                if (!isAsyncLoad)
                {
                    node.children = new List<JsonTreeNode>();
                    int count = BindRecursive(node.children, subItem);
                    if (count == 0)
                    {
                        node.leaf = true;
                        node.children = null;
                    }
                }

                nodes.Add(node);
                retVal++;
            }
            return retVal;
        }
コード例 #36
0
ファイル: TreeSource.aspx.cs プロジェクト: 0anion0/IBN
        private int BindRecursiveNoAsync(List<JsonTreeNode> nodes, XPathNavigator linkItem)
        {
            int retVal = 0;
            foreach (XPathNavigator subItem in linkItem.SelectChildren(string.Empty, string.Empty))
            {
                JsonTreeNode node = new JsonTreeNode();

                node.id = subItem.GetAttribute("id", string.Empty);

                node.text = UtilHelper.GetResFileString(subItem.GetAttribute("text", string.Empty));

                string order = subItem.GetAttribute("order", string.Empty);
                if (!string.IsNullOrEmpty(order))
                    node.text = String.Concat("<span class=\"rightColumn\">", order, "</span><span class=\"leftColumn\">", node.text, "</span>");

                node.cls = "nodeCls";
                node.iconCls = "iconNodeCls";

                string iconUrl = subItem.GetAttribute("iconUrl", string.Empty);
                if (!String.IsNullOrEmpty(iconUrl))
                    node.icon = ResolveClientUrl(iconUrl);

                string iconCss = subItem.GetAttribute("iconCss", string.Empty);
                if (!String.IsNullOrEmpty(iconCss))
                    node.iconCls = iconCss;

                node.children = new List<JsonTreeNode>();
                int count = BindRecursiveNoAsync(node.children, subItem);
                if (count == 0)
                {
                    node.leaf = true;
                    node.children = null;
                }

                nodes.Add(node);
                retVal++;
            }
            return retVal;
        }
コード例 #37
0
        private void BindRecursive(JsonTreeNode node, ArrayList parentList)
        {
            node.children = new List<JsonTreeNode>();

            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("Id", typeof(string)));
            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("Count", typeof(int)));
            DataRow dr;
            string nodeId = node.itemid;
            if(nodeId == "-1")
            {
                using (IDataReader reader = Project.GetListProjects())
                {
                    while (reader.Read())
                    {
                        ListFolder prj = ListManager.GetProjectRoot((int)reader["ProjectId"]);
                        dr = dt.NewRow();
                        dr["Id"] = prj.PrimaryKeyId.Value.ToString();
                        dr["Name"] = reader["Title"].ToString();
                        dr["Count"] = Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(prj).Length;
                        dt.Rows.Add(dr);
                    }
                }
            }
            else
            {
                ListFolder folder = new ListFolder(PrimaryKeyId.Parse(nodeId));
                foreach (Mediachase.Ibn.Data.Services.TreeNode tN in Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(folder))
                {
                    ListFolder inFolder = new ListFolder(tN.InnerObject.PrimaryKeyId.Value);
                    dr = dt.NewRow();
                    dr["Id"] = inFolder.PrimaryKeyId.Value.ToString();
                    dr["Name"] = inFolder.Title;
                    dr["Count"] = Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(inFolder).Length;
                    dt.Rows.Add(dr);
                }
            }

            DataView dv = dt.DefaultView;
            dv.Sort = "Name";
            foreach (DataRowView drv in dv)
            {
                JsonTreeNode inNode = new JsonTreeNode();
                inNode.leaf = ((int)drv["Count"] == 0);
                inNode.cls = "nodeCls";
                inNode.iconCls = "iconStdCls";
                inNode.icon = ResolveClientUrl("~/layouts/images/folder.gif");
                inNode.text = drv["Name"].ToString();
                inNode.id = Guid.NewGuid().ToString("N");
                inNode.itemid = drv["Id"].ToString();
                if (parentList.Contains(PrimaryKeyId.Parse(drv["Id"].ToString())))
                {
                    inNode.expanded = true;
                    BindRecursive(inNode, parentList);
                }
                else
                    inNode.expanded = false;

                Dictionary<string, string> param = new Dictionary<string, string>();
                param.Add("FolderId", drv["Id"].ToString());
                string cmd = CommandManager.GetCommandString("MC_ListApp_ChangeFolderTree", param);
                cmd = cmd.Replace("\"", "&quot;");
                inNode.href = String.Format("javascript:{0}", cmd);
                node.children.Add(inNode);
            }
        }
コード例 #38
0
        private void BindNode(string nodeId, ArrayList parentList)
        {
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();

            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("Id", typeof(string)));
            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("Count", typeof(int)));
            DataRow dr;

            if (nodeId == "0")
            {
                //Private Lists
                dr = dt.NewRow();
                ListFolder priv = ListManager.GetPrivateRoot(Mediachase.IBN.Business.Security.CurrentUser.UserID);
                dr["Id"] = priv.PrimaryKeyId.Value.ToString();
                dr["Name"] = GetGlobalResourceObject("IbnShell.Navigation", "tPrivLists").ToString();
                dr["Count"] = Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(priv).Length;
                dt.Rows.Add(dr);

                //Public Lists
                dr = dt.NewRow();
                ListFolder pub = ListManager.GetPublicRoot();
                dr["Id"] = pub.PrimaryKeyId.Value.ToString();
                dr["Name"] = GetGlobalResourceObject("IbnShell.Navigation", "tPubLists").ToString();
                dr["Count"] = Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(pub).Length;
                dt.Rows.Add(dr);

                //Projects Lists
                dr = dt.NewRow();
                dr["Id"] = "-1";
                dr["Name"] = GetGlobalResourceObject("IbnShell.Navigation", "tPrjLists").ToString();
                int count = 0;
                using (IDataReader reader = Project.GetListProjects())
                {
                    while (reader.Read())
                        count++;
                }
                dr["Count"] = count;
                dt.Rows.Add(dr);
            }
            else if (nodeId == "-1")
            {
                using (IDataReader reader = Project.GetListProjects())
                {
                    while (reader.Read())
                    {
                        ListFolder prj = ListManager.GetProjectRoot((int)reader["ProjectId"]);
                        dr = dt.NewRow();
                        dr["Id"] = prj.PrimaryKeyId.Value.ToString();
                        dr["Name"] = reader["Title"].ToString();
                        dr["Count"] = Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(prj).Length;
                        dt.Rows.Add(dr);
                    }
                }
            }
            else
            {
                ListFolder folder = new ListFolder(PrimaryKeyId.Parse(nodeId));
                foreach (Mediachase.Ibn.Data.Services.TreeNode tN in Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(folder))
                {
                    ListFolder inFolder = new ListFolder(tN.InnerObject.PrimaryKeyId.Value);
                    dr = dt.NewRow();
                    dr["Id"] = inFolder.PrimaryKeyId.Value.ToString();
                    dr["Name"] = inFolder.Title;
                    dr["Count"] = Mediachase.Ibn.Data.Services.TreeManager.GetChildNodes(inFolder).Length;
                    dt.Rows.Add(dr);
                }
            }

            DataView dv = dt.DefaultView;
            dv.Sort = "Name";
            foreach (DataRowView drv in dv)
            {
                JsonTreeNode node = new JsonTreeNode();
                node.leaf = ((int)drv["Count"] == 0);
                node.cls = "nodeCls";
                node.iconCls = "iconStdCls";
                node.icon = ResolveClientUrl("~/layouts/images/folder.gif");
                node.text = drv["Name"].ToString();
                node.id = Guid.NewGuid().ToString("N");
                node.itemid = drv["Id"].ToString();

                if (parentList.Contains(PrimaryKeyId.Parse(drv["Id"].ToString())))
                {
                    node.expanded = true;
                    BindRecursive(node, parentList);
                }
                else
                    node.expanded = false;

                if (node.itemid != "-1")
                {
                    Dictionary<string, string> param = new Dictionary<string, string>();
                    param.Add("FolderId", drv["Id"].ToString());
                    string cmd = CommandManager.GetCommandString("MC_ListApp_ChangeFolderTree", param);
                    cmd = cmd.Replace("\"", "&quot;");
                    node.href = String.Format("javascript:{0}", cmd);
                }
                nodes.Add(node);
            }
            WriteArray(nodes);
        }
コード例 #39
0
ファイル: LibraryProjectHandler.cs プロジェクト: 0anion0/IBN
        public string GetJsonDataSource(string nodeId)
        {
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();

            using (IDataReader reader = Project.GetListProjects())
            {
                while (reader.Read())
                {
                    JsonTreeNode rootNode = new JsonTreeNode();
                    rootNode.iconCls = "iconNodeCls";
                    int prjId = (int)reader["ProjectId"];
                    rootNode.text = reader["Title"].ToString();
                    rootNode.cls = "nodeCls";

                    rootNode.href = "../../../FileStorage/default.aspx?ProjectId=" + prjId.ToString();
                    rootNode.hrefTarget = "right";

                    rootNode.id = "MLibrary21_" + prjId.ToString();
                    rootNode.children = new List<JsonTreeNode>();

                    JsonTreeNode node = new JsonTreeNode();
                    node.iconCls = "iconNodeCls";
                    node.text = CHelper.GetResFileString("{IbnShell.Navigation:tSimpleTasks}");
                    node.cls = "nodeCls";
                    node.href = "../../../FileStorage/default.aspx?ProjectId=" + prjId.ToString() + "&TypeId=5";
                    node.hrefTarget = "right";
                    node.leaf = true;
                    rootNode.children.Add(node);

                    node = new JsonTreeNode();
                    node.iconCls = "iconNodeCls";
                    node.text = CHelper.GetResFileString("{IbnShell.Navigation:tTabDocuments}");
                    node.cls = "nodeCls";
                    node.href = "../../../FileStorage/default.aspx?ProjectId=" + prjId.ToString() + "&TypeId=16";
                    node.hrefTarget = "right";
                    node.leaf = true;
                    rootNode.children.Add(node);

                    node = new JsonTreeNode();
                    node.iconCls = "iconNodeCls";
                    node.text = CHelper.GetResFileString("{IbnShell.Navigation:tSimpleEvents}");
                    node.cls = "nodeCls";
                    node.href = "../../../FileStorage/default.aspx?ProjectId=" + prjId.ToString() + "&TypeId=4";
                    node.hrefTarget = "right";
                    node.leaf = true;
                    rootNode.children.Add(node);

                    node = new JsonTreeNode();
                    node.iconCls = "iconNodeCls";
                    node.text = CHelper.GetResFileString("{IbnShell.Navigation:tSimpleToDos}");
                    node.cls = "nodeCls";
                    node.href = "../../../FileStorage/default.aspx?ProjectId=" + prjId.ToString() + "&TypeId=6";
                    node.hrefTarget = "right";
                    node.leaf = true;
                    rootNode.children.Add(node);

                    nodes.Add(rootNode);
                }
            }

            if (nodes.Count > 0)
                return UtilHelper.JsonSerialize(nodes);
            else
                return String.Empty;
        }
コード例 #40
0
ファイル: SecureGroupsHandler.cs プロジェクト: 0anion0/IBN
        private string BindOrdinaryTree(int parentId)
        {
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();

            using (IDataReader reader = SecureGroup.GetListChildGroups(parentId))
            {
                while (reader.Read())
                {
                    int iGroupId = (int)reader["GroupId"];
                    JsonTreeNode node = new JsonTreeNode();
                    node.icon = "../../../Layouts/Images/icons/regular.gif";
                    if (iGroupId < 9 && iGroupId != 6)
                        node.icon = "../../../Layouts/Images/icons/Admins.gif";
                    if (SecureGroup.IsPartner(iGroupId) || iGroupId == 6)
                        node.icon = "../../../Layouts/Images/icons/Partners.gif";
                    node.iconCls = "iconStdCls";

                    node.leaf = true;
                    using (IDataReader rdr = SecureGroup.GetListChildGroups(iGroupId))
                    {
                        if (rdr.Read())
                            node.leaf = false;
                    }
                    node.text = CHelper.GetResFileString(reader["GroupName"].ToString());
                    node.cls = "nodeCls";

                    node.href = "../../../Directory/Directory.aspx?Tab=0&SGroupID=" + iGroupId.ToString(CultureInfo.InvariantCulture);
                    node.hrefTarget = "right";

                    node.id = Guid.NewGuid().ToString("N");
                    node.itemid = iGroupId.ToString();
                    node.staticParentId = _rootId;

                    nodes.Add(node);
                }
            }

            if (nodes.Count > 0)
                return UtilHelper.JsonSerialize(nodes);
            else
                return String.Empty;
        }
コード例 #41
0
        private void BindNode(string nodeId, ArrayList parentList)
        {
            List<JsonTreeNode> nodes = new List<JsonTreeNode>();
            string containerName = Request["ContainerName"];
            string containerKey = Request["ContainerKey"];

            Mediachase.IBN.Business.ControlSystem.FileStorage fs = Mediachase.IBN.Business.ControlSystem.FileStorage.Create(containerName, containerKey);
            DirectoryInfo diCur = fs.GetDirectory(int.Parse(nodeId));
            if (!fs.CanUserRead(diCur))
            {
                WriteArray(String.Empty);
            }
            else
            {
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("Id", typeof(string)));
                dt.Columns.Add(new DataColumn("Name", typeof(string)));
                dt.Columns.Add(new DataColumn("Count", typeof(int)));
                DataRow dr;
                DirectoryInfo[] dMas = fs.GetDirectories(int.Parse(nodeId));
                foreach (DirectoryInfo di in dMas)
                {
                    if (!fs.CanUserRead(di))
                        continue;
                    dr = dt.NewRow();
                    dr["Id"] = di.Id.ToString();
                    dr["Name"] = di.Name;

                    int count = 0;
                    DirectoryInfo[] check = fs.GetDirectories(di.Id);
                    foreach (DirectoryInfo dIn in check)
                        if (fs.CanUserRead(dIn))
                            count++;
                    dr["Count"] = count;

                    dt.Rows.Add(dr);
                }
                DataView dv = dt.DefaultView;
                dv.Sort = "Name";
                foreach (DataRowView drv in dv)
                {
                    JsonTreeNode node = new JsonTreeNode();
                    node.leaf = ((int)drv["Count"] == 0);
                    node.cls = "nodeCls";
                    node.iconCls = "iconStdCls";
                    node.icon = ResolveClientUrl("~/layouts/images/folder.gif");
                    node.text = drv["Name"].ToString();
                    node.id = Guid.NewGuid().ToString("N");
                    node.itemid = drv["Id"].ToString();

                    if (parentList.Contains(int.Parse(drv["Id"].ToString())))
                    {
                        node.expanded = true;
                        BindRecursive(node, parentList);
                    }
                    else
                        node.expanded = false;

                    Dictionary<string, string> param = new Dictionary<string, string>();
                    param.Add("ContainerKey", containerKey);
                    param.Add("FolderId", drv["Id"].ToString());
                    string cmd = CommandManager.GetCommandString("FL_ChangeFolderTree", param);
                    cmd = cmd.Replace("\"", "&quot;");
                    node.href = String.Format("javascript:{0}", cmd);

                    //node.href = ResolveClientUrl("~/Apps/FileLibrary/Pages/FileStorage.aspx?FolderId=" + di.Id);
                    //node.hrefTarget = "right";
                    nodes.Add(node);
                }
                WriteArray(nodes);
            }
        }
コード例 #42
0
ファイル: ListFoldersHandler.cs プロジェクト: 0anion0/IBN
        public string GetJsonDataSource(string nodeId)
        {
            int parentId = 0;
            int.TryParse(nodeId, out parentId);

            List<JsonTreeNode> nodes = new List<JsonTreeNode>();

            JsonTreeNode node;
            if (parentId == 0)
            {
                ListFolder privFolder = ListManager.GetPrivateRoot(Mediachase.Ibn.Data.Services.Security.CurrentUserId);
                node = new JsonTreeNode();

                node.text = CHelper.GetResFileString("{IbnShell.Navigation:tPrivLists}");
                node.cls = "nodeCls";

                node.id = Guid.NewGuid().ToString("N");
                node.itemid = privFolder.PrimaryKeyId.Value.ToString();
                node.staticParentId = _rootId;

                node.href = "../../../Apps/ListApp/Pages/ListInfoList.aspx?ListFolderId=" + privFolder.PrimaryKeyId.Value.ToString();
                node.hrefTarget = "right";

                if (!privFolder.HasChildren)
                    node.leaf = true;

                nodes.Add(node);

                ListFolder pubFolder = ListManager.GetPublicRoot();
                node = new JsonTreeNode();

                node.text = CHelper.GetResFileString("{IbnShell.Navigation:tPubLists}");
                node.cls = "nodeCls";

                node.id = Guid.NewGuid().ToString("N");
                node.itemid = pubFolder.PrimaryKeyId.Value.ToString();
                node.staticParentId = _rootId;

                node.href = "../../../Apps/ListApp/Pages/ListInfoList.aspx?ListFolderId=" + pubFolder.PrimaryKeyId.Value.ToString();
                node.hrefTarget = "right";

                if (!pubFolder.HasChildren)
                    node.leaf = true;

                nodes.Add(node);

                if (Mediachase.IBN.Business.Configuration.ProjectManagementEnabled)
                {
                    node = new JsonTreeNode();

                    node.text = CHelper.GetResFileString("{IbnShell.Navigation:tPrjLists}");
                    node.cls = "nodeCls";

                    node.id = Guid.NewGuid().ToString("N");
                    node.itemid = "-1";
                    node.staticParentId = _rootId;

                    node.href = "../../../Apps/ListApp/Pages/ListInfoList.aspx?ListFolderId=-1";
                    node.hrefTarget = "right";

                    node.leaf = true;
                    nodes.Add(node);
                }
            }
            else
            {
                ListFolder fParent = new ListFolder(parentId);
                if (fParent != null)
                {
                    Mediachase.Ibn.Data.Services.TreeService ts = fParent.GetService<Mediachase.Ibn.Data.Services.TreeService>();
                    foreach (Mediachase.Ibn.Data.Services.TreeNode tN in ts.GetChildNodes())
                    {
                        MetaObject moFolder = tN.InnerObject;
                        ListFolder folder = new ListFolder(moFolder.PrimaryKeyId.Value);
                        int iFolderId = folder.PrimaryKeyId.Value;

                        node = new JsonTreeNode();

                        node.text = folder.Title;
                        node.cls = "nodeCls";

                        node.id = Guid.NewGuid().ToString("N");
                        node.itemid = iFolderId.ToString();
                        node.staticParentId = _rootId;

                        node.href = "../../../Apps/ListApp/Pages/ListInfoList.aspx?ListFolderId=" + iFolderId.ToString();
                        node.hrefTarget = "right";

                        if (!folder.HasChildren)
                            node.leaf = true;

                        nodes.Add(node);
                    }
                }
            }

            if (nodes.Count > 0)
                return UtilHelper.JsonSerialize(nodes);
            else
                return String.Empty;
        }