-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtraContextManager.cs
95 lines (78 loc) · 3.38 KB
/
ExtraContextManager.cs
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using LuisBot.CommonTypes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using static LuisBot.CommonTypes.CommonTypes;
namespace LuisBot
{
public class ExtraContextManager
{
private static ExtraContextManager _instance;
private Dictionary<string, ActionItem> _intentsLst = new Dictionary<string, ActionItem>();
private string _currentlyHandledIntent = string.Empty;
private ActionItem _infoHolder = new ActionItem();
public Dictionary<string, ActionItem> IntentsLst { get => _intentsLst; set => _intentsLst = value; }
public string CurrentlyHandledIntent { get => _currentlyHandledIntent; set => _currentlyHandledIntent = value; }
public ExtraContextManager()
{
IntentsLst = LoadIntentsFromDB();
}
public static ExtraContextManager Instance
{
get
{
if (_instance == null)
{
_instance = new ExtraContextManager();
}
return _instance;
}
}
public ActionItem InfoHolder { get => _infoHolder; set => _infoHolder = value; }
private Dictionary<string, ActionItem> LoadIntentsFromDB()
{
Dictionary<string, ActionItem> intentsLst = new Dictionary<string, ActionItem>();
try
{
intentsLst.Add("ApproveCourseEnrollment", new ActionItem()
{
// ActionItemMask = ActionItemMask.None,
ActionToTake = ActionToTake.Approve,//"ApproveCourseEnrollment",
MethodName = "ApproveCourseEnrollment",
ParametersList = new List<ActionParameters>
{
new ActionParameters { ParameterName = "EnrollmentRequestID", ParameterType = "Int"
}
},
SystemName = "CoursesEnrollmentSystem",
WsUrl = "https://somekindOfWebAddress/blabla.asmx" //TODO: Replace with url
});
intentsLst.Add("GreetingIntent", new ActionItem());
intentsLst.Add("Weather", new ActionItem());
intentsLst.Add("OpenFaultTicket", new ActionItem());
intentsLst.Add("Help", new ActionItem());
intentsLst.Add("None", new ActionItem());
intentsLst.Add("EnquireCourses", new ActionItem()
{
ActionToTake = ActionToTake.Enquire,//"ApproveCourseEnrollment",
MethodName = "GetCourseDetailsByID",
ParametersList = new List<ActionParameters>
{
new ActionParameters { ParameterName = "EnrollmentRequestID", ParameterType = "Int"}
},
SystemName = "CoursesEnrollmentSystem",
WsUrl = "https://somekindOfWebAddress/blabla.asmx" //TODO: Replace with url
});
//intentsLst.Add("");
//intentsLst.Add("");
intentsLst.Add("Todovum", new ActionItem());
}
catch (Exception ex)
{
System.Diagnostics.Trace.TraceError(ex.Message);
}
return intentsLst;
}
}
}