コード例 #1
0
        public static async Task QueryServicesAsync(BackendService <UserT> backend)
        {
            AppService serviceSeed = new AppService();

            ResultMultiple <AppService> result = await ResultMultipleUI <AppService> .WaitForObjectsAsync(
                true, serviceSeed, new CachedHttpRequest <AppService, ResultMultiple <AppService> >(
                    backend.QueryAsyncListAsync), true);

            if (result.Code < 0)
            {
                return;
            }

            _appServices = result.Data.Payload;
            AppServiceTier tierSeed = new AppServiceTier();
            ResultMultiple <AppServiceTier> resultTier;

            foreach (AppService service in _appServices)
            {
                tierSeed.OwnedBy = service;

                resultTier = await ResultMultipleUI <AppServiceTier> .WaitForObjectsAsync(
                    true, tierSeed, new CachedHttpRequest <AppServiceTier, ResultMultiple <AppServiceTier> >(
                        backend.QueryAsyncListAsync), true);

                if (result.Code == 0)
                {
                    service.Tiers = resultTier.Data.Payload;
                }
            }
        }
コード例 #2
0
        public async Task <ResultMultiple <Deployment> > QueryDeploymentsAsync(
            Deployment deployment = null, bool doCache = false, bool throwIfError = true)
        {
            Deployment theDeployment = deployment == null ? _editApp.Deployment : deployment;

            ResultMultiple <Deployment> result = await ResultMultipleUI <Deployment> .WaitForObjectsAsync(
                true, theDeployment, new CachedHttpRequest <Deployment, ResultMultiple <Deployment> >(
                    Backend.QueryAsyncListAsync), true);

            _editApp.Deployment = null;

            if (result.Code >= 0)
            {
                _deployments = result.Data.Payload;
                if (_deployments.Any())
                {
                    _editDeployment     = _deployments.First();
                    _editApp.Deployment = _editDeployment;
                }

                OnPropertyChanged("Deployments");
            }

            return(result);
        }
コード例 #3
0
ファイル: AppViewModel.cs プロジェクト: inkton/nester.library
        public async Task <ResultMultiple <Forest> > QueryAppServiceTierLocationsAsync(AppServiceTier teir,
                                                                                       bool doCache = false, bool throwIfError = true)
        {
            Forest forestSeeder = new Forest();

            forestSeeder.OwnedBy = teir;

            return(await ResultMultipleUI <Forest> .WaitForObjectsAsync(
                       throwIfError, forestSeeder, new CachedHttpRequest <Forest, ResultMultiple <Forest> >(
                           Backend.QueryAsyncListAsync), doCache));
        }
コード例 #4
0
        public async Task <ResultMultiple <T> > QueryLogsAsync <T>(string sql,
                                                                   bool doCache = false, bool throwIfError = false) where T : Log, new()
        {
            Dictionary <string, string> data = new Dictionary <string, string>();

            data.Add("sql", sql);

            T logsSeed = new T();

            return(await ResultMultipleUI <T> .WaitForObjectsAsync(
                       true, logsSeed, new CachedHttpRequest <T, ResultMultiple <T> >(
                           Backend.QueryAsyncListAsync), true));
        }
コード例 #5
0
        public async Task <ResultMultiple <Permission> > QueryPermissionsAsync(Contact contact = null,
                                                                               bool doCache    = false, bool throwIfError = true)
        {
            Contact    theContact     = contact == null ? _editContact : contact;
            Permission seedPermission = new Permission();

            seedPermission.OwnedBy = theContact;
            ObservableCollection <Permission> permissions = new ObservableCollection <Permission>();

            ResultMultiple <Permission> result = await ResultMultipleUI <Permission> .WaitForObjectsAsync(
                true, seedPermission, new CachedHttpRequest <Permission, ResultMultiple <Permission> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                permissions = result.Data.Payload;
                OwnerCapabilities caps = new OwnerCapabilities();
                caps.Reset();

                foreach (Permission permission in permissions)
                {
                    switch (permission.AppPermissionTag)
                    {
                    case "create-app": break;

                    case "view-app": caps.CanViewApp = true; break;

                    case "update-app": caps.CanUpdateApp = true; break;

                    case "delete-app": caps.CanDeleteApp = true; break;

                    case "create-nest": caps.CanCreateNest = true; break;

                    case "update-nest": caps.CanUpdateNest = true; break;

                    case "delete-nest": caps.CanDeleteNest = true; break;

                    case "view-nest": caps.CanViewNest = true; break;

                    default:
                        System.Diagnostics.Debugger.Break();
                        break;
                    }
                }

                theContact.OwnerCapabilities = caps;
            }

            return(result);
        }
