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); }
async public Task <ServerStatus> LoadMenuItemsAsync() { ServerStatus status = new ServerStatus( ServerStatus.NEST_RESULT_ERROR); if (IsBusy) { return(status); } IsBusy = true; try { EditMenuItems.Clear(); WPPod.Models.MenuItem menuItemSeed = new WPPod.Models.MenuItem(); menuItemSeed.Menu = _selectedMenu; status = await ResultMultiple <WPPod.Models.MenuItem> .WaitForObjectAsync( NesterControl.DeployedApp, true, menuItemSeed, false); if (status.Code >= 0) { _menuItems = status.PayloadToList <WPPod.Models.MenuItem>(); OnPropertyChanged("EditMenuItems"); SelectedMenuItem = _menuItems.FirstOrDefault(); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } return(status); }
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; }
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; }
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); }
public async Task <ResultMultiple <SystemIOLog> > QuerySystemIOLogsAsync( string filter = null, string orderBy = null, int limit = -1, bool doCache = false, bool throwIfError = true) { string sql = FormSql("system_io", "*", filter, orderBy, limit); ResultMultiple <SystemIOLog> result = await QueryLogsAsync <SystemIOLog>( sql, doCache, throwIfError); if (result.Code == 0) { SystemIOLogs = result.Data.Payload; if (SystemIOLogs.Any()) { SystemIOLogs.All(log => { ioSeries.AddLog(log); return(true); }); OnPropertyChanged("IoSeriesIn"); OnPropertyChanged("IoSeriesOut"); } } return(result); }
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); }
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); }
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); }
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); }
async public Task LoadOrdersAsync(DateTime date) { if (IsBusy) { return; } IsBusy = true; try { WPPod.Models.Order orderSeed = new WPPod.Models.Order(); Dictionary <string, string> filter = new Dictionary <string, string>(); filter["date"] = date.ToString("yyyy-MM-dd"); ServerStatus status = await ResultMultiple <WPPod.Models.Order> .WaitForObjectAsync( NesterControl.DeployedApp, true, orderSeed, false, filter); if (status.Code >= 0) { _orders = status.PayloadToList <WPPod.Models.Order>(); WPPod.Models.OrderItem itemSeed = new WPPod.Models.OrderItem(); foreach (var order in _orders) { itemSeed.Order = order; status = await ResultMultiple <WPPod.Models.OrderItem> .WaitForObjectAsync( NesterControl.DeployedApp, true, itemSeed); if (status.Code >= 0) { order.Items = status.PayloadToList <WPPod.Models.OrderItem>(); WPPod.Models.MenuItem menuItemSeed = new WPPod.Models.MenuItem(); foreach (var orderItem in order.Items) { menuItemSeed.Menu = new WPPod.Models.Menu(); menuItemSeed.Menu.Id = orderItem.MenuId; menuItemSeed.Id = orderItem.MenuItemId; status = await ResultSingle <WPPod.Models.MenuItem> .WaitForObjectAsync( true, menuItemSeed, new CachedHttpRequest <WPPod.Models.MenuItem>( NesterControl.DeployedApp.QueryAsync), false, null, null); orderItem.MenuItem = status.PayloadToObject <WPPod.Models.MenuItem>(); } } } OnPropertyChanged("Orders"); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }