コード例 #1
0
        public async Task ContactNumberHandler(IDialogContext context, IAwaitable <string> argument)
        {
            var contactNumber = await argument;

            testDriveDetail.PhoneNumber = contactNumber;

            await context.PostAsync($@"Thank you for your interest, your request has been logged. Our sales team will get back to you shortly.
                                    {Environment.NewLine}Your test drive request summary:
                                    {Environment.NewLine}Car Make: {testDriveDetail.CarMake},
                                    {Environment.NewLine}Car Model: {testDriveDetail.CarModel},
                                    {Environment.NewLine}Requested Time: {testDriveDetail.RequestedTime},
                                    {Environment.NewLine}Customer Name: {testDriveDetail.CustomerName},
                                    {Environment.NewLine}Phone Number: {testDriveDetail.PhoneNumber}");

            //CrmLead.CreateTestDrive(testDriveDetail, CrmDataConnection.GetAPI());

            CrmLead.CreateTestDrive(testDriveDetail, CrmDataConnection.GetOrgService());

            PromptDialog.Confirm(
                context: context,
                resume: AnythingElseHandler,
                prompt: "Is there anything else that I could help?",
                retry: "Sorry, I don't understand that."
                );
        }
コード例 #2
0
        public async Task ContactNumberHandler(IDialogContext context, IAwaitable <string> argument)
        {
            var contactNumber = await argument;

            testDriveDetail.PhoneNumber = contactNumber;

            await context.PostAsync($@"Thank you for your interest, your request has been logged. Our sales team will get back to you shortly.
                                    {Environment.NewLine}Your test drive request summary:
                                    {Environment.NewLine}Car Make: {testDriveDetail.CarMake},
                                    {Environment.NewLine}Car Model: {testDriveDetail.CarModel},
                                    {Environment.NewLine}Requested Time: {testDriveDetail.RequestedTime},
                                    {Environment.NewLine}Customer Name: {testDriveDetail.CustomerName},
                                    {Environment.NewLine}Phone Number: {testDriveDetail.PhoneNumber}");

            //CrmLead.CreateTestDrive(testDriveDetail, CrmDataConnection.GetAPI());

            CrmLead.CreateTestDrive(testDriveDetail, CrmDataConnection.GetOrgService());

            context.Done <string>("Test drive has been logged");
        }
コード例 #3
0
        public static IForm <CarInquiryFormFlow> BuildForm()
        {
            OnCompletionAsyncDelegate <CarInquiryFormFlow> processRequest = async(context, state) =>
            {
                await context.PostAsync($@"Your test drive request summary:
                                    {Environment.NewLine}Car Make: {state.CarMake.ToString()},
                                    {Environment.NewLine}Car Model: {state.CarModel.ToString()},
                                    {Environment.NewLine}Requested Time: {state.PreferredTime},
                                    {Environment.NewLine}Customer Name: {state.Name},
                                    {Environment.NewLine}Phone Number: {state.ContactNumber}");

                var testDriveDetail = new TestDriveDetail
                {
                    CarMake       = state.CarMake.ToString(),
                    CarModel      = state.CarModel.ToString(),
                    RequestedTime = state.PreferredTime,
                    CustomerName  = state.Name,
                    PhoneNumber   = state.ContactNumber
                };

                // save the data to CRM
                CrmLead.CreateTestDrive(testDriveDetail, CrmDataConnection.GetOrgService());
            };

            return(new FormBuilder <CarInquiryFormFlow>()
                   .Message("Welcome to the car test drive bot!")
                   .Field(nameof(CarMake))
                   .Field(nameof(CarModel))
                   .Field(nameof(PreferredTime))
                   .Field(nameof(Name))
                   .Field(nameof(ContactNumber))
                   .AddRemainingFields()
                   .Message("Thank you for your interest, your request has been logged. Our sales team will get back to you shortly.")
                   .OnCompletion(processRequest)
                   .Build());
        }