コード例 #6
0
        public async Task <ResultMultiple <BillingCycle> > QueryBillingCyclesAsync(
            bool doCache = true, bool throwIfError = true)
        {
            BillingCycle seed = new BillingCycle();

            ResultMultiple <BillingCycle> result = await ResultMultipleUI <BillingCycle> .WaitForObjectsAsync(
                true, seed, new CachedHttpRequest <BillingCycle, ResultMultiple <BillingCycle> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code == 0)
            {
                BillingCycles = result.Data.Payload;
            }

            return(result);
        }
コード例 #7
0
        public async Task <ResultMultiple <Inkton.Nest.Model.Nest> > QueryNestsAsync(
            bool doCache = false, bool throwIfError = true)
        {
            _editNest.OwnedBy = _editApp;

            ResultMultiple <Nest.Model.Nest> result = await ResultMultipleUI <Nest.Model.Nest> .WaitForObjectsAsync(
                true, _editNest, new CachedHttpRequest <Nest.Model.Nest, ResultMultiple <Nest.Model.Nest> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _nests = result.Data.Payload;
                OnPropertyChanged("Nests");
            }

            return(result);
        }
コード例 #8
0
        public async Task <ResultMultiple <AppAudit> > QueryAppAuditsAsync(IDictionary <string, object> filter,
                                                                           AppAudit appAudit = null, bool doCache = false, bool throwIfError = true)
        {
            AppAudit theAudit = appAudit == null ? _editAudit : appAudit;

            ResultMultiple <AppAudit> result = await ResultMultipleUI <AppAudit> .WaitForObjectsAsync(
                true, theAudit, new CachedHttpRequest <AppAudit, ResultMultiple <AppAudit> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _audits = result.Data.Payload;
                OnPropertyChanged("AppAudits");
            }

            return(result);
        }
コード例 #9
0
        public async Task <ResultMultiple <UserBillingTask> > QueryUserBillingTasksAsync(IDictionary <string, object> filter,
                                                                                         bool doCache = true, bool throwIfError = true)
        {
            UserBillingTask seed = new UserBillingTask();

            seed.OwnedBy = Backend.Permit.User;

            ResultMultiple <UserBillingTask> result = await ResultMultipleUI <UserBillingTask> .WaitForObjectsAsync(
                true, seed, new CachedHttpRequest <UserBillingTask, ResultMultiple <UserBillingTask> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code == 0)
            {
                UserBillingTasks = result.Data.Payload;
            }

            return(result);
        }
コード例 #10
0
        public async Task <ResultMultiple <NestPlatform> > QueryNestPlatformsAsync(
            bool doCache = false, bool throwIfError = true)
        {
            NestPlatform platformSeed = new NestPlatform();

            platformSeed.OwnedBy = _editApp;

            ResultMultiple <NestPlatform> result = await ResultMultipleUI <NestPlatform> .WaitForObjectsAsync(
                true, platformSeed, new CachedHttpRequest <NestPlatform, ResultMultiple <NestPlatform> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _platforms = result.Data.Payload;
            }

            return(result);
        }
