Пример #1
0
        public void MigrateData()
        {
            try
            {
                Console.WriteLine("  Started forms data migration...");
                Console.WriteLine();

                var convertedForms = _destMasterRepository.GetSitecoreDescendantsItems(
                    _metadataProvider.GetItemMetadataByTemplateName("Form").destTemplateId,
                    _appSettings.itemReferences["destFormFolderId"]).Select(form => form.ID)
                                     .Where(formId => _sourceMasterRepository.GetSitecoreItemName(formId) != null).ToList();

                // Filter forms to select only included forms in appSettings "includeOnlyFormIds" parameter
                if (_appSettings.includeOnlyFormIds != null && _appSettings.includeOnlyFormIds.Any())
                {
                    convertedForms = convertedForms.Where(form => _appSettings.includeOnlyFormIds.Contains(form)).ToList();
                }

                int formsCounter = 0;
                ProgressBar.DrawTextProgressBar(formsCounter, convertedForms.Count, "forms data migrated");

                foreach (Guid convertedFormId in convertedForms)
                {
                    MigrateFormData(convertedFormId);
                    formsCounter++;
                    ProgressBar.DrawTextProgressBar(formsCounter, convertedForms.Count, "forms data migrated");
                }

                Console.WriteLine();
                Console.WriteLine();
                Console.WriteLine("  Finished forms data migration.");
                Console.WriteLine();
            }
            catch (Exception ex)
            {
                _logger.Log(new LogEntry(LoggingEventType.Error, "Failed to migrate forms data.", ex));
                throw;
            }
        }
Пример #2
0
 public void AddUnmappedItemField(SCField field, Guid itemId)
 {
     AddReportingRecord(new ReportingRecord()
     {
         ItemId           = itemId.ToString("B").ToUpper(),
         ItemName         = _sourceMasterRepository.GetSitecoreItemName(itemId),
         ItemPath         = _sourceMasterRepository.GetItemPath(itemId),
         ItemVersion      = field.Version,
         ItemLanguage     = field.Language,
         ItemTemplateId   = _sourceMasterRepository.GetItemTemplateId(itemId).ToString("B").ToUpper(),
         ItemTemplateName = _sourceMasterRepository.GetSitecoreItemName(_sourceMasterRepository.GetItemTemplateId(itemId)),
         FieldId          = field.FieldId.ToString("B").ToUpper(),
         FieldName        = _sourceMasterRepository.GetSitecoreItemName(field.FieldId),
         FieldType        = field.Type.ToString(),
         FieldValue       = field.Value,
         Message          = "Source Field Not Mapped"
     });
 }