public OrganizationTreeInfoViewModel(OrganizationTreeInfo organizationTreeInfo,BusinessCoreService businessCoreService)
 {
     Info = organizationTreeInfo;
     Children = new ObservableCollection<OrganizationTreeInfoViewModel>();
     IsExpanded = Info.ParentId == null;
     _businessCoreService = businessCoreService;
 }
Beispiel #2
0
        private void PopulateTreeDescriptorsFromNew(OrganizationTreeInfo newData, OrganizationTreeDescriptor parent, int depth = 0)
        {
            var organizationDescriptor = new OrganizationTreeDescriptor()
            {
                ID               = newData.OrganizationId.ToString(),
                Name             = HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.Name)),
                Type             = HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(newData.Type)),
                Depth            = depth + 1,
                IsDisplayedOnYmg = newData.IsDisplayedOnYmg
            };

            if (newData.Missions != null)
            {
                organizationDescriptor.Missions = new HashSet <string>(newData.Missions.Select(x => HttpUtility.HtmlEncode(HttpUtility.HtmlDecode(x.Name))));
            }

            if (parent != null)
            {
                organizationDescriptor.ParentId = parent.ID;
                organizationDescriptor.Parent   = parent;

                parent.Children.Add(organizationDescriptor);
            }

            this.newServiceOrganizationDescriptors.Add(organizationDescriptor);

            foreach (var child in newData.Children)
            {
                PopulateTreeDescriptorsFromNew(child, organizationDescriptor, depth + 1);
            }
        }