Loading BusinessLayer/Services/Implementations/TimerService.cs +5 −6 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ public class TimerService : IHostedService, IDisposable private Timer? _minuteTimer; private Timer? _dailyTimer; private Timer? _weeklyTimer; private Timer? _monthlyTimer; private readonly IServiceProvider _serviceProvider; Loading @@ -27,7 +26,6 @@ public class TimerService : IHostedService, IDisposable SetTimer(TransactionFrequency.ByMinute, TimeSpan.FromMinutes(1), new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute + 1, 0)-now); SetTimer(TransactionFrequency.Daily, TimeSpan.FromDays(1), new DateTime(now.Year, now.Month, now.Day + 1) - now); SetTimer(TransactionFrequency.Weekly, TimeSpan.FromDays(7), new DateTime(now.Year, now.Month, now.Day + 7) - now); SetTimer(TransactionFrequency.Monthly, TimeSpan.FromDays(30), new DateTime(now.Year, now.Month, 1).AddMonths(1) - now); return Task.CompletedTask; } Loading @@ -54,9 +52,6 @@ public class TimerService : IHostedService, IDisposable case TransactionFrequency.Weekly: _weeklyTimer = timer; break; case TransactionFrequency.Monthly: _monthlyTimer = timer; break; default: throw new ArgumentException("Timer frequency unknown"); } Loading @@ -68,6 +63,11 @@ public class TimerService : IHostedService, IDisposable { var transactionService = scope.ServiceProvider.GetRequiredService<ITransactionService>(); await transactionService.CopyTransactions(freq); // easiest way to do months (because of variable length) if(DateTime.Now.Day == 1 && freq == TransactionFrequency.Daily) { await transactionService.CopyTransactions(TransactionFrequency.Monthly); } } } Loading @@ -76,7 +76,6 @@ public class TimerService : IHostedService, IDisposable _minuteTimer?.Change(Timeout.Infinite, 0); _dailyTimer?.Change(Timeout.Infinite, 0); _weeklyTimer?.Change(Timeout.Infinite, 0); _monthlyTimer?.Change(Timeout.Infinite, 0); return Task.CompletedTask; } Loading BusinessLayer/Services/Implementations/UserService.cs +0 −3 Original line number Diff line number Diff line Loading @@ -9,17 +9,14 @@ namespace BusinessLayer.Services.Implementations { public class UserService : IUserService { private readonly ManagerDbContext _dbContext; private readonly UserManager<User> _userManager; private readonly SignInManager<User> _signInManager; public UserService( ManagerDbContext dbContext, UserManager<User> userManager, SignInManager<User> signInManager ) { _dbContext = dbContext; _userManager = userManager; _signInManager = signInManager; } Loading ExpenseManager/Program.cs +0 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ using Microsoft.EntityFrameworkCore; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(options => { Loading Loading
BusinessLayer/Services/Implementations/TimerService.cs +5 −6 Original line number Diff line number Diff line Loading @@ -12,7 +12,6 @@ public class TimerService : IHostedService, IDisposable private Timer? _minuteTimer; private Timer? _dailyTimer; private Timer? _weeklyTimer; private Timer? _monthlyTimer; private readonly IServiceProvider _serviceProvider; Loading @@ -27,7 +26,6 @@ public class TimerService : IHostedService, IDisposable SetTimer(TransactionFrequency.ByMinute, TimeSpan.FromMinutes(1), new DateTime(now.Year, now.Month, now.Day, now.Hour, now.Minute + 1, 0)-now); SetTimer(TransactionFrequency.Daily, TimeSpan.FromDays(1), new DateTime(now.Year, now.Month, now.Day + 1) - now); SetTimer(TransactionFrequency.Weekly, TimeSpan.FromDays(7), new DateTime(now.Year, now.Month, now.Day + 7) - now); SetTimer(TransactionFrequency.Monthly, TimeSpan.FromDays(30), new DateTime(now.Year, now.Month, 1).AddMonths(1) - now); return Task.CompletedTask; } Loading @@ -54,9 +52,6 @@ public class TimerService : IHostedService, IDisposable case TransactionFrequency.Weekly: _weeklyTimer = timer; break; case TransactionFrequency.Monthly: _monthlyTimer = timer; break; default: throw new ArgumentException("Timer frequency unknown"); } Loading @@ -68,6 +63,11 @@ public class TimerService : IHostedService, IDisposable { var transactionService = scope.ServiceProvider.GetRequiredService<ITransactionService>(); await transactionService.CopyTransactions(freq); // easiest way to do months (because of variable length) if(DateTime.Now.Day == 1 && freq == TransactionFrequency.Daily) { await transactionService.CopyTransactions(TransactionFrequency.Monthly); } } } Loading @@ -76,7 +76,6 @@ public class TimerService : IHostedService, IDisposable _minuteTimer?.Change(Timeout.Infinite, 0); _dailyTimer?.Change(Timeout.Infinite, 0); _weeklyTimer?.Change(Timeout.Infinite, 0); _monthlyTimer?.Change(Timeout.Infinite, 0); return Task.CompletedTask; } Loading
BusinessLayer/Services/Implementations/UserService.cs +0 −3 Original line number Diff line number Diff line Loading @@ -9,17 +9,14 @@ namespace BusinessLayer.Services.Implementations { public class UserService : IUserService { private readonly ManagerDbContext _dbContext; private readonly UserManager<User> _userManager; private readonly SignInManager<User> _signInManager; public UserService( ManagerDbContext dbContext, UserManager<User> userManager, SignInManager<User> signInManager ) { _dbContext = dbContext; _userManager = userManager; _signInManager = signInManager; } Loading
ExpenseManager/Program.cs +0 −1 Original line number Diff line number Diff line Loading @@ -6,7 +6,6 @@ using Microsoft.EntityFrameworkCore; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddControllersWithViews(options => { Loading