コード例 #11
0
        public async Task <ResultMultiple <UserEvent> > QueryUserEventsAsync(UserT user,
                                                                             bool doCache = false, bool throwIfError = true, Dictionary <string, object> data = null)
        {
            UserEvent userEventSeed = new UserEvent();

            userEventSeed.OwnedBy = user == null ? Backend.Permit.User : user;

            ResultMultiple <UserEvent> result = await ResultMultipleUI <UserEvent> .WaitForObjectsAsync(
                true, userEventSeed, new CachedHttpRequest <UserEvent, ResultMultiple <UserEvent> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                UserEvents = result.Data.Payload;
            }

            return(result);
        }
コード例 #12
0
ファイル: AppViewModel.cs プロジェクト: inkton/nester.library
        public async Task <ResultMultiple <Notification> > QueryAppNotificationsAsync(App app      = null,
                                                                                      bool doCache = false, bool throwIfError = true)
        {
            App          theApp           = app == null ? _editApp : app;
            Notification notificationSeed = new Notification();

            notificationSeed.OwnedBy = theApp;

            ResultMultiple <Notification> result = await ResultMultipleUI <Notification> .WaitForObjectsAsync(
                true, notificationSeed, new CachedHttpRequest <Notification, ResultMultiple <Notification> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code == 0)
            {
                _notifications = result.Data.Payload;
            }

            return(result);
        }
コード例 #13
0
        public async Task <ResultMultiple <Share> > QuerySharesAsync(
            bool doCache = true, bool throwIfError = true)
        {
            Share shareSeed = new Share();

            shareSeed.OwnedBy = _selectedIndustry;

            ResultMultiple <Share> result = await ResultMultipleUI <Share> .WaitForObjectsAsync(
                true, shareSeed, new CachedHttpRequest <Share, ResultMultiple <Share> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                Shares        = result.Data.Payload;
                SelectedShare = _shares.FirstOrDefault();
            }

            return(result);
        }
コード例 #14
0
        public async Task <ResultMultiple <Invitation> > QueryInvitationsAsync(
            bool doCache = false, bool throwIfError = true)
        {
            ResultMultiple <Invitation> result = await ResultMultipleUI <Invitation> .WaitForObjectsAsync(
                true, _editInvitation, new CachedHttpRequest <Invitation, ResultMultiple <Invitation> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _invitations = result.Data.Payload;

                if (_invitations.Any())
                {
                    _editInvitation = _invitations.FirstOrDefault();
                }
            }

            return(result);
        }
コード例 #15
0
        public async Task <ResultMultiple <AppBackup> > QueryAppBackupsAsync(AppBackup appBackup = null,
                                                                             bool doCache        = false, bool throwIfError = true)
        {
            AppBackup theBackup = appBackup == null ? _editBackup : appBackup;

            theBackup.OwnedBy = _editApp.Deployment;

            ResultMultiple <AppBackup> result = await ResultMultipleUI <AppBackup> .WaitForObjectsAsync(
                true, theBackup, new CachedHttpRequest <AppBackup, ResultMultiple <AppBackup> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _backups = result.Data.Payload;
                OnPropertyChanged("AppBackups");
            }

            return(result);
        }
コード例 #16
0
        public async Task <ResultMultiple <SoftwareFramework.Version> > QuerySoftwareFrameworkVersionsAsync(
            bool doCache = true, bool throwIfError = true)
        {
            SoftwareFramework frameworkSeed = new SoftwareFramework();

            frameworkSeed.Tag = "aspdotnetcore";
            SoftwareFramework.Version versionSeed = new SoftwareFramework.Version();
            versionSeed.OwnedBy = frameworkSeed;

            ResultMultiple <SoftwareFramework.Version> result = await ResultMultipleUI <SoftwareFramework.Version> .WaitForObjectsAsync(
                true, versionSeed, new CachedHttpRequest <SoftwareFramework.Version, ResultMultiple <SoftwareFramework.Version> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _dotnetVersions = result.Data.Payload;
            }

            return(result);
        }
