public async Task IssueConfirmedMessageReceivedAsync(IDialogContext context, IAwaitable <bool> argument) { var confirmed = await argument; if (confirmed) { var api = new TicketAPIClient(); var ticketId = await api.PostTicketAsync(this.category, this.severity, this.description); if (ticketId != -1) { var message = context.MakeMessage(); message.Attachments = new List <Attachment> { new Attachment { ContentType = "application/vnd.microsoft.card.adaptive", Content = CreateCard(ticketId, this.category, this.severity, this.description) } }; await context.PostAsync(message); } else { await context.PostAsync("Oooops! Something went wrong while I was saving your ticket. Please try again later."); } } else { await context.PostAsync("OK. The ticket was not created. You can start again if you want."); } context.Done <object>(null); }
private async Task IssueConformedMessageReceivedAsync(IDialogContext context, IAwaitable <bool> result) { var confirmed = await result; if (confirmed) { var api = new TicketAPIClient(); var ticketId = await api.PostTicketAsync(this.category, this.severity, this.description); if (ticketId != -1) { var message = context.MakeMessage(); message.Attachments = new List <Attachment> { new Attachment { ContentType = "application/vnd.microsoft.card.adaptive", Content = CreateCard(ticketId, this.category, this.severity, this.description) }, }; await context.PostAsync(message); } else { await context.PostAsync("サポートチケット発行中にエラーが発生しました。恐れ入りますが、後ほど再度お試しください。"); } } else { await context.PostAsync("サポートチケットの発行を中止しました。最初からやり直してください。"); } PromptDialog.Choice(context, this.HearingUsersVoice, new[] { "はい", "いいえ" }, "この bot の応対にご満足いただけましたか??"); }
//private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<object> result) //{ // var activity = await result as Activity; // // calculate something for us to return // int length = (activity.Text ?? string.Empty).Length; // // return our reply to the user // await context.PostAsync($"You sent {activity.Text} which was {length} characters"); // context.Wait(MessageReceivedAsync); //} //private async Task MessageReceivedAsync(IDialogContext context, IAwaitable<string> argument) //{ // var severity = await argument; // Console.WriteLine(severity); //} //public async Task MessageReceivedAsync(IDialogContext context, IAwaitable<IMessageActivity> argument) //{ // var message = await argument; // await context.PostAsync("Hi! I’m the help desk bot and I can help you create a ticket."); // PromptDialog.Text(context, this.DescriptionMessageReceivedAsync, "First, please briefly describe your problem to me."); //} //public async Task DescriptionMessageReceivedAsync(IDialogContext context, IAwaitable<string> argument) //{ // this.description = await argument; // var severities = new string[] { "high", "normal", "low" }; // PromptDialog.Choice(context, this.SeverityMessageReceivedAsync, severities, "Which is the severity of this problem?"); //} //public async Task SeverityMessageReceivedAsync(IDialogContext context, IAwaitable<string> argument) //{ // this.severity = await argument; // PromptDialog.Text(context, this.CategoryMessageReceivedAsync, "Which would be the category for this ticket (software, hardware, networking, security or other)?"); //} //public async Task CategoryMessageReceivedAsync(IDialogContext context, IAwaitable<string> argument) //{ // this.category = await argument; // var text = $"Great! I'm going to create a \"{this.severity}\" severity ticket in the \"{this.category}\" category. " + // $"The description I will use is \"{this.description}\". Can you please confirm that this information is correct?"; // PromptDialog.Confirm(context, this.IssueConfirmedMessageReceivedAsync, text); //} public async Task IssueConfirmedMessageReceivedAsync(IDialogContext context, IAwaitable <bool> argument) { var confirmed = await argument; if (confirmed) { //CreateReply(String.Empty); //var reply = activity.CreateReply(String.Empty); //reply.Type = ActivityTypes.Typing; //await activityContext.SendResponse(reply); //var activity = await argument as Activity; //ConnectorClient connector = new ConnectorClient(new System.Uri(activity.ServiceUrl)); //Activity isTypingReply = activity.CreateReply(“Shuttlebot is typing…”); //isTypingReply.Type = ActivityTypes.Typing; //isTypingReply.Text = “Shuttlebot is typing…”; //await connector.Conversations.ReplyToActivityAsync(isTypingReply); /* Send an 'is typing' message */ var a = context.MakeMessage(); a.Type = ActivityTypes.Typing; await context.PostAsync(a); await Task.Delay(2000); var api = new TicketAPIClient(); var ticketId = await api.PostTicketAsync(this.category, this.severity, this.description); if (ticketId != -1) { var message = context.MakeMessage(); message.Attachments = new List <Attachment> { new Attachment { ContentType = "application/vnd.microsoft.card.adaptive", Content = CreateCard(ticketId, this.category, this.severity, this.description) } }; await context.PostAsync(message); } else { await context.PostAsync("Ooops! Something went wrong while I was saving your ticket. Please try again later."); } } else { await context.PostAsync("Ok. The ticket was not created. You can start again if you want."); } context.Done <object>(null); }
public async Task IssueConfirmedMessageReceivedAsync(IDialogContext context, IAwaitable <bool> argument) { var confirmed = await argument; if (confirmed) { var api = new TicketAPIClient(); var test = new PatientInfo(); test = PatientDetails; var ticketId = await api.PostTicketAsync(test); if (ticketId != -1) { var message = context.MakeMessage(); message.Attachments = new List <Attachment> { new Attachment { ContentType = "application/vnd.microsoft.card.adaptive", Content = this.CreateCard(ticketId, this.PatientDetails.Name, this.PatientDetails.Age, this.PatientDetails.Sex, this.PatientDetails.MaritalStatus, this.PatientDetails.Birthday, this.PatientDetails.Address, this.PatientDetails.ContactNumber, this.PatientDetails.DateOfAdmission) } }; await context.PostAsync(message); } else { await context.PostAsync("Ooops! Something went wrong while I was saving your ticket. Please try again later."); } } else { await context.PostAsync("Ok. The ticket was not created. You can start again if you want."); } context.Done <object>(null); }
public async Task IssueConfirmedMessageReceivedAsync(IDialogContext context, IAwaitable <bool> argument) { var confirmed = await argument; if (confirmed) { var api = new TicketAPIClient(); var ticketId = await api.PostTicketAsync(this.category, this.severity, this.description); if (ticketId != -1) { var message = context.MakeMessage(); message.Attachments = new List <Attachment> { new Attachment { ContentType = "application/vnd.microsoft.card.adaptive", Content = CreateCard(ticketId, this.category, this.severity, this.description) } }; await context.PostAsync(message); } else { await context.PostAsync("サポートチケットの発行中に" + "エラーが発生しました。" + "恐れ入りますが、後ほど再度お試しください"); } } else { await context.PostAsync("サポートチケットの発行を中止しました。" + "サポートチケット発行が必要な場合は再度やり直してください。"); } context.Done <object>(null); }