private async Task <DialogTurnResult> SetEstablecimientoCategoria(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var choice = (FoundChoice)stepContext.Result; if (choice.Value == ExitOption) { await stepContext.Context.SendActivityAsync(MenuBot.Buttons(0, "En que te puedo ayudar?\n\n puedes utilizar los botones de la parte inferior."), cancellationToken); return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken)); } stepContext.Values["co_establecimiento_subclase"] = CodigoList[choice.Index]; stepContext.Values["no_establecimiento_subclase"] = choice.Value; EstablecimientoCategoriaDTO establecimientoCategoriaDTO = new EstablecimientoCategoriaDTO() { co_establecimiento_clase = Convert.ToString(stepContext.Values["co_establecimiento_clase"]), co_establecimiento_subclase = CodigoList[choice.Index], co_establecimiento_categoria = "", no_establecimiento_categoria = "", fl_inactivo = "0" }; CodigoList.Clear(); DescripcionList.Clear(); EstablecimientoCategoriaClient establecimientoCategoriaClient = new EstablecimientoCategoriaClient(); var result = establecimientoCategoriaClient.GetAllAsync(establecimientoCategoriaDTO); if (result.error_number == 0) { foreach (EstablecimientoCategoriaDTO item in result.Data) { CodigoList.Add(item.co_establecimiento_categoria); DescripcionList.Add(item.no_establecimiento_categoria); } } CodigoList.Add("0"); DescripcionList.Add(ExitOption); var options = DescripcionList.ToList(); var promptOptions = new PromptOptions { Prompt = MessageFactory.Text("Por favor seleccione una **Categoria de Establecimiento**:"), Choices = ChoiceFactory.ToChoices(options), Style = ListStyle.List }; // Prompt the user for a choice. return(await stepContext.PromptAsync(nameof(ChoicePrompt), promptOptions, cancellationToken)); }
private async Task <DialogTurnResult> MostrarOpciones(WaterfallStepContext stepContext, CancellationToken cancellationToken) { List <string> EstablecimientoCategoriaList = new List <string>(); EstablecimientoCategoriaDTO establecimientoCategoriaDTO = new EstablecimientoCategoriaDTO() { co_establecimiento_clase = "", co_establecimiento_subclase = "", co_establecimiento_categoria = "", no_establecimiento_categoria = "", fl_inactivo = "0" }; EstablecimientoCategoriaClient establecimientoCategoriaClient = new EstablecimientoCategoriaClient(); var result = establecimientoCategoriaClient.GetAllAsync(establecimientoCategoriaDTO); if (result.error_number == 0) { foreach (EstablecimientoCategoriaDTO item in result.Data) { EstablecimientoCategoriaList.Add(item.no_establecimiento_categoria); } } var options = EstablecimientoCategoriaList.ToList(); var promptOptions = new PromptOptions { Prompt = MessageFactory.Text("Por favor seleccione una **Categoria de Establecimiento**:"), Choices = ChoiceFactory.ToChoices(options), Style = ListStyle.List }; // Prompt the user for a choice. return(await stepContext.PromptAsync(nameof(ChoicePrompt), promptOptions, cancellationToken)); }