public static dtoScormOrganizationSettings CreateFrom(ScormOrganizationSettings source, dtoScormPackageSettings package)
        {
            dtoScormOrganizationSettings organization = new dtoScormOrganizationSettings();

            organization.Id   = source.Id;
            organization.Name = source.Title;
            foreach (ScormItemSettings item in source.Items.Where(i => i.IdParentItem == 0))
            {
                if (source.Items.Any(i => i.IdParentItem == item.Id))
                {
                    organization.Children.Add(dtoScormOrganizationFolder.CreateFrom(item, source.Items.Where(i => i.IdParentItem != 0), organization, package));
                }
                else
                {
                    organization.Activities.Add(dtoScormActivitySettings.CreateFrom(item, organization, package));
                }
            }
            organization.DataChildren = "";
            if (organization.Children.Any() || organization.Activities.Any())
            {
                organization.DataChildren = String.Join(",", organization.Children.Select(i => i.DataId).ToList().Union(organization.Children.Select(i => i.DataChildren).ToList().Union(organization.Activities.Select(a => a.DataId).ToList())));
            }

            return(organization);
        }
Exemple #2
0
        public virtual ScormOrganizationSettings Copy(long idPackage)
        {
            ScormOrganizationSettings item = new ScormOrganizationSettings()
            {
                IdPackage = idPackage
            };

            item.IsDefault      = IsDefault;
            item.IsVisible      = IsVisible;
            item.SchemaVersion  = SchemaVersion;
            item.StructureType  = StructureType;
            item.Title          = Title;
            item.OrganizationId = OrganizationId;
            return(item);
        }