Exemple #1
0
        private static void AddInHostV2List(
            SyncModel syncModel,
            int fromVersion)
        {
            IHostTypesDataService            hostTypesDataService = AndroAdminDataAccessFactory.GetHostTypesDataService();
            IHostV2DataService               hostV2DataService    = AndroAdminDataAccessFactory.GetHostV2DataService();
            IHostV2ForStoreDataService       hostV2ForStore       = AndroAdminDataAccessFactory.GetHostV2ForStoreDataService();
            IHostV2ForApplicationDataService hostV2ForApplication = AndroAdminDataAccessFactory.GetHostV2ForApplicationDataService();

            var hosts = hostV2DataService.List(e => e.DataVersion > fromVersion);

            var activeHosts   = hosts.Where(e => e.Enabled);
            var disabledHosts = hosts.Where(e => !e.Enabled);

            var deletedHosts = hostV2DataService.ListDeleted(e => e.DataVersion > fromVersion);

            var hosttypes        = hostTypesDataService.List(e => true);
            var hostApplications = hostV2ForApplication.ListHostConnections(e => e.HostV2.Any(hostV2 => hostV2.DataVersion > fromVersion));
            var hostStores       = hostV2ForStore.ListHostConnections(e => e.HostV2.Any(hostV2 => hostV2.DataVersion > fromVersion));

            syncModel.HostV2Models = new CloudSyncModel.HostV2.HostV2Models()
            {
                //full list of host types that are available
                HostTypes = hosttypes.Select(e => e.Name).ToList(),
                //actual list of active, available hosts
                Hosts = activeHosts.Select(hostV2 => hostV2.ToSyncModel()).ToList(),
                //any hosts that must be removed (disabled for maintenance or removed completely, even the ones that may even be back later)
                DeletedHosts = disabledHosts.Union(deletedHosts).Select(hostV2 => hostV2.ToSyncModel()).ToList(),
                //store specific links to the hosts
                StoreLinks = hostStores.Select(e => e.ToSyncModel()).ToList(),
                //application specific links to the hosts
                ApplicationLinks = hostApplications.Select(e => e.ToSyncModel()).ToList()
            };
        }