Manager classes added and model updates

This commit introduces a large number of changes. Namely there are a
number of additions to a new set of classes that manage the database
and/ or the models shared between the code and databse. There is
fragmented non-functional code in this commit and there may be debug/
old code that still needs to be removed. This commit is just to version
these changes as they were not commited previously. There is also some
console interface code written, but has next to no functionality
attached to any existing prompts. More details will be published per .cs
file, ie specific manager or model, once they are finished as they are
undergoing rapid and significant changes regularly.
This commit is contained in:
雲華
2022-04-11 23:40:37 -04:00
parent f1a1b5d067
commit 349589674f
8 changed files with 395 additions and 30 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ophelias.Models;
using System.Net.Mail;
namespace Ophelias.Models
{

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ophelias.Models;
using Ophelias.Models;
namespace Ophelias.Models
{
@@ -58,6 +53,7 @@ namespace Ophelias.Models
{
Status = ReservationStatus.Cancelled;
t.Penalize(this);
}
}
internal enum ReservationStatus

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Ophelias.Models;
using Ophelias.Managers;
namespace Ophelias.Models
{
@@ -11,20 +12,17 @@ namespace Ophelias.Models
{
private double PenaltyMultipler = 1.1;
internal int Id;
internal double Rate;
internal double Paid;
internal double Owed;
internal double? Penalty;
internal double? Multiplier;
internal double RefundAmount;
internal bool? Late;
internal bool PaidOff;
internal DateTime PayBy;
internal DateTime PaidOn;
internal int Id { get; set; }
internal double Rate { get; set; }
internal double Paid { get; set; }
internal double Owed { get; set; }
internal double? Penalty { get; set; }
internal double Multiplier { get; set; }
internal double RefundAmount { get; set; }
internal bool? Late { get; set; }
internal bool PaidOff { get; set; }
internal DateTime PayBy { get; set; }
internal DateTime PaidOn { get; set; }
internal Transaction(int id, Reservation r, DateTime payby)
{
@@ -155,6 +153,30 @@ namespace Ophelias.Models
}
}
}
internal static class TransactionFees
{
static double ConventionalFee = 1.0;
static double PrepaidFee = 0.75;
static double IncentiveFee = OccupancyIncentive();
static double SixtyDayFee = 0.85;
private static double OccupancyIncentive()
{
int thirtyDayOcc;
using (DatabaseManager dbm = new DatabaseManager())
{
if (dbm.cur == null)
throw new NotImplementedException();
thirtyDayOcc = DatabaseFunctions.GetThirtyDayOccupancy(dbm.cur, DateTime.Now);
}
if ((double)(thirtyDayOcc / 45.0) <= 0.6)
return 0.80;
return 1.0;
}
}
internal class TransactionList
{
internal List<Transaction> Transactions;