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.
60 lines
2.1 KiB
C#
60 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Text.RegularExpressions;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.Globalization;
|
|
|
|
namespace Ophelias.Expressions
|
|
{
|
|
internal static class 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)
|
|
{
|
|
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.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();
|
|
return EmailChecker.IsValid(email);
|
|
}
|
|
internal static bool ValidateCCV(string CCV)
|
|
{
|
|
if (Expressions.CCVRx.IsMatch(CCV))
|
|
return true;
|
|
return false;
|
|
}
|
|
internal static bool ValidateMoney(string Money)
|
|
{
|
|
return Expressions.MoneyRx.IsMatch(Money);
|
|
}
|
|
|
|
}
|
|
}
|