Example #1
0
        public static async Task <nAssembla.Cache.SpaceDataCache> GetSpaceDataCache(string spaceId)
        {
            var dataCache   = new nAssembla.Cache.SpaceDataCache();
            var space       = SpaceProxy.GetAsync(spaceId, true);
            var components  = TicketComponentProxy.GetListAsync(true);
            var fields      = CustomFieldProxy.GetListAsync(true);
            var custReports = CustomReportProxy.GetListAsync(true);
            var statuses    = CustomStatusProxy.GetListAsync(true);
            var milestones  = MilestoneProxy.GetListAsync(true);
            var tools       = SpaceToolProxy.GetListAsync(true);
            var users       = UserProxy.GetListAsync(true);
            var userRoles   = UserRoleProxy.GetListAsync(true);

#if NET4_5
            await Task.WhenAll(space, components, fields, statuses, milestones, tools, users, custReports, userRoles);
#else
            await TaskEx.WhenAll(space, components, fields, statuses, milestones, tools, users, custReports, userRoles);
#endif
            dataCache.Space          = space.Result;
            dataCache.Components     = components.Result;
            dataCache.CustomFields   = fields.Result;
            dataCache.CustomStatuses = statuses.Result;
            dataCache.Milestones     = milestones.Result;
            dataCache.Tools          = tools.Result;
            dataCache.Users          = users.Result;
            dataCache.CustomReports  = custReports.Result;
            dataCache.UserRoles      = userRoles.Result;

            return(dataCache);
        }
Example #2
0
        public static async Task<nAssembla.Cache.DataCache> LoadCachableData(DTO.Space space, CachableDataTypes types)
        {
            var dataCache = new nAssembla.Cache.DataCache();
            var spaceCache = new nAssembla.Cache.SpaceDataCache();
            dataCache.Spaces[space.Id] = spaceCache;

            if ((types & CachableDataTypes.Components) == CachableDataTypes.Components)
            {
                spaceCache.Components = await new TicketComponentProxy().GetListAsync();
                RaiseDataLoaded(CachableDataTypes.Components, spaceCache.Components.Count());
            }

            if ((types & CachableDataTypes.Milestones) == CachableDataTypes.Milestones)
            {
                spaceCache.Milestones = await new MilestoneProxy().GetListAsync();
                RaiseDataLoaded(CachableDataTypes.Milestones, spaceCache.Milestones.Count());
            }

            return dataCache;
        }
Example #3
0
        public static async Task <nAssembla.Cache.DataCache> LoadCachableData(DTO.Space space, CachableDataTypes types)
        {
            var dataCache  = new nAssembla.Cache.DataCache();
            var spaceCache = new nAssembla.Cache.SpaceDataCache();

            dataCache.Spaces[space.Id] = spaceCache;

            if ((types & CachableDataTypes.Components) == CachableDataTypes.Components)
            {
                spaceCache.Components = await new TicketComponentProxy().GetListAsync();
                RaiseDataLoaded(CachableDataTypes.Components, spaceCache.Components.Count());
            }

            if ((types & CachableDataTypes.Milestones) == CachableDataTypes.Milestones)
            {
                spaceCache.Milestones = await new MilestoneProxy().GetListAsync();
                RaiseDataLoaded(CachableDataTypes.Milestones, spaceCache.Milestones.Count());
            }

            return(dataCache);
        }
Example #4
0
        public static void SetSpaceDataCache(nAssembla.Cache.SpaceDataCache cache)
        {
            if (cache.Components != null)
            {
                TicketComponentProxy.DataCache = cache.Components.ToList();
            }
            else
            {
                TicketComponentProxy.DataCache = null;
            }

            if (cache.CustomFields != null)
            {
                CustomFieldProxy.DataCache = cache.CustomFields.ToList();
            }
            else
            {
                CustomFieldProxy.DataCache = null;
            }

            if (cache.CustomStatuses != null)
            {
                CustomStatusProxy.DataCache = cache.CustomStatuses.ToList();
            }
            else
            {
                CustomStatusProxy.DataCache = null;
            }

            if (cache.CustomReports != null)
            {
                CustomReportProxy.DataCache = cache.CustomReports.ToList();
            }
            else
            {
                CustomReportProxy.DataCache = null;
            }

            if (cache.Milestones != null)
            {
                MilestoneProxy.DataCache = cache.Milestones.ToList();
            }
            else
            {
                MilestoneProxy.DataCache = null;
            }

            if (cache.Tools != null)
            {
                SpaceToolProxy.DataCache = cache.Tools.ToList();
            }
            else
            {
                SpaceToolProxy.DataCache = null;
            }

            if (cache.Users != null)
            {
                UserProxy.DataCache = cache.Users.ToList();
            }
            else
            {
                UserProxy.DataCache = null;
            }

            if (cache.UserRoles != null)
            {
                UserRoleProxy.DataCache = cache.UserRoles.ToList();
            }
            else
            {
                UserRoleProxy.DataCache = null;
            }
        }