Example #1
0
        public virtual async Task MessageRecievedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var message = await result;

            try
            {
                PeopeAppService searchService = new PeopeAppService();
                List <People>   searchResult  = await searchService.SearchByNamePeople(message.Text);

                if (searchResult.Count > 0)
                {
                    CardUtil.ShowPeopleHeroCard(message, searchResult);
                    await SelectedConfirm(context);
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "No hemos encontrado información. Por favor intente de nuevo"));
                    await StartAsync(context);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
            }
            // context.Done<object>(null);
        }
        public virtual async Task MessageRecievedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var message = await result;

            try
            {
                PeopeAppService searchService = new PeopeAppService();
                List <People>   searchResult  = await searchService.SearchByNamePeople(message.Text);

                if (searchResult.Count > 0)
                {
                    CardUtil.ShowPeopleHeroCard(message, searchResult);
                    Thread.Sleep(4000);
                    await SelectedConfirm(context);
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "¡LO SIENTO...! No encontré la información. Por favor,  intente nuevamente"));
                    await StartAsync(context);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
                await context.PostAsync("¡LO SIENTO...! Por el momento no esta disponible este servicio. Por favor, intente más tarde.");

                context.Done <object>(null);
            }
        }
Example #3
0
        private async Task GetInformationRRHHSign(IDialogContext context)
        {
            try
            {
                PeopeAppService searchService = new PeopeAppService();
                if (!Session.Result)
                {
                    await StartAsync(context);
                }
                if (Session.Result)
                {
                    var message = context.MakeMessage();
                    message.Attachments      = new List <Attachment>();
                    message.AttachmentLayout = AttachmentLayoutTypes.Carousel;
                    message.Attachments.Add(SettingsCardDialog.CardRRHH().ToAttachment());
                    message.Text = $"Hola, " + Session.Nombre;
                    await context.PostAsync(message);

                    context.Wait(MessageRecievedAsync);
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "Tus datos no son correctos. Por favor intenta nuevamente", user.UserOrEmailAdrees));

                    PromptDialog.Text(context, ResumePeopleUserName, "Ingresa nuevamente tu código de empleado:");
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
            }
        }
Example #4
0
        private async Task GetInformationRRHH(IDialogContext context, IAwaitable <string> result)
        {
            var answer = await result;

            user.Password = answer;
            try
            {
                PeopeAppService searchService = new PeopeAppService();
                login = await searchService.Autenticate(user);

                login.Nombres = "Juan Perez Perez";
                if (login.Result)
                {
                    var message = context.MakeMessage();
                    message.Attachments      = new List <Attachment>();
                    message.AttachmentLayout = AttachmentLayoutTypes.Carousel;
                    message.Attachments.Add(SettingsCardDialog.CardRRHH().ToAttachment());
                    message.Text = $"Hola, " + login.Nombres + " estas en la sección Recursos Humanos";
                    await context.PostAsync(message);

                    context.Wait(MessageRecievedAsync);
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "Los datos ingresados no son correctos. Por favor intente de nuevo", user.UserOrEmailAdrees));

                    PromptDialog.Text(context, ResumePeopleUserName, "Por favor, ingrese el usuario con el cual inicia sesión en su computador:");
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
            }
        }
Example #5
0
        public virtual async Task MessageRecievedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var CategoryName = await result;

            try
            {
                PeopeAppService searchService = new PeopeAppService();
                Holiday         holiday       = await searchService.GetRRHHHolidays(login);

                holiday.Nombres = Session.Nombre;
                if (CategoryName != null)
                {
                    switch (CategoryName.Text)
                    {
                    case SettingsCardDialog.RRHHHolidays:
                        CardUtil.ShowRRHHHolidaysCard(CategoryName, holiday);
                        Thread.Sleep(4000);
                        await SelectedConfirm(context);

                        break;

                    case SettingsCardDialog.RRHHvoucher:
                        CardUtil.ShowRRHHvoucherCard(CategoryName, holiday);
                        Thread.Sleep(4000);
                        await SelectedConfirm(context);

                        break;

                    default:
                        await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "La opción {0} no es válida. Por favor intente de nuevo", CategoryName));
                        await StartAsync(context);

                        break;
                    }
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "La opción {0} no es válida. Por favor intente de nuevo", CategoryName));

                    context.Wait(this.MessageRecievedAsync);
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
            }
            //   context.Done<object>(null);
        }
Example #6
0
        public virtual async Task MessageRecievedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var    message      = context.MakeMessage();
            var    answer       = await result;
            string CategoryName = answer.Text;

            if (CategoryName != null)
            {
                PeopeAppService searchService = new PeopeAppService();
                var             vote          = await searchService.CreateSurvey(CategoryName);
            }
            message.Text = "Muchas gracias, fue un placer ayudarlo.";
            await context.PostAsync(message);

            Session.Greet = false;
            context.Done <object>(null);
        }
Example #7
0
        private async Task GetInformationRRHH(IDialogContext context, IAwaitable <string> result)
        {
            var answer = await result;

            try
            {
                PeopeAppService searchService = new PeopeAppService();

                user.Password = answer;
                login         = await searchService.Autenticate(user);

                Session.Result     = login.Result;
                Session.Codigo     = login.Codigo;
                Session.Nombre     = login.Nombres;
                Session.Expiration = DateTime.UtcNow;
                if (Session.Result)
                {
                    var message = context.MakeMessage();
                    message.Attachments      = new List <Attachment>();
                    message.AttachmentLayout = AttachmentLayoutTypes.Carousel;
                    message.Attachments.Add(SettingsCardDialog.CardRRHH().ToAttachment());
                    message.Text = $"Hola, " + Session.Nombre;
                    await context.PostAsync(message);

                    context.Wait(MessageRecievedAsync);
                }
                else
                {
                    await context.PostAsync(string.Format(CultureInfo.CurrentCulture, "Tus datos no son correctos. Por favor intenta nuevamente", user.UserOrEmailAdrees));

                    PromptDialog.Text(context, ResumePeopleUserName, "Ingresa nuevamente tu código de empleado:");
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine($"Error when searching for people: {e.Message}");
                await context.PostAsync("¡LO SIENTO...! Por el momento no esta disponible este servicio. Por favor, intente más tarde.");

                context.Done <object>(null);
            }
        }