-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add EyeSoft.Core.Core solution for .NET Core
- Loading branch information
1 parent
5c4cc72
commit 83a59f2
Showing
177 changed files
with
3,371 additions
and
9,093 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 34 additions & 39 deletions
73
Main/Internal/Core/Source/4.0/Core/Calendar/Holiday/AgnosticDay.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,37 @@ | ||
namespace EyeSoft.Calendar | ||
{ | ||
using System; | ||
|
||
public class AgnosticDay : IComparable<AgnosticDay> | ||
{ | ||
public AgnosticDay(int day, int month) | ||
{ | ||
Ensure.That(day).Is.Between(1, 31); | ||
Ensure.That(month).Is.Between(1, 12); | ||
|
||
Day = day; | ||
Month = month; | ||
} | ||
|
||
public int Day { get; private set; } | ||
|
||
public int Month { get; private set; } | ||
|
||
public int CompareTo(AgnosticDay other) | ||
{ | ||
if (Month > other.Month) | ||
{ | ||
return 1; | ||
} | ||
|
||
if (Month < other.Month) | ||
{ | ||
return -1; | ||
} | ||
|
||
return Day.CompareTo(other.Day); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return | ||
"Day: {Day} Month: {Month}" | ||
.NamedFormat(Day, Month); | ||
} | ||
} | ||
using System; | ||
|
||
public class AgnosticDay : IComparable<AgnosticDay> | ||
{ | ||
public AgnosticDay(int day, int month) | ||
{ | ||
Day = day; | ||
Month = month; | ||
} | ||
|
||
public int Day { get; private set; } | ||
|
||
public int Month { get; private set; } | ||
|
||
public int CompareTo(AgnosticDay other) | ||
{ | ||
if (Month > other.Month) | ||
{ | ||
return 1; | ||
} | ||
|
||
if (Month < other.Month) | ||
{ | ||
return -1; | ||
} | ||
|
||
return Day.CompareTo(other.Day); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return $"Day: {Day} Month: {Month}"; | ||
} | ||
} | ||
} |
99 changes: 49 additions & 50 deletions
99
Main/Internal/Core/Source/4.0/Core/Calendar/Holiday/Holiday.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,65 @@ | ||
namespace EyeSoft.Calendar | ||
{ | ||
using System; | ||
using System; | ||
|
||
using EyeSoft.Extensions; | ||
using EyeSoft.Extensions; | ||
|
||
public class Holiday | ||
{ | ||
private Holiday(string name, DateTime date, bool isFixed) | ||
{ | ||
Name = name; | ||
Date = date; | ||
IsFixed = isFixed; | ||
} | ||
public class Holiday | ||
{ | ||
private Holiday(string name, DateTime date, bool isFixed) | ||
{ | ||
Name = name; | ||
Date = date; | ||
IsFixed = isFixed; | ||
} | ||
|
||
public string Name { get; private set; } | ||
public string Name { get; private set; } | ||
|
||
public DateTime Date { get; private set; } | ||
public DateTime Date { get; private set; } | ||
|
||
public bool IsFixed { get; private set; } | ||
public bool IsFixed { get; private set; } | ||
|
||
public static Holiday Fixed(string name, DateTime dateTime) | ||
{ | ||
return | ||
Create(name, dateTime, true); | ||
} | ||
public static Holiday Fixed(string name, DateTime dateTime) | ||
{ | ||
return | ||
Create(name, dateTime, true); | ||
} | ||
|
||
public static Holiday Entry(string name, DateTime dateTime) | ||
{ | ||
return | ||
Create(name, dateTime, false); | ||
} | ||
public static Holiday Entry(string name, DateTime dateTime) | ||
{ | ||
return | ||
Create(name, dateTime, false); | ||
} | ||
|
||
public static Holiday Create(string name, DateTime dateTime, bool isFixed) | ||
{ | ||
return | ||
new Holiday(name, dateTime, isFixed); | ||
} | ||
public static Holiday Create(string name, DateTime dateTime, bool isFixed) | ||
{ | ||
return | ||
new Holiday(name, dateTime, isFixed); | ||
} | ||
|
||
public override bool Equals(object obj) | ||
{ | ||
if (obj == null || GetType() != obj.GetType()) | ||
{ | ||
return false; | ||
} | ||
public override bool Equals(object obj) | ||
{ | ||
if (obj == null || GetType() != obj.GetType()) | ||
{ | ||
return false; | ||
} | ||
|
||
var other = obj.Convert<Holiday>(); | ||
var other = obj.Convert<Holiday>(); | ||
|
||
return | ||
Name.Equals(other.Name) && | ||
Date.Equals(other.Date) && | ||
IsFixed.Equals(other.IsFixed); | ||
} | ||
return | ||
Name.Equals(other.Name) && | ||
Date.Equals(other.Date) && | ||
IsFixed.Equals(other.IsFixed); | ||
} | ||
|
||
public override int GetHashCode() | ||
{ | ||
return ToString().GetHashCode(); | ||
} | ||
public override int GetHashCode() | ||
{ | ||
return ToString().GetHashCode(); | ||
} | ||
|
||
public override string ToString() | ||
{ | ||
return | ||
"{Description} {Date} /fixed: {Fixed}".NamedFormat(Name, Date.ToInvariantCultureDateString(), IsFixed); | ||
} | ||
} | ||
public override string ToString() | ||
{ | ||
return "{Name} {Date.ToInvariantCultureDateString()} /fixed: {IsFixed}"; | ||
} | ||
} | ||
} |
Oops, something went wrong.