Skip to content

Commit 62ff96e

Browse files
authored
Merge pull request #16 (Phase 2.6 In-App Notifications UI ) from xnodeoncode/development
Phase 2.6 In-App Notifications UI Complete.
2 parents ee99f64 + 5ed5680 commit 62ff96e

517 files changed

Lines changed: 225300 additions & 14 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.vscode/launch.json

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,42 @@
11
{
2-
// Use IntelliSense to learn about possible attributes.
3-
// Hover to view descriptions of existing attributes.
4-
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5-
"version": "0.2.0",
6-
"configurations": [
7-
{
8-
"name": "C#: Launch Startup Project",
9-
"type": "dotnet",
10-
"request": "launch"
11-
}
12-
]
13-
}
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Launch SimpleStart",
9+
"type": "dotnet",
10+
"request": "launch",
11+
"preLaunchTask": "build",
12+
"program": "${workspaceFolder}/Aquiis.SimpleStart/bin/Debug/net9.0/Aquiis.SimpleStart.dll",
13+
"args": [],
14+
"cwd": "${workspaceFolder}/Aquiis.SimpleStart",
15+
"stopAtEntry": false,
16+
"serverReadyAction": {
17+
"action": "openExternally",
18+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
19+
},
20+
"env": {
21+
"ASPNETCORE_ENVIRONMENT": "Development"
22+
}
23+
},
24+
{
25+
"name": "Launch Professional",
26+
"type": "dotnet",
27+
"request": "launch",
28+
"preLaunchTask": "build",
29+
"program": "${workspaceFolder}/Aquiis.Professional/bin/Debug/net9.0/Aquiis.Professional.dll",
30+
"args": [],
31+
"cwd": "${workspaceFolder}/Aquiis.Professional",
32+
"stopAtEntry": false,
33+
"serverReadyAction": {
34+
"action": "openExternally",
35+
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
36+
},
37+
"env": {
38+
"ASPNETCORE_ENVIRONMENT": "Development"
39+
}
40+
}
41+
]
42+
}
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
using Microsoft.Extensions.Options;
2+
using Aquiis.Professional.Core.Entities;
3+
using Aquiis.Professional.Core.Constants;
4+
5+
namespace Aquiis.Professional.Application.Services
6+
{
7+
public class ApplicationService
8+
{
9+
private readonly ApplicationSettings _settings;
10+
private readonly PaymentService _paymentService;
11+
private readonly LeaseService _leaseService;
12+
13+
public bool SoftDeleteEnabled { get; }
14+
15+
public ApplicationService(
16+
IOptions<ApplicationSettings> settings,
17+
PaymentService paymentService,
18+
LeaseService leaseService)
19+
{
20+
_settings = settings.Value;
21+
_paymentService = paymentService;
22+
_leaseService = leaseService;
23+
SoftDeleteEnabled = _settings.SoftDeleteEnabled;
24+
}
25+
26+
public string GetAppInfo()
27+
{
28+
return $"{_settings.AppName} - {_settings.Version}";
29+
}
30+
31+
/// <summary>
32+
/// Gets the total payments received for a specific date
33+
/// </summary>
34+
public async Task<decimal> GetDailyPaymentTotalAsync(DateTime date)
35+
{
36+
var payments = await _paymentService.GetAllAsync();
37+
return payments
38+
.Where(p => p.PaidOn.Date == date.Date && !p.IsDeleted)
39+
.Sum(p => p.Amount);
40+
}
41+
42+
/// <summary>
43+
/// Gets the total payments received for today
44+
/// </summary>
45+
public async Task<decimal> GetTodayPaymentTotalAsync()
46+
{
47+
return await GetDailyPaymentTotalAsync(DateTime.Today);
48+
}
49+
50+
/// <summary>
51+
/// Gets the total payments received for a date range
52+
/// </summary>
53+
public async Task<decimal> GetPaymentTotalForRangeAsync(DateTime startDate, DateTime endDate)
54+
{
55+
var payments = await _paymentService.GetAllAsync();
56+
return payments
57+
.Where(p => p.PaidOn.Date >= startDate.Date &&
58+
p.PaidOn.Date <= endDate.Date &&
59+
!p.IsDeleted)
60+
.Sum(p => p.Amount);
61+
}
62+
63+
/// <summary>
64+
/// Gets payment statistics for a specific period
65+
/// </summary>
66+
public async Task<PaymentStatistics> GetPaymentStatisticsAsync(DateTime startDate, DateTime endDate)
67+
{
68+
var payments = await _paymentService.GetAllAsync();
69+
var periodPayments = payments
70+
.Where(p => p.PaidOn.Date >= startDate.Date &&
71+
p.PaidOn.Date <= endDate.Date &&
72+
!p.IsDeleted)
73+
.ToList();
74+
75+
return new PaymentStatistics
76+
{
77+
StartDate = startDate,
78+
EndDate = endDate,
79+
TotalAmount = periodPayments.Sum(p => p.Amount),
80+
PaymentCount = periodPayments.Count,
81+
AveragePayment = periodPayments.Any() ? periodPayments.Average(p => p.Amount) : 0,
82+
PaymentsByMethod = periodPayments
83+
.GroupBy(p => p.PaymentMethod)
84+
.ToDictionary(g => g.Key, g => g.Sum(p => p.Amount))
85+
};
86+
}
87+
88+
/// <summary>
89+
/// Gets leases expiring within the specified number of days
90+
/// </summary>
91+
public async Task<int> GetLeasesExpiringCountAsync(int daysAhead)
92+
{
93+
var leases = await _leaseService.GetAllAsync();
94+
return leases
95+
.Where(l => l.EndDate >= DateTime.Today &&
96+
l.EndDate <= DateTime.Today.AddDays(daysAhead) &&
97+
!l.IsDeleted)
98+
.Count();
99+
}
100+
}
101+
102+
public class PaymentStatistics
103+
{
104+
public DateTime StartDate { get; set; }
105+
public DateTime EndDate { get; set; }
106+
public decimal TotalAmount { get; set; }
107+
public int PaymentCount { get; set; }
108+
public decimal AveragePayment { get; set; }
109+
public Dictionary<string, decimal> PaymentsByMethod { get; set; } = new();
110+
}
111+
}

0 commit comments

Comments
 (0)