Esempio n. 1
0
        partial void BeforeCopyProperties(IBillExpense other, ref bool handled)
        {
            other.CheckArgument(nameof(other));
            other.Bill.CheckArgument(nameof(other.Bill));
            other.Expenses.CheckArgument(nameof(other.Expenses));
            other.Balances.CheckArgument(nameof(other.Balances));

            handled         = true;
            TotalExpense    = other.TotalExpense;
            FriendPortion   = other.FriendPortion;
            NumberOfFriends = other.NumberOfFriends;
            Friends         = other.Friends;
            FriendAmounts   = other.FriendAmounts;
            BilllEntity.CopyProperties(other.Bill);
            ExpenseEntities.Clear();
            foreach (var item in other.Expenses)
            {
                var expense = new Expense();

                expense.CopyProperties(item);
                ExpenseEntities.Add(expense);
            }
            BalanceEntities.Clear();
            foreach (var item in other.Balances)
            {
                var balance = new Balance();

                balance.CopyProperties(item);
                BalanceEntities.Add(balance);
            }
        }
Esempio n. 2
0
        public void Add(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            var entity = new Expense();

            entity.CopyProperties(expense);
            ExpenseEntities.Add(entity);
        }
Esempio n. 3
0
        public void Add(IExpense expense)
        {
            expense.CheckArgument(nameof(expense));

            var newItem = new Expense();

            newItem.CopyProperties(expense);
            ExpenseEntities.Add(newItem);
        }
Esempio n. 4
0
        public void CopyProperties(IBillExpense other)
        {
            other.CheckArgument(nameof(other));
            other.Bill.CheckArgument(nameof(other.Bill));
            other.Expenses.CheckArgument(nameof(other.Expenses));

            BillEntity.CopyProperties(other.Bill);
            ExpenseEntities.Clear();
            foreach (var item in other.Expenses)
            {
                var expense = new Expense();

                expense.CopyProperties(item);
                ExpenseEntities.Add(expense);
            }
        }
Esempio n. 5
0
        partial void BeforeCopyProperties(IBillExpense other, ref bool handled)
        {
            other.CheckArgument(nameof(other));
            other.Bill.CheckArgument(nameof(other.Bill));
            other.Expenses.CheckArgument(nameof(other.Expenses));

            handled = true;
            BillEntity.CopyProperties(other.Bill);
            ExpenseEntities.Clear();
            foreach (var item in other.Expenses)
            {
                var expense = new Expense();

                expense.CopyProperties(item);
                ExpenseEntities.Add(expense);
            }
        }
        public async Task <ITravelExpense> InsertAsync(ITravelExpense entity)
        {
            entity.CheckArgument(nameof(entity));
            entity.Travel.CheckArgument(nameof(entity.Travel));
            entity.Expenses.CheckArgument(nameof(entity.Expenses));

            var result = new TravelExpense();

            result.TravelEntity.CopyProperties(entity.Travel);
            foreach (var item in entity.Expenses)
            {
                var expense = new Expense();

                expense.Travel = result.TravelEntity;
                expense.CopyProperties(item);
                await expenseController.InsertAsync(expense);

                result.ExpenseEntities.Add(expense);
            }
            return(result);
        }