Added reporting classes and implemented/ updated terminal commands

This commit versions the inital classes used for reporting. Some of the
manager classes have been adjusted so that they can also be used in the
reporting system since the queries are very similar. The terminal
commands and flow have been improved to further close in on the design
spec. Guests who make reservations now abide by the fixed rules
determined by the doc. For example Prepaid and 60 day reservations have
requirements on how far away a reservation needs to be at minimum. The
reservation creation process now takes this into account. The base rate
functionality has been hooked up and the queries have been verified to
work at least once. The same applies for CheckIn() and CheckOut()
functions.
This commit is contained in:
雲華
2022-04-15 19:11:03 -04:00
parent 14fb4b6050
commit 6fb0f5c466
10 changed files with 549 additions and 94 deletions

View File

@@ -14,26 +14,31 @@ namespace Ophelias.Expressions
internal static Regex CardRx = new Regex(@"^[0-9]{16}$", RegexOptions.Compiled);
internal static Regex ExpriationRx = new Regex(@"^(0?[1-9]|1[012])/2[0-9]{1}$", RegexOptions.Compiled);
internal static Regex CCVRx = new Regex(@"^[0-9]{3}$", RegexOptions.Compiled);
internal static Regex MoneyRx = new Regex(@"^(\d+\.\d{2}|\d+)$", RegexOptions.Compiled);
}
internal static class Validation
{
internal static bool ValidateCreditCard(string CreditCard)
{
if (Expressions.CardRx.IsMatch(CreditCard))
return true;
return false;
return Expressions.CardRx.IsMatch(CreditCard);
}
internal static bool ValidateExpirationDate(string Expiration)
{
if (Expressions.ExpriationRx.IsMatch(Expiration))
{
DateTime dt = DateTime.ParseExact(Expiration, "MM/yy", CultureInfo.InvariantCulture);
if (dt.Year >= DateTime.Now.Year)
if (dt.Month >= DateTime.Now.Month)
return true;
if (dt.Date >= DateTime.Now.Date)
return true;
}
return false;
}
internal static bool ValidateExpirationNotBeforeReservation(string Expiration, DateTime CollectionDate)
{
DateTime dt = DateTime.ParseExact(Expiration, "MM/yy", CultureInfo.InvariantCulture);
if (dt.Date > CollectionDate.Date)
return true;
return false;
}
internal static bool ValidateEmail(string email)
{
EmailAddressAttribute EmailChecker = new EmailAddressAttribute();
@@ -45,5 +50,10 @@ namespace Ophelias.Expressions
return true;
return false;
}
internal static bool ValidateMoney(string Money)
{
return Expressions.MoneyRx.IsMatch(Money);
}
}
}