static bool ExecuteRequest(LUISResponse lUISResponse) { if (lUISResponse == null) { return(false); } IDictionary <string, string> entities = new Dictionary <string, string>(); for (int i = 0; i < lUISResponse.entities.Length; i++) { string value = lUISResponse.entities[i].entity; if (String.Compare(lUISResponse.entities[i].type, "builtin.datetimeV2.date", true) == 0) { entities["Date"] = lUISResponse.entities[i].resolution?.value; } else if (String.Compare(lUISResponse.entities[i].type, "builtin.datetimeV2.timerange", true) == 0) { entities["Start"] = lUISResponse.entities[i].resolution?.start; entities["End"] = lUISResponse.entities[i].resolution?.end; } else { entities[lUISResponse.entities[i].type] = value; } } if (String.Compare(lUISResponse?.topScoringIntent?.intent, "To-Do-Note", true) == 0) { if (String.Compare(entities["Person"], "franz", true) == 0) { entities["Date"] = "2018-01-04"; } else { entities["Date"] = "2017-11-24"; } DateTime date; var res = DateTime.TryParse(entities["Date"], out date); CommandsHelper.AddTask(entities["Person"], res? date:DateTime.Now, entities["Action"]); return(true);; } else if (String.Compare(lUISResponse?.topScoringIntent?.intent, "Calendar.Add", true) == 0) { //ScheduleEvent(entities["Calendar.Subject"], entities["Date"], entities["Start"], entities["End"], entities["location"]); try { CommandsHelper.ScheduleEvent(entities["Calendar.Subject"], new DateTime(2017, 11, 27), entities["Calendar.Location"]); } catch (Exception) { //ignore } return(true); } else if (String.Compare(lUISResponse?.topScoringIntent?.intent, "None", true) == 0) { return(true); } return(false); }
public void AddTaskTest() { CommandsHelper.AddTask("Daniela", DateTime.Now, "do something"); }