public BackupObject GetBackupObject(Action<ExportImportProgressInfo> progressCallback)
        {
			var progressInfo = new ExportImportProgressInfo();
			progressInfo.Description = "loading members...";
			progressCallback(progressInfo);

            var members = _memberSearchService.SearchMembers(new MembersSearchCriteria { DeepSearch = true, Take = int.MaxValue }).Members;

            var result = new BackupObject();
            result.Members = _memberService.GetByIds(members.Select(x => x.Id).ToArray()).OrderByDescending(x=> x.MemberType).ToArray();

            return result;
        }
Пример #2
0
 private void TreeComplete(IEnumerable <string> ids, BackupObject backupObject)
 {
     foreach (var id in ids)
     {
         var responce = _customerSearchService.Search(new SearchCriteria {
             Count = int.MaxValue, OrganizationId = id
         });
         var contacts      = responce.Contacts.Select(x => _contactService.GetById(x.Id)).ToArray();
         var organizations = responce.Organizations.Select(x => _organizationService.GetById(x.Id)).ToArray();
         backupObject.Contacts.AddRange(contacts);
         backupObject.Organizations.AddRange(organizations);
         TreeComplete(organizations.Select(x => x.Id).ToArray(), backupObject);
     }
 }
Пример #3
0
        public BackupObject GetBackupObject()
        {
            var responce = _customerSearchService.Search(new SearchCriteria {
                Count = int.MaxValue
            });
            var backupObject = new BackupObject
            {
                Contacts      = responce.Contacts.Select(x => _contactService.GetById(x.Id)).ToList(),
                Organizations = responce.Organizations.Select(x => _organizationService.GetById(x.Id)).ToList()
            };

            TreeComplete(responce.Organizations.Select(x => x.Id).ToArray(), backupObject);
            return(backupObject);
        }
Пример #4
0
        public BackupObject GetBackupObject(Action <ExportImportProgressInfo> progressCallback)
        {
            var progressInfo = new ExportImportProgressInfo();

            progressInfo.Description = "loading members...";
            progressCallback(progressInfo);

            var members = _memberService.SearchMembers(new SearchCriteria {
                DeepSearch = true, Take = int.MaxValue
            }).Members;

            var result = new BackupObject();

            result.Members = _memberService.GetByIds(members.Select(x => x.Id).ToArray()).OrderByDescending(x => x.MemberType).ToArray();

            return(result);
        }
Пример #5
0
        public BackupObject GetBackupObject(Action <ExportImportProgressInfo> progressCallback)
        {
            var progressInfo = new ExportImportProgressInfo();

            progressInfo.Description = "loading organizations and contacts...";
            progressCallback(progressInfo);

            var rootOrganization = GetOrganizations(null);
            var organizations    = rootOrganization != null?rootOrganization.Traverse(ChildrenForOrganization).ToArray() : null;

            var result = new BackupObject();

            if (organizations != null)
            {
                result.Contacts      = organizations.SelectMany(x => x.Contacts).Select(x => _contactService.GetById(x.Id)).ToArray();
                result.Organizations = organizations.SelectMany(x => x.Organizations).Select(x => _organizationService.GetById(x.Id)).ToArray();
            }

            return(result);
        }
		public BackupObject GetBackupObject(Action<ExportImportProgressInfo> progressCallback)
        {
			var progressInfo = new ExportImportProgressInfo();
			progressInfo.Description = "loading organizations and contacts...";
			progressCallback(progressInfo);

            var rootOrganization = GetOrganizations(null);
            var organizations = rootOrganization != null ? rootOrganization.Traverse(ChildrenForOrganization).ToArray() : null;

            var result = new BackupObject();
            if (organizations != null)
            {
                result.Contacts = organizations.SelectMany(x => x.Contacts).Select(x => _contactService.GetById(x.Id)).ToArray();
                result.Organizations = organizations.SelectMany(x => x.Organizations).Select(x=> _organizationService.GetById(x.Id)).ToArray();
            }

            return result;
        }
        public BackupObject GetBackupObject()
        {
           var responce = _customerSearchService.Search(new SearchCriteria { Count = int.MaxValue });
           var backupObject = new BackupObject
            {
                Contacts = responce.Contacts.Select(x => _contactService.GetById(x.Id)).ToList(),
                Organizations = responce.Organizations.Select(x => _organizationService.GetById(x.Id)).ToList()
            };

            TreeComplete(responce.Organizations.Select(x =>x.Id).ToArray(), backupObject);
            return backupObject;
        }
 private void TreeComplete(IEnumerable<string> ids, BackupObject backupObject)
 {
     foreach (var id in ids)
     {
         var responce = _customerSearchService.Search(new SearchCriteria { Count = int.MaxValue, OrganizationId = id });
         var contacts = responce.Contacts.Select(x => _contactService.GetById(x.Id)).ToArray();
         var organizations = responce.Organizations.Select(x => _organizationService.GetById(x.Id)).ToArray();
         backupObject.Contacts.AddRange(contacts);
         backupObject.Organizations.AddRange(organizations);
         TreeComplete(organizations.Select(x => x.Id).ToArray(), backupObject);
     }
 }