private static PEBudgetRow CreatePEBudgetRow(CashStatement transfer, string description, Action <CashStatement> delete, Action <CashStatement> edit, Func <CashStatement, string> amount, Week currentWeek, Color currentWeekColor) { return(new PEBudgetRow { OnEdit = () => edit(transfer), OnDelete = () => delete(transfer), Event = description ?? transfer.Description, Date = transfer.Date.ToString("d"), Amount = amount(transfer), BackgroundColor = currentWeek != null && currentWeek.Contains(transfer.Date) ? currentWeekColor : PEBudgetRow.Default, }); }
private void AddExpenses(BudgetWeek week, SortedDictionary <PEOrderKey, PEBudgetRow> dataSource, DayRowRank dayRowRank, IEnumerable <MonthlyCashStatement> expenses, Week currentWeek, Color currentWeekColor) { foreach (var expense in expenses) { var theExpense = expense; dataSource.Add( new PEOrderKey(week.FirstDay, WeekRowRank.Other, expense.Date, dayRowRank), new PEBudgetRow { OnEdit = () => OnEditMonthlyExpense(theExpense), OnConfigure = () => OnEditExpenseItem(theExpense), OnDelete = () => deletionService.DeleteMonthlyCashMovement(theExpense), Event = DescriptionOf(expense), Date = expense.Date.ToString("d"), Amount = expense.Amount.ToString(), BackgroundColor = currentWeek != null && currentWeek.Contains(expense.Date) ? currentWeekColor : PEBudgetRow.Default, }); } }