diff --git a/Common/Common.csproj b/Common/Common.csproj index 0e4fef0c..6bb5c6ee 100644 --- a/Common/Common.csproj +++ b/Common/Common.csproj @@ -41,6 +41,7 @@ + @@ -71,6 +72,9 @@ + + + diff --git a/Common/Constants.cs b/Common/Constants.cs new file mode 100644 index 00000000..c84a8774 --- /dev/null +++ b/Common/Constants.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Swarmops.Common +{ + public class Constants + { + // These constants are necessary because MySql keeps vomiting on DateTime.MinValue and DateTime.MaxValue, so we + // need some other definition of endpoints of the valid DateTime space + + public static DateTime DateTimeLow + { get { return new DateTime(1800, 1, 1); } } + + public static DateTime DateTimeHigh + { get { return new DateTime(2300, 12, 1); } } + } +} diff --git a/Common/ExtensionMethods/DateTime.cs b/Common/ExtensionMethods/DateTime.cs index 017c1be0..c46a37e9 100644 --- a/Common/ExtensionMethods/DateTime.cs +++ b/Common/ExtensionMethods/DateTime.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.Eventing.Reader; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -14,5 +15,27 @@ namespace Swarmops.Common.ExtensionMethods return (Int32)(source.Subtract(new DateTime(1970, 1, 1, 0, 0, 0,DateTimeKind.Utc))).TotalSeconds; } + + public static bool IsHigh(this DateTime source) + { + if (source.Year > 2299) return true; + + return false; + } + + public static bool IsLow(this DateTime source) + { + if (source.Year < 1801) return true; + + return false; + } + + public static bool IsDefined(this DateTime source) + { + if (source.IsHigh()) return false; + if (source.IsLow()) return false; + + return true; + } } } diff --git a/Logic/Logic.csproj b/Logic/Logic.csproj index 252ddf96..84c839b9 100644 --- a/Logic/Logic.csproj +++ b/Logic/Logic.csproj @@ -115,9 +115,6 @@ - - -