예제 #1
0
        private void AddCategoryToRelation(object obj)
        {
            Relation             relation = EditingItem.Result as Relation;
            CategoryRelationLink link     = new CategoryRelationLink();

            link.RelationID = relation.ID;
            link.Relation   = relation;
            link.CategoryID = SelectedCategory.ID;
            link.Category   = SelectedCategory;
            relation.CategoryLinks.Add(link);

            LinkWrappers.Add(new CategoryRelationLinkWrapper(link: link, percentage: 0, maxPercentage: 100 - EditingItem.Result.CategoryLinks.Where(c => c != link).Sum(c => c.Percentage), wrappers: LinkWrappers, links: relation.CategoryLinks));
        }
예제 #2
0
        private void AddCategoryToTransaction(object obj)
        {
            Transaction             transaction = EditingItem.Result as Transaction;
            CategoryTransactionLink link        = new CategoryTransactionLink();

            link.TransactionID = transaction.ID;
            link.Transaction   = transaction;
            link.CategoryID    = SelectedCategory.ID;
            link.Category      = SelectedCategory;
            link.UserId        = ServiceResolver.GetService <IUserProvider>().GetUserId();
            transaction.CategoryLinks.Add(link);

            LinkWrappers.Add(new CategoryTransactionLinkWrapper(transaction, link: link, percentage: 0, maxPercentage: 100 - EditingItem.Result.CategoryLinks.Where(c => c != link).Sum(c => c.Percentage), wrappers: LinkWrappers, links: transaction.CategoryLinks));
        }