-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
50 lines (41 loc) · 1.56 KB
/
Program.cs
File metadata and controls
50 lines (41 loc) · 1.56 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
using System;
using System.Collections.Generic;
using System.IO;
using Automation;
using Manager;
using Microsoft.Extensions.Configuration;
using Model;
public class Program
{
public static IConfiguration Config;
static void Main(string[] args)
{
Console.WriteLine(Directory.GetCurrentDirectory());
Config = new ConfigurationBuilder()
.AddJsonFile("appsettings.json", true, true)
.Build();
Console.WriteLine(Config.GetSection("Credentials").GetSection("Timecamp")["Password"]);
var methodTimeEntry = Config.GetSection("MethodTimeEntry");
List<InternalItem> intenalItems = new List<InternalItem>();
if (methodTimeEntry["Timecamp"].Equals("true"))
{
intenalItems =
new TimecampManager("2020-03-03", "2020-03-09", GetTimecampConfig("Token")).GetInfoAsync().Result;
}
if (methodTimeEntry["Text"].Equals("true"))
{
var entriesTextManager = new EntriesTextManager();
intenalItems = entriesTextManager.InternalItem;
}
new InternalAutomation().Init(GetInternalConfig("Email"), GetInternalConfig("Password"), intenalItems,
GetInternalConfig("Url"), bool.Parse(methodTimeEntry["IsEnabledLoadTicketField"]));
}
private static string GetInternalConfig(string key)
{
return Config.GetSection("Credentials").GetSection("Internal")[key];
}
private static string GetTimecampConfig(string key)
{
return Config.GetSection("Credentials").GetSection("Timecamp")[key];
}
}