qauartz update
This commit is contained in:
parent
65dc00cb9f
commit
c5a9db661b
|
|
@ -30,7 +30,7 @@ public interface ISettings
|
||||||
|
|
||||||
public static class AutoScan
|
public static class AutoScan
|
||||||
{
|
{
|
||||||
public static void RegisterJobs(this IServiceCollection collection, IServiceCollectionQuartzConfigurator conf)
|
public static void RegisterJobs(this IServiceCollection collection, IQuartzBuilder conf)
|
||||||
{
|
{
|
||||||
var jobs = typeof(IRecurringService).Assembly.GetTypes().Where(x => x.IsAssignableTo(typeof(IRecurringService)) && x != typeof(IRecurringService)).ToList();
|
var jobs = typeof(IRecurringService).Assembly.GetTypes().Where(x => x.IsAssignableTo(typeof(IRecurringService)) && x != typeof(IRecurringService)).ToList();
|
||||||
|
|
||||||
|
|
@ -46,7 +46,7 @@ public static class AutoScan
|
||||||
}
|
}
|
||||||
Console.WriteLine("Adding job: " + jobKey.Name + " with cron: " + cron);
|
Console.WriteLine("Adding job: " + jobKey.Name + " with cron: " + cron);
|
||||||
|
|
||||||
conf.AddJob(job, jobKey).AddTrigger(x => x.ForJob(jobKey).WithCronSchedule(cron).StartNow());
|
conf.AddJob(job, x => x.WithIdentity(jobKey)).AddTrigger(x => x.ForJob(jobKey).WithCronSchedule(cron).StartNow());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static void RegisterServices(this IServiceCollection collection)
|
public static void RegisterServices(this IServiceCollection collection)
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,9 @@ public class DateTimeOffsetFrame : IEquatable<DateTimeOffsetFrame>
|
||||||
return e => dateAcessor.Compile()(e) >= frame.FromDate && dateAcessor.Compile()(e) <= frame.ToDate;
|
return e => dateAcessor.Compile()(e) >= frame.FromDate && dateAcessor.Compile()(e) <= frame.ToDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DateOnlyFrame ToDateOnlyFrame()
|
public DateOnlyFrame ToDateOnlyFrame(TimeZoneInfo timeZone)
|
||||||
{
|
{
|
||||||
return new DateOnlyFrame(FromDate.ToDateOnly(), ToDate.ToDateOnly());
|
return new DateOnlyFrame(FromDate.ToDateOnly(timeZone), ToDate.ToDateOnly(timeZone));
|
||||||
}
|
}
|
||||||
public bool Equals(DateTimeOffsetFrame? other)
|
public bool Equals(DateTimeOffsetFrame? other)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace NejCommon.Utils
|
||||||
{
|
{
|
||||||
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
public override DateOnly Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||||
{
|
{
|
||||||
return DateOnly.Parse(reader.GetString() ?? string.Empty, CultureInfo.InvariantCulture);
|
return DateOnly.TryParse(reader.GetString() ?? string.Empty, CultureInfo.InvariantCulture, out var date) ? date : throw new JsonException("Invalid DateOnly format, expected 'yyyy-MM-dd'.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
|
public override void Write(Utf8JsonWriter writer, DateOnly value, JsonSerializerOptions options)
|
||||||
|
|
|
||||||
|
|
@ -106,10 +106,12 @@ public static class Extensions
|
||||||
[Projectable]
|
[Projectable]
|
||||||
public static DateOnly ToDateOnly(this DateTime date) => DateOnly.FromDateTime(date);
|
public static DateOnly ToDateOnly(this DateTime date) => DateOnly.FromDateTime(date);
|
||||||
[Projectable]
|
[Projectable]
|
||||||
public static DateOnly ToDateOnly(this DateTimeOffset date) => DateOnly.FromDateTime(date.DateTime);
|
public static DateOnly ToDateOnly(this DateTimeOffset date, TimeZoneInfo timeZone) => DateOnly.FromDateTime(date.ToDateTime(timeZone));
|
||||||
[Projectable]
|
[Projectable]
|
||||||
public static DateTime ToDateTime(this DateOnly date) => new DateTime(date.Year, date.Month, date.Day);
|
public static DateTime ToDateTime(this DateOnly date) => new DateTime(date.Year, date.Month, date.Day);
|
||||||
[Projectable]
|
[Projectable]
|
||||||
|
public static DateTime ToDateTime(this DateTimeOffset date, TimeZoneInfo timeZone) => TimeZoneInfo.ConvertTime(date, timeZone).DateTime;
|
||||||
|
[Projectable]
|
||||||
public static decimal Round(this decimal value, int decimals = 2) => Math.Round(value, decimals);
|
public static decimal Round(this decimal value, int decimals = 2) => Math.Round(value, decimals);
|
||||||
[Projectable]
|
[Projectable]
|
||||||
public static decimal Floor(this decimal value, int decimals = 2) => Math.Floor(value * (decimal)Math.Pow(10, decimals)) / (decimal)Math.Pow(10, decimals);
|
public static decimal Floor(this decimal value, int decimals = 2) => Math.Floor(value * (decimal)Math.Pow(10, decimals)) / (decimal)Math.Pow(10, decimals);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user