DD.WellWorkover.Cloud/ConsoleApp1/Program.cs

44 lines
1.1 KiB
C#
Raw Normal View History

using AsbCloudDb.Model;
using AsbCloudInfrastructure.Services.DailyReport;
using Microsoft.EntityFrameworkCore;
2022-05-05 10:06:15 +05:00
using System;
2022-04-22 17:17:38 +05:00
using System.Linq;
namespace ConsoleApp1
{
2022-05-06 16:35:16 +05:00
class Cron
{
public DateTimeOffset Origin { get; set; }
public TimeSpan Period { get; set; }
public DateTimeOffset Next()
{
var delta = DateTimeOffset.Now - Origin;
var n = Math.Ceiling(delta / Period);
return Origin + n * Period;
}
}
class Program
2021-10-03 20:08:17 +05:00
{
2021-07-28 09:47:13 +05:00
static void Main(/*string[] args*/)
{
2022-04-12 10:01:56 +05:00
// use ServiceFactory to make services
2022-05-06 16:35:16 +05:00
var op = ServiceFactory.MakeWellOperationsService();
var d = op.FirstOperationDate(90);
2022-03-17 16:56:13 +05:00
2022-05-06 16:35:16 +05:00
var period = TimeSpan.FromHours(5);
var c = new Cron
{
Period = period,
Origin = new DateTimeOffset(2022, 5, 8, 0, 0, 7, TimeSpan.FromHours(5)),
};
2022-05-05 10:06:15 +05:00
2022-05-06 16:35:16 +05:00
Console.WriteLine($"origin: {c.Origin} next: {c.Next()}");
Console.WriteLine("End of Test");
Console.ReadLine();
2021-10-06 16:30:46 +05:00
}
}
}