/// <summary> /// Creates a new monthly summary view. /// </summary> /// <param name="sourceMonthlySummary">The source of the monthly summary.</param> /// <param name="description">Optiona description for the month.</param> /// <returns>A monthly summary to display to the user.</returns> public static MonthlySummaryView CreateFromMonthlySummary(MonthlySummary sourceMonthlySummary, string description = null) { if (sourceMonthlySummary == null) { return(null); } string summaryDescription = string.IsNullOrEmpty(description) ? string.Format("{0}-{1}", sourceMonthlySummary.Year, sourceMonthlySummary.Month) : description; MonthlySummaryView monthlySummary = new MonthlySummaryView( summaryDescription, income: CentoCentsToDollars(sourceMonthlySummary.Income), spent: CentoCentsToDollars(sourceMonthlySummary.Spent)); return(monthlySummary); }
public static BankTransaction CreateFromSourceBankTransaction(SourceBankTransaction summaryBankTransaction) { if (summaryBankTransaction == null) { return(null); } string formattedAmount = MonthlySummaryView.FormatAmountWithNegativeSign( amount: MonthlySummaryView.CentoCentsToDollars(summaryBankTransaction.Amount)); BankTransaction bankTransaction = new BankTransaction() { TransactionId = summaryBankTransaction.TransactionId, TransactionTime = summaryBankTransaction.TransactionTime, Amount = formattedAmount, BankAccount = summaryBankTransaction.BankAccount, Merchant = summaryBankTransaction.Merchant, Categorization = summaryBankTransaction.Categorization, IsPending = summaryBankTransaction.IsPending }; return(bankTransaction); }