Esempio n. 1
0
 public static void Validate_transaction_date(DateTime txDate, bool force,
                                              Action onValid, Action <string> onInvalid)
 {
     if (txDate > TimeProvider.Now())
     {
         onInvalid("Cannot execute transactions in the future!");
     }
     else if (!force && (txDate.Year < TimeProvider.Now().Year || txDate.Month < TimeProvider.Now().Month))
     {
         onInvalid("Cannot execute transactions before current month. Use -force to override.");
     }
     else
     {
         onValid();
     }
 }
Esempio n. 2
0
        public static ValidationReport.ValidationResult Validate_transaction_date(TransactionTypes type, DateTime txDate, bool force)
        {
            if (txDate > TimeProvider.Now())
            {
                return new ValidationReport.ValidationResult {
                           IsValid     = false,
                           Explanation = "Cannot execute transactions in the future!"
                }
            }
            ;

            if (!force && (txDate.Year < TimeProvider.Now().Year || txDate.Month < TimeProvider.Now().Month))
            {
                return new ValidationReport.ValidationResult {
                           IsValid     = false,
                           Explanation = "Cannot execute transactions before current month! Use -force to override."
                }
            }
            ;

            return(new ValidationReport.ValidationResult());
        }