PI2024-23 #2

Merged
s464958 merged 21 commits from PI2024-23 into master 2024-06-14 14:47:25 +02:00
2 changed files with 53 additions and 0 deletions
Showing only changes of commit 100885c3c4 - Show all commits

View File

@ -0,0 +1,23 @@
using FirmTracker_Server.nHibernate.Expenses;
using FirmTracker_Server.nHibernate.Transactions;
namespace FirmTracker_Server.nHIbernate.Reports
{
public class Report
{
public virtual int Id { get; set; }
public virtual DateTime FromDate { get; set; }
public virtual DateTime ToDate { get; set; }
public virtual IList<Transaction> Transactions { get; set;} = new List<Transaction>();
public virtual IList<Expense> Expenses { get; set; } = new List<Expense>();
public virtual decimal TotalIncome { get; set; }
public virtual decimal TotalExpenses { get; set; }
public virtual decimal TotalBalance { get; set; }
public Report() {
Transactions = new List<Transaction>();
Expenses = new List<Expense>();
}
}
}

View File

@ -0,0 +1,30 @@
using FluentNHibernate.Mapping;
namespace FirmTracker_Server.nHIbernate.Reports
{
public class ReportMapping : ClassMap<Report>
{
public ReportMapping()
{
Table("Reports");
Id(x => x.Id).GeneratedBy.Identity();
Map(x => x.FromDate);
Map(x => x.ToDate);
Map(x => x.TotalIncome);
Map(x => x.TotalExpenses);
Map(x => x.TotalBalance);
HasManyToMany(x => x.Transactions)
.Cascade.All()
.Table("ReportTransactions")
.ParentKeyColumn("ReportId")
.ChildKeyColumn("TransactionId");
HasManyToMany(x => x.Expenses)
.Cascade.All()
.Table("ReportExpenses")
.ParentKeyColumn("ReportId")
.ChildKeyColumn("ExpenseId");
}
}
}