Beispiel #1
0
        private async Task CaptureLeadComplete(IDialogContext context, IAwaitable <CaptureLead> result)
        {
            var activity = (context.Activity as Activity);

            CaptureLead order = null;

            try
            {
                order = await result;
            }
            catch (OperationCanceledException)
            {
                await context.PostAsync("You canceled the form!");

                return;
            }

            if (order != null)
            {
                await context.PostAsync("Ok, enviado, logo algum representante lhe fará contato., lembre-se pode digitar **ajuda** \n" +
                                        "Posso ajudar em algo mais ?");

                await Services.Email.SendEmail("Sugstão de Artigo", order.ToString());
            }
            else
            {
                await context.PostAsync("Form returned empty response!");
            }

            context.Wait(MessageReceived);
        }
Beispiel #2
0
        public async Task MessageReceivedAsync(IDialogContext context, IAwaitable <IMessageActivity> result)
        {
            var userFeedback = await result;


            if (userFeedback.Text.Contains("yes-positive-feedback"))
            {
                var activity    = (context.Activity as Activity);
                var capLeadForm = new CaptureLead();


                (context.ConversationData).TryGetValue("User.Setting.Name", out string nome);
                (context.ConversationData).TryGetValue("User.Setting.Email", out string email);

                capLeadForm.Name     = nome;
                capLeadForm.Email    = email;
                capLeadForm.Describe = this.describe;


                var form = new FormDialog <CaptureLead>(capLeadForm, CaptureLead.BuildForm, FormOptions.PromptInStart, null);
                context.Call <CaptureLead>(form, FormCompleteCallback);
            }
            else
            {
                // no feedback return
                context.Done <IMessageActivity>(userFeedback);
            }
        }
Beispiel #3
0
        public async Task RequestQuoteForm(IDialogContext context, LuisResult result)
        {
            var activity    = (context.Activity as Activity);
            var capLeadForm = new CaptureLead();
            var entities    = new List <EntityRecommendation>(result.Entities);

            var form = new FormDialog <CaptureLead>(capLeadForm, CaptureLead.BuildForm, FormOptions.PromptInStart, entities);

            context.Call <CaptureLead>(form, CaptureLeadComplete);

            //await Conversation.SendAsync(activity, () => Chain.From(() => FormDialog.FromForm(() => CaptureLead.BuildForm(), FormOptions.PromptFieldsWithValues)));
        }
Beispiel #4
0
        private async Task FormCompleteCallback(IDialogContext context, IAwaitable <CaptureLead> result)
        {
            var activity = (context.Activity as Activity);

            CaptureLead order = null;

            try
            {
                order = await result;
            }
            catch (OperationCanceledException)
            {
                await context.PostAsync(KeyPassAndPhrase._OkImSorryButIamHere);

                context.Done <IMessageActivity>(null);
                return;
            }

            if (order != null)
            {
                (context.ConversationData).SetValue("User.Setting.Name", order.Name);
                (context.ConversationData).SetValue("User.Setting.Email", order.Email);



                await _email.SendEmailAsync(nameCustomer : order.Name,
                                            subject : "Oi, sou eu a ***Ian*** da Isco. Segue as informações sobre o sistema que você me solicitou",
                                            to : order.Email,
                                            replayto : KeyPassAndPhrase._emailVendas,
                                            cc : new string[] { KeyPassAndPhrase._emailVendas },
                                            bcc : new string[] { KeyPassAndPhrase._emailCopiaVendas },
                                            templateId : this.templateEmailid);

                await context.PostAsync("Ok, já enviei no seu email, se precisar pode **me perguntar também**...");

                await context.PostAsync("Ah, tentei lhe enviar um CUPOM de desconto lá, se você fechar comigo...");
            }
            else
            {
                await context.PostAsync(KeyPassAndPhrase._SometinhgWrong);
            }



            context.Done <string>(null);
        }
Beispiel #5
0
        private async Task CaptureLeadComplete(IDialogContext context, IAwaitable <CaptureLead> result)
        {
            var activity = (context.Activity as Activity);

            CaptureLead order = null;

            try
            {
                order = await result;
            }
            catch (OperationCanceledException)
            {
                await context.PostAsync("You canceled the form!");

                return;
            }

            if (order != null)
            {
                MailMessage mail   = new MailMessage("*****@*****.**", "*****@*****.**");
                SmtpClient  client = new SmtpClient();
                client.Port                  = 587;
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Timeout               = 10000;
                client.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "Jymkatana_6985");
                client.Host                  = "mail.iscosistemas.com";
                mail.Subject                 = "Proposta.";
                mail.Body = order.ToString();
                client.Send(mail);

                await context.PostAsync("Ok, enviado, logo algum representante lhe fará contato., lembre-se pode digitar **ajuda** \n" +
                                        "Posso ajudar em algo mais ?");
            }
            else
            {
                await context.PostAsync("Form returned empty response!");
            }

            context.Wait(MessageReceived);
        }