コード例 #17
0
        public async Task <ResultMultiple <App> > LoadApps(
            bool doCache = true, bool throwIfError = true)
        {
            ResultMultiple <App> result = await ResultMultipleUI <App> .WaitForObjectAsync(
                Platform, throwIfError, _editApp, doCache);

            if (result.Code == 0)
            {
                ObservableCollection <App> apps = result.Data.Payload;

                if (apps.Any())
                {
                    foreach (App app in apps)
                    {
                        AddApp(app);
                    }
                }
            }

            return(result);
        }
コード例 #18
0
        public async Task<ResultSingle<AppDomain>> QueryDomainAsync(AppDomain domain = null, 
            bool doCache = false, bool throwIfError = true)
        {
            AppDomain theDomain = domain == null ? _editDomain : domain;

            ResultSingle<AppDomain> result = await ResultSingleUI<AppDomain>.WaitForObjectAsync(
                throwIfError, theDomain, new CachedHttpRequest<AppDomain, ResultSingle<AppDomain>>(
                    Backend.QueryAsync), doCache, null, null);

            if (result.Code >= 0)
            {
                _editDomain = result.Data.Payload;

                AppDomainCertificate seedCert = new AppDomainCertificate();
                seedCert.OwnedBy = _editDomain;

                ResultMultiple<AppDomainCertificate> certResult = await ResultMultipleUI<AppDomainCertificate>.WaitForObjectsAsync(
                    true, seedCert, new CachedHttpRequest<AppDomainCertificate, ResultMultiple<AppDomainCertificate>>(
                        Backend.QueryAsyncListAsync), true);

                if (certResult.Code >= 0)
                {
                    ObservableCollection<AppDomainCertificate> list = certResult.Data.Payload;

                    if (list.Any())
                    {
                        theDomain.Certificate = list.First();
                        theDomain.Certificate.OwnedBy = theDomain;
                    }
                }

                if (domain != null)
                {
                    _editDomain.CopyTo(domain);
                }
            }

            return result;
        }
