using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Ophelias.Models; using Ophelias.Managers; namespace Ophelias.Models { internal class Transaction { private double PenaltyMultipler = 1.1; internal int Id { get; set; } internal double Rate { get; set; } internal double Owed { get; set; } internal double Penalty { get; set; } internal double Multiplier { get; set; } internal double RefundAmount { get; set; } internal DateTime PayBy { get; set; } internal DateTime? PaidOn { get; set; } = null; internal Transaction(int Id, double Rate, double Owed, double Penalty, double Multiplier, double RefundAmount, DateTime PayBy, DateTime? PaidOn = null) { this.Id = Id; this.Rate = Rate; this.Owed = Owed; this.Penalty = Penalty; this.Multiplier = Multiplier; this.RefundAmount = RefundAmount; this.PayBy = PayBy; this.PaidOn = PaidOn; } private void Cancellation(ReservationType type) { void SetRefund() { if (DateTime.Now.AddDays(+3).Day <= PayBy.Day) { RefundAmount = Paid; Paid = 0; Owed = 0; PaidOff = false; } } switch (type) { case ReservationType.Conventional: SetRefund(); return; case ReservationType.Prepaid: return; case ReservationType.Incentive: SetRefund(); return; case ReservationType.SixtyDayAdvance: return; default: throw new NotImplementedException(); } } internal void Penalize(Reservation r) { switch (r.Status) { case ReservationStatus.Active: IsOverdue(); return; case ReservationStatus.Ended: IsOverdue(); return; case ReservationStatus.Cancelled: CancellationHandler(r.Type); return; default: throw new NotImplementedException(); } } internal void Penalize(Reservation r, double rate) { throw new NotImplementedException(); } internal void Pay(double amount) { } } internal static class TransactionInfo { internal static double ConventionalFee = 1.0; internal static double PrepaidFee = 0.75; internal static double IncentiveFee = IncentiveRate(); internal static double SixtyDayFee = 0.85; private static double IncentiveRate() { int thirtyDayOcc; thirtyDayOcc = HotelManager.GetThirtyDayOccupancy(DateTime.Now); if ((double)(thirtyDayOcc / 45.0) <= 0.6) return 0.80; return 1.0; } internal static DateTime GetPayByDate(Reservation r) { switch (r.Type) { case ReservationType.Conventional: return r.EndDate; case ReservationType.Prepaid: return r.StartDate; case ReservationType.Incentive: return r.EndDate; case ReservationType.SixtyDayAdvance: return r.StartDate.AddDays(-30); default: throw new NotImplementedException(); } } } internal class TransactionList { internal List Transactions; internal TransactionList() { Transactions = new List(); } } }