public int CompareTo(object obj) { if (obj is DateTime) { return(DateTimeValue.CompareTo((DateTime)obj)); } CDateTimeEx dtex = (obj as CDateTimeEx); if (dtex != null) { return(DateTimeValue.CompareTo(dtex.DateTimeValue)); } return(-1); }
public override bool Equals(object obj) { CDateTimeEx dte = (obj as CDateTimeEx); if (!(obj is DateTime) && (dte == null)) { return(false); } if (obj == null) { return(false); } if (dte != null) { return(DateTimeValue.Equals(dte.DateTimeValue)); } else { return(DateTimeValue.Equals(obj)); } }
public static string ToUniversalString(object value) { if (value == null || value == DBNull.Value) { return(c_strConstNull); } if (value is SByte) { return(value.ToString()); } else if (value is Int16) { return(value.ToString()); } else if (value is Int32) { return(value.ToString()); } else if (value is Int64) { return(value.ToString()); } else if (value is Byte) { return(value.ToString()); } else if (value is UInt16) { return(value.ToString()); } else if (value is UInt32) { return(value.ToString()); } else if (value is UInt64) { return(value.ToString()); } else if (value is Single) { return(value.ToString().Replace(',', '.')); } else if (value is Double) { return(value.ToString().Replace(',', '.')); } else if (value is Decimal) { return(value.ToString().Replace(',', '.')); } else if (value is Boolean) { return(((bool)value)?"1":"0"); } else if (value is Char) { return(value.ToString()); } else if (value is String) { if (value.ToString() == c_strConstNull) { return("@" + c_strConstNull); } return(value.ToString()); } else if (value is DateTime) { return(CUtilDate.GetUniversalString((DateTime)value)); } else { CDateTimeEx dtex = (value as CDateTimeEx); if (dtex != null) { return(CUtilDate.GetUniversalString(dtex.DateTimeValue)); } } throw new Exception(I.T("Unknown type for ToUniversalString |30107") + value.GetType().ToString()); }