-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
55 lines (47 loc) · 1.95 KB
/
Program.cs
File metadata and controls
55 lines (47 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ControlLoopProcessFor3Rates
{
class Program
{
static void Main(string[] args)
{
//Console.WriteLine(" +++ BorsodChem Zrt. +++ ");
//Console.WriteLine("3Rates Project - Control loops shiftly data query");
//Console.WriteLine("");
InitializeShiftDateTime(out DateTime queryStart, out DateTime queryEnd);
//Console.WriteLine("--Collection started for the previous shift");
//Console.WriteLine("---Collection interval: " + queryStart.ToString("yyyy.MM.dd. HH:mm") + " - " + queryEnd.ToString("yyyy.MM.dd. HH:mm"));
var handler = new Handler();
handler.ProcessCRData(queryStart, queryEnd); //CR of control loops
}
private static void InitializeShiftDateTime(out DateTime queryStart, out DateTime queryEnd)
{
string tempDate = DateTime.Now.ToString("yyyy.MM.dd.");
int currentHour = Convert.ToInt16(DateTime.Now.Hour);
if (currentHour >= 6 && currentHour < 14) //22:00 shift
{
queryEnd = Convert.ToDateTime(tempDate + " 6:00"); //query end
queryStart = queryEnd.AddHours(-8); //query start
}
else if (currentHour >= 14 && currentHour < 22) //6:00 shift
{
queryEnd = Convert.ToDateTime(tempDate + " 14:00");
queryStart = queryEnd.AddHours(-8);
}
else if (currentHour >= 22) //14:00 shift
{
queryEnd = Convert.ToDateTime(tempDate + " 22:00");
queryStart = queryEnd.AddHours(-8);
}
else //14:00 shift as well
{
queryEnd = Convert.ToDateTime(tempDate + " 22:00");
queryStart = queryEnd.AddHours(-8);
}
}
}
}