Ejemplo n.º 1
0
        public static dtoScormPackageSettings CreateFrom(ScormPackageSettings settings, liteRepositoryItemVersion version)
        {
            dtoScormPackageSettings item = new dtoScormPackageSettings();

            item.Id                   = settings.Id;
            item.CheckScore           = settings.CheckScore;
            item.CheckScormCompletion = settings.CheckScormCompletion;
            item.CheckTime            = settings.CheckTime;
            item.EvaluationType       = settings.EvaluationType;
            item.IsCurrent            = settings.IsCurrent;
            item.MinScore             = settings.MinScore;
            item.MinTime              = settings.MinTime;
            item.Name                 = version.DisplayName;
            item.UseScoreScaled       = settings.UseScoreScaled;
            item.ValidUntil           = settings.ValidUntil;

            item.Children.AddRange(settings.Organizations.Select(o => dtoScormOrganizationSettings.CreateFrom(o, item)).ToList());
            if (item.Children.Any())
            {
                item.DataChildren = String.Join(",", item.Children.Select(i => i.DataId).ToList().Union(item.Children.Select(i => i.DataChildren).ToList()));
            }
            return(item);
        }
        public static dtoScormOrganizationFolder CreateFrom(ScormItemSettings source, IEnumerable <ScormItemSettings> items, dtoScormOrganizationSettings organization, dtoScormPackageSettings package)
        {
            dtoScormOrganizationFolder folder = new dtoScormOrganizationFolder();

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

            return(folder);
        }
Ejemplo n.º 3
0
        public static dtoScormActivitySettings CreateFrom(ScormItemSettings source, dtoScormOrganizationSettings organization, dtoScormPackageSettings package)
        {
            dtoScormActivitySettings activity = new dtoScormActivitySettings();

            activity.Id                   = source.Id;
            activity.Name                 = source.Title;
            activity.ActivityId           = source.ActivityId;
            activity.CheckScore           = source.CheckScore;
            activity.CheckScormCompletion = source.CheckScormCompletion;
            activity.CheckTime            = source.CheckTime;

            activity.MinScore         = source.MinScore;
            activity.MinTime          = source.MinTime;
            activity.UseScoreScaled   = source.UseScoreScaled;
            activity.OrganizationName = organization.Name;
            package.Activities.Add(activity);
            return(activity);
        }
        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);
        }