Exemplo n.º 1
0
        private async Task ResumeAfterInsert(IDialogContext context, IAwaitable <InsetConsumtion> result)
        {
            InsetConsumtion consumtion = await result;
            await context.PostAsync($"Gracias, hemos introducido su consumo de {consumtion.Tipo} del mes de {DateTime.Now.ToString("MMMM")}");

            context.Done <object>(null);
        }
Exemplo n.º 2
0
        public async Task Actions(IDialogContext context, LuisResult result)
        {
            string response = _help.GetHelp();
            string action   = result.Entities.FirstOrDefault(entity => entity.Type == "ACTION").Entity;

            if (_actions.Any(item => item.Parse(result)))
            {
                response = _actions.FirstOrDefault(item => item.Parse(result)).GetResponse(result.Entities);

                await context.PostAsync(response.ToString());

                context.Wait(this.MessageReceived);
                return;
            }

            if (action.ToLowerInvariant().Contains("introducir"))
            {
                var insert = new InsetConsumtion();
                var InsetConsumtionFormDialog = new FormDialog <InsetConsumtion>(insert, this.BuildInsertForm, FormOptions.PromptInStart, result.Entities);

                context.Call(InsetConsumtionFormDialog, this.ResumeAfterInsert);
                return;
            }

            if (action.ToLowerInvariant().Contains("contratar"))
            {
                var contract           = new Contract();
                var ContractFormDialog = new FormDialog <Contract>(contract, this.BuildContractForm, FormOptions.PromptInStart, result.Entities);

                context.Call(ContractFormDialog, this.ResumeAfterContract);
                return;
            }
            context.Wait(this.MessageReceived);
            return;
        }
Exemplo n.º 3
0
 private IForm <InsetConsumtion> BuildInsertForm()
 {
     return(InsetConsumtion.BuildForm());
 }