コード例 #19
0
        public async Task<ResultMultiple<AppDomain>> QueryDomainsAsync(
            bool doCache = false, bool throwIfError = true)
        {
            ResultMultiple<AppDomain> result = await ResultMultipleUI<AppDomain>.WaitForObjectsAsync(
                true, _editDomain, new CachedHttpRequest<AppDomain, ResultMultiple<AppDomain>>(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _domains = result.Data.Payload;

                foreach (AppDomain domain in _domains)
                {
                    domain.OwnedBy = _editApp;
                    domain.Primary = (_editApp.PrimaryDomainId == domain.Id);
                    domain.IPAddress = _editApp.IPAddress;
 
                    AppDomainCertificate seedCert = new AppDomainCertificate();
                    seedCert.OwnedBy = domain;

                    ResultMultiple<AppDomainCertificate> certResult = await ResultMultipleUI<AppDomainCertificate>.WaitForObjectsAsync(
                        true, seedCert, new CachedHttpRequest<AppDomainCertificate, ResultMultiple<AppDomainCertificate>>(
                            Backend.QueryAsyncListAsync), true);

                    if (certResult.Code >= 0)
                    {
                        ObservableCollection<AppDomainCertificate> list = certResult.Data.Payload;

                        if (list.Any())
                        {
                            domain.Certificate = list.First();
                            domain.Certificate.OwnedBy = domain;
                        }
                    }
                }
            }

            return result;
        }
コード例 #20
0
        public async Task <ResultMultiple <Forest> > QueryForestsAsync(
            bool doCache = true, bool throwIfError = true)
        {
            Forest forestSeed = new Forest();

            ResultMultiple <Forest> result = await ResultMultipleUI <Forest> .WaitForObjectsAsync(
                true, forestSeed, new CachedHttpRequest <Forest, ResultMultiple <Forest> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _forests = result.Data.Payload;
                _forestByTag.Clear();

                foreach (Forest forest in _forests)
                {
                    _forestByTag[forest.Tag] = forest;
                }
            }

            return(result);
        }
コード例 #21
0
        public async Task <ResultMultiple <AppServiceSubscription> > QueryAppSubscriptions(App app      = null,
                                                                                           bool doCache = false, bool throwIfError = true)
        {
            AppServiceSubscription subSeeder = new AppServiceSubscription();

            subSeeder.OwnedBy = (app == null ? _editApp : app);

            ResultMultiple <AppServiceSubscription> result = await ResultMultipleUI <AppServiceSubscription> .WaitForObjectsAsync(
                true, subSeeder, new CachedHttpRequest <AppServiceSubscription, ResultMultiple <AppServiceSubscription> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                ObservableCollection <AppServiceSubscription> serviceSubscriptions = result.Data.Payload;

                foreach (AppServiceSubscription subscription in serviceSubscriptions)
                {
                    subscription.OwnedBy = subSeeder.OwnedBy;

                    foreach (AppService service in _appServices)
                    {
                        foreach (AppServiceTier tier in service.Tiers)
                        {
                            if (subscription.AppServiceTierId == tier.Id)
                            {
                                subscription.ServiceTier = tier;
                            }
                        }
                    }
                }

                (subSeeder.OwnedBy as App).Subscriptions = serviceSubscriptions;
            }

            return(result);
        }
コード例 #22
0
        public async Task <ResultMultiple <Industry> > QueryIndustriesAsync(
            bool doCache = true, bool throwIfError = true)
        {
            _shares.Clear();

            Industry industrySeed = new Industry();

            ResultMultiple <Industry> result = await ResultMultipleUI <Industry> .WaitForObjectsAsync(
                true, industrySeed, new CachedHttpRequest <Industry, ResultMultiple <Industry> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                Industries       = result.Data.Payload;
                SelectedIndustry = _industries.FirstOrDefault();

                if (_selectedIndustry != null)
                {
                    await QuerySharesAsync(doCache, throwIfError);
                }
            }

            return(result);
        }
コード例 #23
0
        public async Task <ResultMultiple <AppServiceTier> > QueryAppUpgradeServiceTiersAsync(
            AppService service = null, Deployment deployment = null, bool doCache = true, bool throwIfError = true)
        {
            AppService theService = service == null ? AppService : service;

            Deployment theDeployment = deployment == null ? _editApp.Deployment : deployment;

            theService.OwnedBy = theDeployment;

            AppServiceTier tierSeed = new AppServiceTier();

            tierSeed.OwnedBy = theService;

            ResultMultiple <AppServiceTier> result = await ResultMultipleUI <AppServiceTier> .WaitForObjectsAsync(
                true, tierSeed, new CachedHttpRequest <AppServiceTier, ResultMultiple <AppServiceTier> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _upgradableAppTiers = result.Data.Payload;
            }

            return(result);
        }
コード例 #24
0
        public async Task <ResultMultiple <Contact> > QueryContactsAsync(
            bool doCache = false, bool throwIfError = true)
        {
            ResultMultiple <Contact> result = await ResultMultipleUI <Contact> .WaitForObjectsAsync(
                true, _editContact, new CachedHttpRequest <Contact, ResultMultiple <Contact> >(
                    Backend.QueryAsyncListAsync), true);

            if (result.Code >= 0)
            {
                _contacts = result.Data.Payload;
                _editApp.OwnerCapabilities = null;

                /* The owner is to be treated differently
                 * The owner contact does not need invitation
                 * for example.
                 */
                foreach (Contact contact in _contacts)
                {
                    contact.OwnedBy = _editContact.OwnedBy;
                    await QueryPermissionsAsync(contact, throwIfError);

                    if (contact.UserId != null &&
                        contact.UserId == Backend.Permit.User.Id)
                    {
                        _ownerContact              = contact;
                        _editContact               = contact;
                        _collaboration.OwnedBy     = contact;
                        _editApp.OwnerCapabilities = contact.OwnerCapabilities;
                    }
                }

                OnPropertyChanged("Contacts");
            }

            return(result);
        }