Ejemplo n.º 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (_usersService.Auth(tbEmail.Text, tbPassword.Text))
     {
         Close();
     }
 }
        public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
        {
            //EstadisticaController.GuardarPreguntaAbierta("Nuevo 2");

            //Sevicio de usuario
            var userService = new UsersService();

            //Autenticación
            var usuario = userService.Auth(new Models.Cuenta
            {
                Codigo     = "000104374",
                Contrasena = "123456"
            });


            if (turnContext.Activity.Value != null)
            {
                await turnContext.SendActivityAsync(turnContext.Activity.Value.ToString());
            }
            if (turnContext.Activity.Type == ActivityTypes.Message)
            {
                // initialize state if necessary
                var state = await BotAccessors.BumblebeeBotStateAccessor.GetAsync(turnContext, () => new BumblebeeBotState(), cancellationToken);

                turnContext.TurnState.Add("BotAccessors", BotAccessors);

                var dialogCtx = await dialogs.CreateContextAsync(turnContext, cancellationToken);

                if (dialogCtx.ActiveDialog == null)
                {
                    if (usuario != null)
                    {
                        await dialogCtx.BeginDialogAsync(PrincipalDialog.Id, cancellationToken);
                    }
                    else
                    {
                        await dialogCtx.BeginDialogAsync(PrincipalAlternativoDialog.Id, cancellationToken);
                    }
                }
                else
                {
                    await dialogCtx.ContinueDialogAsync(cancellationToken);
                }

                await BotAccessors.ConversationState.SaveChangesAsync(turnContext, false, cancellationToken);
            }
        }