Beispiel #1
0
 /// <summary>
 /// Compares one SmartDate to another.
 /// </summary>
 /// <remarks>
 /// This method works the same as the CompareTo method
 /// on the Date datetype, with the exception that it
 /// understands the concept of empty date values.
 /// </remarks>
 /// <param name="Value">The date to which we are being compared.</param>
 /// <returns>
 /// A value indicating if the comparison date is less than,
 /// equal to or greater than this date.</returns>
 public int CompareTo(SmartDate date)
 {
     if (this.IsEmpty && date.IsEmpty)
     {
         return(0);
     }
     else
     {
         return(_date.CompareTo(date.Date));
     }
 }
Beispiel #2
0
 public override bool Equals(object o)
 {
     if (o is SmartDate)
     {
         SmartDate tmp = o as SmartDate;
         if (this.IsEmpty && tmp.IsEmpty)
         {
             return(true);
         }
         else
         {
             return(_date.Equals(((SmartDate)o).Date));
         }
     }
     else if (o is DateTime)
     {
         return(_date.Equals((DateTime)o));
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 檢查指定的 SmartDate 變數為 null 或空的日期。
 /// </summary>
 /// <param name="value">SmartDate 變數</param>
 /// <returns>若為 </returns>
 public static bool IsNullOrEmpty(SmartDate value)
 {
     return(value == null || value.IsEmpty);
 }