/// <summary> /// validation method /// RULE: BirthDate should not be later than the HireDate /// </summary> void ValidateBirthDateAndHireDate() { if ((BirthDate != null) && (!HireDate.IsEmpty()) && (DateTime.Compare((DateTime)BirthDate, HireDate) >= 0)) { throw new BusinessRuleViolationOnInMemoryException("Exception!!! BirthDate should be earlier than HireDate!"); } }
/// <summary> /// validation method /// RULE: BirthDate should not be later than the HireDate /// </summary> void ValidateBirthDateAndHireDate() { //if BirthDate or HireDate is assigned and BirthDate is greater than HireDate, throw exception if ((BirthDate != null) && (!HireDate.IsEmpty()) && (DateTime.Compare((DateTime)BirthDate, HireDate) >= 0)) { throw new BusinessRuleViolationOnInMemoryException("Exception!!! BirthDate should be earlier than HireDate!"); } Console.WriteLine("CONSOLE: HireDate Value " + HireDate.ToString()); Debug.WriteLine("DEBUG: HireDate Value " + HireDate.ToString()); //Debug.Assert(BirthDate == null, "DEBUG: BirthDate is null"); Trace.WriteLine("TRACE: HireDate Value " + HireDate.ToString()); //Trace.Assert(BirthDate == null, "TRACE: BirthDate is null"); Trace.TraceWarning("TRACE WARNING: HireDate Value " + HireDate.ToString()); }