コード例 #1
0
        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);
        }
コード例 #2
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);
        }
コード例 #3
0
        public virtual ScormItemSettings Copy(long idPackage, long idOrganization, long idParentItem)
        {
            ScormItemSettings item = new ScormItemSettings()
            {
                IdScormPackageSettings = idPackage, IdScormOrganizationSettings = idOrganization, IdParentItem = idParentItem
            };

            item.IsVisible            = IsVisible;
            item.CheckScormCompletion = CheckScormCompletion;
            item.CheckTime            = CheckTime;
            item.MinTime        = MinTime;
            item.CheckScore     = CheckScore;
            item.MinScore       = MinScore;
            item.UseScoreScaled = UseScoreScaled;
            item.Title          = Title;
            item.ScormType      = ScormType;
            item.ActivityId     = ActivityId;
            item.IsLeaf         = IsLeaf;
            return(item);
        }
コード例 #4
0
        public virtual ScormItemSettings CreateForUpdateSettings(long idPackage, long idOrganization, long idParentItem, EvaluationType evaluation, dtoScormItemEvaluationSettings dto)
        {
            ScormItemSettings item = new ScormItemSettings()
            {
                IdScormPackageSettings = idPackage, IdScormOrganizationSettings = idOrganization, IdParentItem = idParentItem
            };

            item.IsVisible            = IsVisible;
            item.Title                = Title;
            item.ScormType            = ScormType;
            item.CheckScore           = false;
            item.CheckScormCompletion = false;
            item.CheckTime            = false;
            item.MinScore             = 0;
            item.MinTime              = 0;
            item.UseScoreScaled       = false;
            item.ActivityId           = ActivityId;
            item.IsLeaf               = IsLeaf;

            if (evaluation == EvaluationType.CustomForActivities && dto != null)
            {
                item.CheckScore           = dto.CheckScore;
                item.CheckScormCompletion = dto.CheckScormCompletion;
                item.CheckTime            = dto.CheckTime;
                if (dto.CheckTime)
                {
                    item.MinTime = dto.MinTime;
                }
                if (dto.CheckScore)
                {
                    item.MinScore       = dto.MinScore;
                    item.UseScoreScaled = dto.UseScoreScaled;
                }
            }

            return(item);
        }