init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,36 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace Kreta.Ellenorzo.Domain.VN.Utility
|
||||
{
|
||||
/// <summary>
|
||||
/// Author: Kovács Kornél (DevKornél) Created On: 2019.07.
|
||||
/// </summary>
|
||||
public static class Extensions
|
||||
{
|
||||
public static int[] ToIntArray(this string commaSeperatedIds)
|
||||
=> commaSeperatedIds == null ? new int[0] : commaSeperatedIds.Split(Constant.UidDelimiter).ToList().ConvertAll(x => int.Parse(x.Split(Constant.UidInnerDelimiter)[0])).ToArray();
|
||||
|
||||
/// UTC: 2016-10-30T20:00:00Z
|
||||
/// Local: 2016-10-30T23:00:00+01:00
|
||||
/// Unspecified: 2016-10-30T22:00:00
|
||||
public static DateTime ToIso8601Utc(this DateTime dt)
|
||||
=> new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, dt.Kind).ToUniversalTime();
|
||||
|
||||
/// UTC: 2016-10-30T20:00:00Z
|
||||
/// Local: 2016-10-30T23:00:00+01:00
|
||||
/// Unspecified: 2016-10-30T22:00:00
|
||||
public static string ToIso8601UtcString(this DateTime dt)
|
||||
=> dt.ToString("yyyy-MM-dd'T'HH:mm:ssK", CultureInfo.InvariantCulture);
|
||||
|
||||
public static IEnumerable<TOutput> ConvertAll<TInput, TOutput>(this IEnumerable<TInput> collection, Converter<TInput, TOutput> converter)
|
||||
{
|
||||
foreach (TInput item in collection)
|
||||
{
|
||||
yield return converter.Invoke(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Kreta.Ellenorzo.Domain.VN.Utility.ValidationAttributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Property)]
|
||||
internal sealed class ShortDateTimeAttribute : ValidationAttribute
|
||||
{
|
||||
public override bool IsValid(object value)
|
||||
{
|
||||
DateTime? timePropertyValue = value as DateTime?;
|
||||
|
||||
return !timePropertyValue.HasValue || timePropertyValue.Value - timePropertyValue.Value.Date == new TimeSpan(0);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue