Fungerande version av skiktad lösning Winforms App med SQlite och entity framework
This commit is contained in:
26
WinFormDiApp.BL/Helpers/Extensions.cs
Normal file
26
WinFormDiApp.BL/Helpers/Extensions.cs
Normal file
@ -0,0 +1,26 @@
|
||||
namespace WinFormDiApp.BL.Helpers;
|
||||
|
||||
public static class Extensions
|
||||
{
|
||||
public static bool IsNumeric(this string value)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(value))
|
||||
{
|
||||
if (value.All(char.IsDigit)) return true;
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
|
||||
public static bool IsDate(this string value) {
|
||||
if (!string.IsNullOrEmpty(value) && value.Length<20)
|
||||
{
|
||||
if (DateTime.TryParse(value, out DateTime date))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
else return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user