/* Eg: balance */ public static void EasterEggResponse(ConversationContext cContext, TokenEaserEgg p1) { ErpResultWrapper wrapper = new ErpResultWrapper(); wrapper.IsQuestion = true; wrapper.QuestionText = "I'm sorry, Dave. I'm afraid I can't do that."; cContext.Say(wrapper, null); }
public static ErpResultWrapper CreateResponse(string context) { ErpResultWrapper wrapper = new ErpResultWrapper(); wrapper.Entity = CashFlowEntity; wrapper.Target = CashFlowTarget; wrapper.Context = String.Empty; return wrapper; }
private static ErpResultWrapper CreateResponse(Token context) { ErpResultWrapper wrapper = new ErpResultWrapper(); wrapper.Entity = TopEntity; wrapper.Target = ((context != null) && (context is TokenOverdue)) ? TopOverdueTarget : TopSalesTarget; wrapper.Context = String.Empty; return wrapper; }
public static ErpResultWrapper CreateResponse(string context) { ErpResultWrapper wrapper = new ErpResultWrapper(); wrapper.Entity = PhoneNoEntity; wrapper.Target = PhoneNoTarget; if (context != null) { wrapper.Context = context; } else { wrapper.IsQuestion = true; wrapper.QuestionText = "For which customer?"; } return wrapper; }
public void ProcessCommand(string command, string userId, ConversationType mode, string conversationId, IErpServiceCallback callback) { ConversationContext context = ServiceLocator.GetInstance<ConversationContext>(); Question question = null; List<Token> tokens = new List<Token>(); command = command.TrimEnd(new char[] {'.', '!', '?'}); string localCommand = command.ToLower().Trim(); context.Init(userId, mode, conversationId, callback); var tokenManager = ServiceLocator.GetInstance<TokenManager>(); var buckets = tokenManager.TokenizeInput(localCommand, userId); question = this.QuestionManager.CheckForActiveQuestion(mode, userId, conversationId); if (question != null) { question.State.Context = command; context.Say(question.State, null); return; } RuleMethod ruleMethod = RuleManager.LocateMatchingRule(buckets, context); if (ruleMethod != null) { ruleMethod.Rule.Invoke(null, ruleMethod.PassIns); } else { ErpResultWrapper wrapper = new ErpResultWrapper(); wrapper.IsQuestion = true; wrapper.QuestionText = Constants.UnderstandFailure; context.Say(wrapper, null); } }