示例#1
0
        /// <summary>
        /// Adds package to the database.
        /// </summary>
        /// <param name="package">Package value represents package object with necessary information.</param>
        protected PackageItemIdentifier AddPackage(Package package)
        {
            PackageItemIdentifier packageId = null;
            ValidationResults importLog;

            using (PackageReader packageReader = package.GetPackageReader())
            {
                AddPackageResult result = PStore.AddPackage(packageReader, new PackageEnforcement(false, false, false));
                packageId = result.PackageId;
                importLog = result.Log;
            }

            LearningStoreJob job = LStore.CreateJob();
            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add(Schema.PackageItem.IudicoCourseRef, package.CourseID);
            job.UpdateItem(packageId, dic);
            job.Execute();

            return packageId;
        }
示例#2
0
        /// <summary>
        /// Adds package to the database.
        /// </summary>
        /// <param name="package">Package value represents package object with necessary information.</param>
        protected PackageItemIdentifier AddPackage(Package package)
        {
            PackageItemIdentifier packageId;

            using (PackageReader packageReader = package.GetPackageReader())
            {
                AddPackageResult result = this.PStore.AddPackage(
                    packageReader, new PackageEnforcement(false, false, false));
                packageId = result.PackageId;
            }

            LearningStoreJob job = this.LStore.CreateJob();
            var dic = new Dictionary<string, object> { { Schema.PackageItem.IudicoCourseRef, package.CourseID } };
            job.UpdateItem(packageId, dic);
            job.Execute();

            return packageId;
        }