Example #1
0
        /// <summary>
        /// Ingests items
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        public override void Process(MediaSyncImportArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.AccountItem, "args.AccountItem");
            Assert.ArgumentNotNullOrEmpty(args.ImportName, "args.ImportName");

            try
            {
                if (args.ResultData == null)
                {
                    args.ResultData = ImportManager.Import(args.ImportName, args.AccountItem);

                    if (args.ResultData == null)
                    {
                        LogHelper.Warn(string.Format("ResultData is null. ImportName:{0}; AccountId:{1}", args.ImportName, args.AccountItem.ID), this);
                        args.AbortPipeline();
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("Import data failed.", this, ex);
                args.AbortPipeline();
            }
        }
Example #2
0
        /// <summary>
        /// Call Item Export
        /// </summary>
        /// <param name="args">
        /// The args.
        /// </param>
        public override void Process(MediaSyncImportArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNull(args.AccountItem, "args.AccountItem");

            try
            {
                if (args.ResultData == null)
                {
                    return;
                }

                foreach (var entity in args.ResultData)
                {
                    if (entity != null)
                    {
                        this.SyncEntity(entity, args.AccountItem);
                    }
                    else
                    {
                        LogHelper.Debug("Entity is null.", this);
                    }
                }
            }
            catch (Exception ex)
            {
                LogHelper.Error("Import data failed.", this, ex);
                args.AbortPipeline();
            }
        }