Beispiel #1
0
 private List <TrafficOnMainPage> GetTrafficListForTag(Account tag, Period period)
 {
     return((from t in _db.TransWithTags
             where period.ContainsAndTimeWasChecked(t.Timestamp) && t.Tags.Contains(tag)
             join
             r in _db.CurrencyRates
             on new { t.Timestamp.Date, Currency = t.Currency.GetValueOrDefault() } equals
             new { r.BankDay.Date, r.Currency } into g
             from rate in g.DefaultIfEmpty()
             select new TrafficOnMainPage()
     {
         Timestamp = t.Timestamp,
         Amount = t.AmountForTag(tag, t.Currency),
         Currency = t.Currency.GetValueOrDefault(),
         Rate = rate?.Rate ?? 0,
         Comment = t.Comment
     }).OrderBy(t => t.Timestamp).ToList());
 }
Beispiel #2
0
 private List <TrafficOnMainPage> GetTrafficWhereMyAccountIsFirstOrOnly(Account account, Period period)
 {
     return((from
             t in _db.TransWithTags
             where period.ContainsAndTimeWasChecked(t.Timestamp) && t.MyAccount.Is(account.Name)
             join
             r in _db.CurrencyRates
             on new { t.Timestamp.Date, Currency = t.Currency.GetValueOrDefault() } equals
             new { r.BankDay.Date, r.Currency } into g
             from rate in g.DefaultIfEmpty()
             select new TrafficOnMainPage()
     {
         Timestamp = t.Timestamp,
         Amount = t.AmountForAccount(account, t.Currency),
         Currency = t.Currency.GetValueOrDefault(),
         Rate = rate?.Rate ?? 0,
         Comment = t.Comment
     }).ToList());
 }
Beispiel #3
0
 private IEnumerable <TrafficOnMainPage> GetTrafficWhereMyAccountIsSecond(Account account, Period period)
 {
     return(from
            t in _db.TransWithTags
            where period.ContainsAndTimeWasChecked(t.Timestamp) &&
            t.MySecondAccount != null && t.MySecondAccount.Is(account.Name)
            join
            r in _db.CurrencyRates
            on new { t.Timestamp.Date, Currency = t.CurrencyOfSecondAccount() } equals
            new { r.BankDay.Date, r.Currency } into g
            from rate in g.DefaultIfEmpty()
            select new TrafficOnMainPage()
     {
         Timestamp = t.Timestamp,
         Amount = t.AmountForAccount(account, t.CurrencyOfSecondAccount()),
         Currency = t.CurrencyOfSecondAccount(),
         Rate = rate?.Rate ?? 0,
         Comment = t.Comment
     });
 }