public Transaction(RepeatingTransaction r) { this.TransactionDate = r.NextOccurence; this.TransactionTypeId = r.TransactionTypeId; this.TransAmount = r.TransAmount; this.StatusId = r.StatusId; this.Notes = r.Notes; this.Account = r.Account; this.Payee = r.Payee; this.Category = r.Category; this.ToAccount = r.ToAccount; this.RepeatingTransactionId = r.Id; }
public async Task <bool> UpdateRepeatingTransactionAsync(RepeatingTransaction r) { throw new NotImplementedException(); }
public async Task <DateTime?> GetNextOccuranceAsync(RepeatingTransaction r) { if (r.TimesRepeated == 0) { return(null); } switch (r.Repeat) { case RepeatType.Weekly: return(r.NextOccurence.AddDays(7)); case RepeatType.BiWeekly: return(r.NextOccurence.AddDays(3.5)); case RepeatType.Monthly: return(r.NextOccurence.AddMonths(1)); case RepeatType.BiMonthly: return(r.NextOccurence.AddDays(14)); case RepeatType.Quarterly: return(r.NextOccurence.AddMonths(3)); case RepeatType.HalfYearly: return(r.NextOccurence.AddMonths(6)); case RepeatType.Yearly: return(r.NextOccurence.AddYears(1)); case RepeatType.FourMonths: return(r.NextOccurence.AddMonths(4)); case RepeatType.FourWeeks: return(r.NextOccurence.AddDays(28)); case RepeatType.Daily: return(r.NextOccurence.AddDays(1)); case RepeatType.LastDayOfMonth: DateTime newDate = r.NextOccurence.AddMonths(2); return(newDate.AddDays(0 - newDate.Day)); case RepeatType.LastWeekdayOfMonth: DateTime newDate1 = r.NextOccurence.AddMonths(2); newDate1 = newDate1.AddDays(0 - newDate1.Day); if (newDate1.DayOfWeek == DayOfWeek.Saturday) { newDate1 = newDate1.AddDays(-1); } if (newDate1.DayOfWeek == DayOfWeek.Sunday) { newDate1 = newDate1.AddDays(-1); } return(newDate1); case RepeatType.LastWeekdayBeforeNthDayOfMonth: DateTime newDate2 = r.NextOccurence.AddMonths(1); if (r.DayOfMonth != 0) { newDate2 = newDate2.AddDays(0 - newDate2.Day + r.DayOfMonth); } if (newDate2.DayOfWeek == DayOfWeek.Saturday) { newDate2 = newDate2.AddDays(-1); } if (newDate2.DayOfWeek == DayOfWeek.Sunday) { newDate2 = newDate2.AddDays(-1); } return(newDate2); case RepeatType.None: default: return(null); } }
public async Task <int> InsertRepeatingTransactionAsync(RepeatingTransaction r) { throw new NotImplementedException(); }