コード例 #1
0
        internal bool IsRemoteBudgetItemUsedInProfile(BudgetGroup profileGroup, RemoteBudget.RemoteBudgetItem remoteItem)
        {
            // Search for matching items in the profile
            var profileItem = profileGroup.BudgetItems.Where(i => i.Name == remoteItem.Label).FirstOrDefault();

            // Only count populated budget items with non-zero values as having been used
            return(profileItem != null && profileItem.Amount != 0m);
        }
コード例 #2
0
        public async Task RemoveUnusedBudgetItems(string budgetId, RemoteBudget.RemoteBudgetItem remoteItem, BudgetGroup profileGroup)
        {
            var profileItem = profileGroup.BudgetItems.Where(i => i.Name == remoteItem.Label).FirstOrDefault();

            // Not in the local profile? DELETE!
            if (!IsRemoteBudgetItemUsedInProfile(profileGroup, remoteItem))
            {
                await remoteBudgetCalls.DeleteBudgetItem(budgetId, remoteItem.Id);
            }
        }