Move const usage out of Shared
This commit is contained in:
@ -8,17 +8,17 @@ internal abstract class PersonBirthday
|
||||
internal static DateTime GetDefaultValue() => DateTime.MinValue; // {{1}}SingletonValue
|
||||
|
||||
// ...
|
||||
internal static string GetFormatted(Models.PersonBirthday personBirthday) => personBirthday.Value.ToString(Stateless.IPersonBirthday.Format);
|
||||
internal static string GetFileName(Models.PersonBirthday personBirthday) => $"{personBirthday.Value.ToString(Stateless.IPersonBirthday.Format)}.json";
|
||||
internal static bool DoesBirthDateExits(Properties.IStorage storage, Models.PersonBirthday personBirthday) => File.Exists(GetFileFullName(storage, personBirthday));
|
||||
internal static string GetFormatted(string personBirthdayFormat, Models.PersonBirthday personBirthday) => personBirthday.Value.ToString(personBirthdayFormat);
|
||||
internal static string GetFileName(string personBirthdayFormat, Models.PersonBirthday personBirthday) => $"{personBirthday.Value.ToString(personBirthdayFormat)}.json";
|
||||
internal static bool DoesBirthDateExits(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => File.Exists(GetFileFullName(storage, personBirthdayFormat, personBirthday));
|
||||
internal static Models.PersonBirthday GetNextBirthDate(Properties.IStorage storage) => throw new Exception(storage.ToString()); // Person.GetNextBirthDate(storage);
|
||||
internal static string GetFileFullName(Properties.IStorage storage, Models.PersonBirthday personBirthday) => Path.Combine(storage.PeopleRootDirectory, "{}", GetFileName(personBirthday));
|
||||
internal static DateTime? GetDateTime(string personKey) => DateTime.TryParseExact(personKey, Stateless.IPersonBirthday.Format, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
||||
internal static string GetFileFullName(Properties.IStorage storage, string personBirthdayFormat, Models.PersonBirthday personBirthday) => Path.Combine(storage.PeopleRootDirectory, "{}", GetFileName(personBirthdayFormat, personBirthday));
|
||||
internal static DateTime? GetDateTime(string personBirthdayFormat, string personKey) => DateTime.TryParseExact(personKey, personBirthdayFormat, CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dateTime) ? dateTime : null;
|
||||
|
||||
internal static Models.PersonBirthday? GetPersonBirthday(string personKey)
|
||||
internal static Models.PersonBirthday? GetPersonBirthday(string personBirthdayFormat, string personKey)
|
||||
{
|
||||
Models.PersonBirthday? result;
|
||||
DateTime? dateTime = GetDateTime(personKey);
|
||||
DateTime? dateTime = GetDateTime(personBirthdayFormat, personKey);
|
||||
if (dateTime is null)
|
||||
result = null;
|
||||
else
|
||||
|
Reference in New Issue
Block a user