Beispiel #1
0
        public void GetOrganizationFromDatabase(string ip, bool isadmin)
        {
            var roots = from p in _databaseComponent.GetOrganizationData(ip) where p.Level == 0 && p.Is_Disabled == false orderby p.Sort_No select p;

            foreach (var root in roots.Distinct())//去重复
            {
                if (root.NodeType == 0 && root.Is_Disabled == false)
                {
                    T1_OrganizationPrivilege t_organization = null;
                    if (isadmin == false)
                    {
                        t_organization = (from p in T_OrganizationPrivilege[ip] where p.T_Organization_Guid == root.Guid select p).FirstOrDefault();
                    }
                    if (t_organization != null || isadmin == true)
                    {
                        OrganizationTreeItemViewModel organization = new OrganizationTreeItemViewModel(root, ip);
                        OrganizationTreeItems.Add(organization);
                        GetSubOrganization(organization, ip, isadmin);
                    }
                }
            }

            //新建回收站
            OrganizationTreeItemViewModel recyclednode = new OrganizationTreeItemViewModel("回收站", 0, ip);

            recyclednode.IsExpanded = true;
            RecycledTreeItems.Add(recyclednode);

            //回收站,有问题,htzk123,忘记是否修复了没有
            var recycles = from p in _databaseComponent.GetItemData(ip) where p.Is_Disabled == true orderby p.Modify_Time select p;

            foreach (var recycle in recycles.Distinct())//去重复
            {
                ItemTreeItemViewModel organization = new ItemTreeItemViewModel(recycle);
                recyclednode.AddChild(organization);

                ItemTreeItems.Add(organization);
            }
        }