public void BuildAppServiceTable(string appSerivceTag) { AppTierTable.Clear(); ServiceTableItem tableItem = null; AppService service = Services.FirstOrDefault( x => x.Tag == appSerivceTag); AppServiceSubscription subscription = null; SelectedAppServiceTableItem = null; if (_editApp.Subscriptions != null) { subscription = _editApp.Subscriptions.FirstOrDefault( x => (x.ServiceTier.OwnedBy as AppService).Type == "app"); } foreach (var tier in service.Tiers) { tableItem = CreateServiceTableItem(tier); AppTierTable.Add(tableItem); if (subscription != null && subscription.ServiceTier.Id == tableItem.Tier.Id) { SelectedAppServiceTableItem = tableItem; } } OnPropertyChanged("AppTierTable"); }
public static ServiceTableItem CreateServiceTableItem(AppServiceTier tier) { ServiceTableItem item = new ServiceTableItem(); item.Tag = tier.Tag; item.Name = tier.Name; item.ProvidedBy = (tier.OwnedBy as AppService).Name; item.Period = tier.Period; item.Cost = tier.ItemCost; item.Type = tier.Type; item.FeaturesAll = TranslateFeaturesAll(tier.OwnedBy as AppService); item.FeaturesIncluded = TranslateFeaturesIncluded(tier); item.Tier = tier; return(item); }
public void ResetAppServiceTable() { ObservableCollection <AppServiceTier> appTiers = null; AppServiceTier selectTier = null; if (_upgradableAppTiers.Any()) { appTiers = _upgradableAppTiers; selectTier = _upgradeAppServiceTier; } else { if (_editApp.Subscriptions != null) { var subscription = _editApp.Subscriptions.FirstOrDefault( x => (x.ServiceTier.OwnedBy as AppService).Type == "app"); selectTier = subscription.ServiceTier; SelectedAppServiceTag = (selectTier.OwnedBy as AppService).Tag; } else { SelectedAppServiceTag = DefaultAppServiceTag; } appTiers = AppService.Tiers; } AppTierTable.Clear(); ServiceTableItem tableItem = null; foreach (var tier in appTiers) { tableItem = CreateServiceTableItem(tier); AppTierTable.Add(tableItem); if (selectTier != null && selectTier.Id == tableItem.Tier.Id) { SelectedAppServiceTableItem = tableItem; } } OnPropertyChanged("AppTierTable"); }