//uses LUIS to understand user query inteligently, and respond appropriately private async Task <Activity> NaturalInteractionHandler(Activity message) { if ((message.Text.Trim().ToLower() ?? "") == "") { return(message.CreateReply("Error: Message type unsupported")); } LUISHandler.LUISQueryResult LUISResult = await LUISHandler.HandleQuery(message.Text); switch (LUISResult.responseType) { case LUISHandler.ResponseType.ExchangeRate: return(await ExchangeRateHandler.HandleExchangeRateMessage(message, LUISResult)); case LUISHandler.ResponseType.Logout: return(await FacebookHandler.LogoutHandler(message)); case LUISHandler.ResponseType.None: return(await UnknownHandler(message)); case LUISHandler.ResponseType.AccountBalance: return(await BankHandler.HandleBalance(message)); case LUISHandler.ResponseType.MakePayment: return(await BankHandler.HandleTransaction(message, LUISResult)); case LUISHandler.ResponseType.TransactionHistory: return(await BankHandler.HandleHistory(message)); default: return(message.CreateReply("Error: Unimplemented")); } }
public JsonResult GetExchangeRateByTargetDate() { ExchangeRateHandler handler = new ExchangeRateHandler(); string baseDateStr = Request.Form["targetDate"]; DateTime?targetDate = DateTime.ParseExact(baseDateStr, "d/MMM/yyyy", null); return(Json(handler.GetExchangeRateByTargetDate(targetDate))); }
public ActionResult Index(object o) { string firstCurrency = Request.Form["first-currency"]; string secondCurrency = Request.Form["second-currency"]; ExchangeRateHandler pbh = new ExchangeRateHandler(); var list = new List <Currency>(); list = pbh.getCalculateExchangeRates(int.Parse(firstCurrency), int.Parse(secondCurrency)); return(View("Results", list)); }
public void ExchangeRateHandler_SetNewRequest_CountryIsNotSpecified( string inputMessage, string expectedCurrency, string expectedCountry, int expectedYear, int expectedMonth, int expectedDay) { // Arrange var availableObservers = new List <IExchangeRateHandlerObserver>(); var exchangeRateHandler = new ExchangeRateHandler(availableObservers); // Act exchangeRateHandler.SetNewRequest(inputMessage); var actualCurrency = exchangeRateHandler.Request.Currency; var actualCountry = exchangeRateHandler.Request.Country; var actualYear = exchangeRateHandler.Request.Date.Year; var actualMonth = exchangeRateHandler.Request.Date.Month; var actualDay = exchangeRateHandler.Request.Date.Day; // Assert Assert.AreEqual(actualCurrency, expectedCurrency); Assert.AreEqual(actualCountry, expectedCountry); Assert.AreEqual(actualYear, expectedYear); Assert.AreEqual(actualMonth, expectedMonth); Assert.AreEqual(actualDay, expectedDay); }
public JsonResult GetCurrentExchangeRate() { ExchangeRateHandler handler = new ExchangeRateHandler(); return(Json(handler.GetCurrentExchangeRate(DateTime.Now.Date))); }
public ActionResult RegisterRate() { ExchangeRateHandler handler = new ExchangeRateHandler(); return(Json(handler.RegisterRate(Request.Form))); }
public ActionResult GetCalendarItems(string start, string end) { ExchangeRateHandler handler = new ExchangeRateHandler(); return(Json(handler.GetAllExchangeRateForCalendar())); }