示例#1
0
        public virtual object GetNewResource(HttpContext context)
        {
            YZRequest request    = new YZRequest(context);
            string    parentRsid = request.GetString("parentRsid", null);

            UserResourceCollection existResources;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();

                existResources = UserResource.GetChildren(cn, parentRsid);
            }

            //获得新加项OrderIndex
            int orderIndex = 0;

            foreach (UserResource existResource in existResources)
            {
                if (existResource.OrderIndex >= orderIndex)
                {
                    orderIndex = existResource.OrderIndex + 1;
                }
            }

            return(new
            {
                RSID = Guid.NewGuid().ToString(),
                OrderIndex = orderIndex
            });
        }
示例#2
0
        protected virtual void ExpandTree(BPMConnection cn, JArray items, string rsid)
        {
            UserResourceCollection resources = UserResource.GetChildren(cn, rsid);

            foreach (UserResource resource in resources)
            {
                JObject item = new JObject();
                items.Add(item);
                item["leaf"]     = false;
                item["text"]     = resource.ResourceName;
                item["iconCls"]  = "folder";
                item["expanded"] = false;
                item["path"]     = resource.RSID;

                JArray children = new JArray();
                item[YZJsonProperty.children] = children;
                this.ExpandTree(cn, children, resource.RSID);
            }
        }