예제 #1
0
        /// <summary>
        /// Return the appropriate set of card actions based on the state and information in the ticket.
        /// </summary>
        /// <returns>Adaptive card actions.</returns>
        protected virtual List <AdaptiveAction> BuildActions()
        {
            List <AdaptiveAction> actionsList = new List <AdaptiveAction>();

            actionsList.Add(this.CreateChatWithUserAction());

            actionsList.Add(new AdaptiveShowCardAction
            {
                Title = Strings.ChangeStatusButtonText,
                Card  = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
                {
                    Body = new List <AdaptiveElement>
                    {
                        this.GetAdaptiveChoiceSetInput(),
                    },
                    Actions = new List <AdaptiveAction>
                    {
                        new AdaptiveSubmitAction
                        {
                            Data = new ChangeTicketStatusPayload {
                                TicketId = this.Ticket.TicketId
                            },
                        },
                    },
                },
            });

            if (!string.IsNullOrEmpty(this.Ticket.KnowledgeBaseAnswer))
            {
                actionsList.Add(new AdaptiveShowCardAction
                {
                    Title = Strings.ViewArticleButtonText,
                    Card  = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
                    {
                        Body = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text = CardHelper.TruncateStringIfLonger(this.Ticket.KnowledgeBaseAnswer, CardHelper.KnowledgeBaseAnswerMaxDisplayLength),
                                Wrap = true,
                            },
                        },
                    },
                });
            }

            return(actionsList);
        }
예제 #2
0
        /// <summary>
        /// Building the fact set to render out the user facing details.
        /// </summary>
        /// <param name="ticket">The current ticket information.</param>
        /// <param name="activityLocalTimestamp">The local timestamp.</param>
        /// <returns>The adaptive facts.</returns>
        private List <AdaptiveFact> BuildFactSet(TicketEntity ticket, DateTimeOffset?activityLocalTimestamp)
        {
            List <AdaptiveFact> factList = new List <AdaptiveFact>();

            factList.Add(new AdaptiveFact
            {
                Title = Strings.StatusFactTitle,
                Value = CardHelper.GetUserTicketDisplayStatus(this.ticket),
            });

            factList.Add(new AdaptiveFact
            {
                Title = Strings.TitleFact,
                Value = CardHelper.TruncateStringIfLonger(this.ticket.Title, CardHelper.TitleMaxDisplayLength),
            });

            if (!string.IsNullOrEmpty(ticket.Description))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.DescriptionFact,
                    Value = CardHelper.TruncateStringIfLonger(this.ticket.Description, CardHelper.DescriptionMaxDisplayLength),
                });
            }

            factList.Add(new AdaptiveFact
            {
                Title = Strings.DateCreatedDisplayFactTitle,
                Value = CardHelper.GetFormattedDateInUserTimeZone(this.ticket.DateCreated, activityLocalTimestamp),
            });

            if (ticket.Status == (int)TicketState.Closed)
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.ClosedFactTitle,
                    Value = CardHelper.GetFormattedDateInUserTimeZone(this.ticket.DateClosed.Value, activityLocalTimestamp),
                });
            }

            return(factList);
        }
예제 #3
0
        /// <summary>
        /// Building the fact set to render out the user facing details.
        /// </summary>
        /// <returns>The adaptive facts.</returns>
        private List <AdaptiveFact> BuildFactSet()
        {
            List <AdaptiveFact> factList = new List <AdaptiveFact>();

            factList.Add(new AdaptiveFact
            {
                Title = Strings.StatusFactTitle,
                Value = CardHelper.GetUserTicketDisplayStatus(this.ticket),
            });

            factList.Add(new AdaptiveFact
            {
                Title = Strings.TitleFact,
                Value = CardHelper.TruncateStringIfLonger(this.ticket.Title, CardHelper.TitleMaxDisplayLength),
            });

            if (!string.IsNullOrEmpty(this.ticket.Description))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.DescriptionFact,
                    Value = CardHelper.TruncateStringIfLonger(this.ticket.Description, CardHelper.DescriptionMaxDisplayLength),
                });
            }

            factList.Add(new AdaptiveFact
            {
                Title = Strings.DateCreatedDisplayFactTitle,
                Value = CardHelper.GetFormattedDateForAdaptiveCard(this.ticket.DateCreated),
            });

            if (this.ticket.Status == (int)TicketState.Closed)
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.ClosedFactTitle,
                    Value = CardHelper.GetFormattedDateForAdaptiveCard(this.ticket.DateClosed.Value),
                });
            }

            return(factList);
        }
예제 #4
0
        /// <summary>
        /// Return the appropriate fact set based on the state and information in the ticket.
        /// </summary>
        /// <param name="localTimestamp">The current timestamp.</param>
        /// <returns>The fact set showing the necessary details.</returns>
        private List <AdaptiveFact> BuildFactSet(DateTimeOffset?localTimestamp)
        {
            List <AdaptiveFact> factList = new List <AdaptiveFact>();

            if (!string.IsNullOrEmpty(this.Ticket.Description))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.DescriptionFact,
                    Value = this.Ticket.Description,
                });
            }

            if (!string.IsNullOrEmpty(this.Ticket.UserQuestion))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.QuestionAskedFactTitle,
                    Value = this.Ticket.UserQuestion,
                });
            }

            factList.Add(new AdaptiveFact
            {
                Title = Strings.StatusFactTitle,
                Value = CardHelper.GetTicketDisplayStatusForSme(this.Ticket),
            });

            if (this.Ticket.Status == (int)TicketState.Closed)
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.ClosedFactTitle,
                    Value = CardHelper.GetFormattedDateInUserTimeZone(this.Ticket.DateClosed.Value, localTimestamp),
                });
            }

            return(factList);
        }
예제 #5
0
        /// <summary>
        /// Return the appropriate fact set based on the state and information in the ticket.
        /// </summary>
        /// <returns>The fact set showing the necessary details.</returns>
        private IEnumerable <AdaptiveFact> BuildFactSet()
        {
            List <AdaptiveFact> factList = new List <AdaptiveFact>();

            if (!string.IsNullOrEmpty(this.Ticket.Description))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.DescriptionFact,
                    Value = this.Ticket.Description,
                });
            }

            if (!string.IsNullOrEmpty(this.Ticket.UserQuestion))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.QuestionAskedFactTitle,
                    Value = this.Ticket.UserQuestion,
                });
            }

            factList.Add(new AdaptiveFact
            {
                Title = Strings.StatusFactTitle,
                Value = CardHelper.GetTicketDisplayStatusForSme(this.Ticket),
            });

            if (this.Ticket.Status == (int)TicketState.Closed)
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.ClosedFactTitle,
                    Value = CardHelper.GetFormattedDateForAdaptiveCard(this.Ticket.DateClosed.Value),
                });
            }

            return(factList);
        }
예제 #6
0
        /// <summary>
        /// Return the appropriate set of card actions based on the state and information in the ticket.
        /// </summary>
        /// <param name="appBaseUri">The base URI where the app is hosted.</param>
        /// <returns>Adaptive card actions.</returns>
        protected virtual List <AdaptiveAction> BuildActions(string appBaseUri)
        {
            List <AdaptiveAction> actionsList = new List <AdaptiveAction>();

            actionsList.Add(this.CreateChatWithUserAction(appBaseUri));

            actionsList.Add(new AdaptiveShowCardAction
            {
                Title = Strings.ChangeStatusButtonText,
                Card  = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
                {
                    Actions = this.BuildChangeStatesActions(),
                },
                IconUrl = appBaseUri + "/content/change.png",
            });

            if (!string.IsNullOrEmpty(this.Ticket.KnowledgeBaseAnswer))
            {
                actionsList.Add(new AdaptiveShowCardAction
                {
                    Title = Strings.ViewArticleButtonText,
                    Card  = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
                    {
                        Body = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text = CardHelper.TruncateStringIfLonger(this.Ticket.KnowledgeBaseAnswer, CardHelper.KnowledgeBaseAnswerMaxDisplayLength),
                                Wrap = true,
                            },
                        },
                    },
                    IconUrl = appBaseUri + "/content/article.png",
                });
            }

            return(actionsList);
        }
예제 #7
0
        /// <summary>
        /// This method will construct the card for SME team which will have the
        /// feedback details given by the user.
        /// </summary>
        /// <param name="data">User activity payload.</param>
        /// <param name="userDetails">User details.</param>
        /// <returns>Sme facing feedback notification card.</returns>
        public static Attachment GetCard(ShareFeedbackCardPayload data, TeamsChannelAccount userDetails)
        {
            var textAlignment = CultureInfo.CurrentCulture.TextInfo.IsRightToLeft ? AdaptiveHorizontalAlignment.Right : AdaptiveHorizontalAlignment.Left;

            // Constructing adaptive card that is sent to SME team.
            AdaptiveCard smeFeedbackCard = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
            {
                Body = new List <AdaptiveElement>
                {
                    new AdaptiveTextBlock()
                    {
                        Text   = Strings.SMEFeedbackHeaderText,
                        Weight = AdaptiveTextWeight.Bolder,
                        Size   = AdaptiveTextSize.Medium,
                        HorizontalAlignment = textAlignment,
                    },
                    new AdaptiveTextBlock()
                    {
                        Text = string.Format(CultureInfo.InvariantCulture, Strings.FeedbackAlertText, userDetails?.Name),
                        Wrap = true,
                        HorizontalAlignment = textAlignment,
                    },
                    new AdaptiveTextBlock()
                    {
                        Text   = Strings.RatingTitle,
                        Weight = AdaptiveTextWeight.Bolder,
                        Wrap   = true,
                        HorizontalAlignment = textAlignment,
                    },
                    new AdaptiveTextBlock()
                    {
                        Text                = GetRatingDisplayText(data?.Rating),
                        Spacing             = AdaptiveSpacing.None,
                        Wrap                = true,
                        HorizontalAlignment = textAlignment,
                    },
                },
                Actions = new List <AdaptiveAction>
                {
                    new AdaptiveOpenUrlAction
                    {
                        Title     = string.Format(CultureInfo.InvariantCulture, Strings.ChatTextButton, userDetails?.GivenName),
                        UrlString = $"https://teams.microsoft.com/l/chat/0/0?users={Uri.EscapeDataString(userDetails.UserPrincipalName)}",
                    },
                },
            };

            // Description fact is available in the card only when user enters description text.
            if (!string.IsNullOrWhiteSpace(data.Description))
            {
                smeFeedbackCard.Body.Add(new AdaptiveTextBlock()
                {
                    Text   = Strings.DescriptionText,
                    Weight = AdaptiveTextWeight.Bolder,
                    Wrap   = true,
                    HorizontalAlignment = textAlignment,
                });

                smeFeedbackCard.Body.Add(new AdaptiveTextBlock()
                {
                    Text                = CardHelper.TruncateStringIfLonger(data.Description, CardHelper.DescriptionMaxDisplayLength),
                    Spacing             = AdaptiveSpacing.None,
                    Wrap                = true,
                    HorizontalAlignment = textAlignment,
                });
            }

            // Question asked fact and view article show card is available when feedback is on QnA Maker response.
            if (!string.IsNullOrWhiteSpace(data.KnowledgeBaseAnswer) && !string.IsNullOrWhiteSpace(data.UserQuestion))
            {
                smeFeedbackCard.Body.Add(new AdaptiveFactSet
                {
                    Facts = new List <AdaptiveFact>
                    {
                        new AdaptiveFact()
                        {
                            Title = Strings.QuestionAskedFactTitle,
                            Value = data.UserQuestion,
                        },
                    },
                });

                smeFeedbackCard.Actions.AddRange(new List <AdaptiveAction>
                {
                    new AdaptiveShowCardAction
                    {
                        Title = Strings.ViewArticleButtonText,
                        Card  = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
                        {
                            Body = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text = CardHelper.TruncateStringIfLonger(data.KnowledgeBaseAnswer, CardHelper.KnowledgeBaseAnswerMaxDisplayLength),
                                    Wrap = true,
                                    HorizontalAlignment = textAlignment,
                                },
                            },
                        },
                    },
                });
            }

            return(new Attachment
            {
                ContentType = AdaptiveCard.ContentType,
                Content = smeFeedbackCard,
            });
        }
        /// <summary>
        /// Building the fact set to render out the user facing details.
        /// </summary>
        /// <param name="ticket">The current ticket information.</param>
        /// <param name="activityLocalTimestamp">The local timestamp.</param>
        /// <returns>The adaptive facts.</returns>
        private List <AdaptiveFact> BuildFactSet(TicketEntity ticket, DateTimeOffset?activityLocalTimestamp)
        {
            List <AdaptiveFact> factList = new List <AdaptiveFact>();

            if (!string.IsNullOrEmpty(ticket.TicketId))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.TicketIDFact,
                    Value = ticket.TicketId.Substring(0, 8),
                });
            }

            factList.Add(new AdaptiveFact
            {
                Title = Strings.StatusFactTitle,
                Value = CardHelper.GetUserTicketDisplayStatus(this.ticket),
            });

            if (ticket.Status != (int)TicketState.UnAssigned)
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.ExpertFact,
                    Value = ticket.AssignedToName,
                });
            }

            if (!string.IsNullOrEmpty(ticket.Subject))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.SubjectFact,
                    Value = ticket.Subject,
                });
            }

            factList.Add(new AdaptiveFact
            {
                Title = Strings.TitleFact,
                Value = CardHelper.TruncateStringIfLonger(this.ticket.Title, CardHelper.TitleMaxDisplayLength),
            });

            if (!string.IsNullOrEmpty(ticket.Description))
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.DescriptionFact,
                    Value = CardHelper.TruncateStringIfLonger(this.ticket.Description, CardHelper.DescriptionMaxDisplayLength),
                });
            }

            factList.Add(new AdaptiveFact
            {
                Title = Strings.DateCreatedDisplayFactTitle,
                Value = CardHelper.GetFormattedDateInUserTimeZone(this.ticket.DateCreated, activityLocalTimestamp),
            });
            if (ticket.Status == (int)TicketState.Pending && this.ticket.PendingComment != null)
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.CommentText,
                    Value = CardHelper.TruncateStringIfLonger(this.ticket.PendingComment, CardHelper.DescriptionMaxDisplayLength),
                });
            }

            if (ticket.Status == (int)TicketState.Resolved)
            {
                factList.Add(new AdaptiveFact
                {
                    Title = Strings.ClosedFactTitle,
                    Value = CardHelper.GetFormattedDateInUserTimeZone(this.ticket.DateClosed.Value, activityLocalTimestamp),
                });
                if (this.ticket.ResolveComment != null)
                {
                    factList.Add(new AdaptiveFact
                    {
                        Title = Strings.CommentText,
                        Value = CardHelper.TruncateStringIfLonger(this.ticket.ResolveComment, CardHelper.DescriptionMaxDisplayLength),
                    });
                }
            }

            return(factList);
        }
        /// <summary>
        /// This method will construct the card for SME team which will have the
        /// feedback details given by the user.
        /// </summary>
        /// <param name="data">User activity payload.</param>
        /// <param name="appBaseUri">The base URI where the app is hosted.</param>
        /// <returns>Sme facing feedback notification card.</returns>
        public static Attachment GetCard(FeedbackEntity data, string appBaseUri)
        {
            // Constructing adaptive card that is sent to SME team.
            AdaptiveCard smeFeedbackCard = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
            {
                Body = new List <AdaptiveElement>
                {
                    new AdaptiveColumnSet
                    {
                        Columns = new List <AdaptiveColumn>
                        {
                            new AdaptiveColumn
                            {
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveImage
                                    {
                                        Style = AdaptiveImageStyle.Default,
                                        Size  = AdaptiveImageSize.Medium,
                                        Url   = new Uri(appBaseUri + "/content/feedback_channel.png"),
                                    },
                                },
                                Width = "auto",
                            },
                            new AdaptiveColumn
                            {
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock()
                                    {
                                        Text   = Strings.SMEFeedbackHeaderText,
                                        Weight = AdaptiveTextWeight.Bolder,
                                        Wrap   = true,
                                    },
                                    new AdaptiveTextBlock()
                                    {
                                        Text     = string.Format(CultureInfo.InvariantCulture, Strings.FeedbackAlertText, data.UserName),
                                        Spacing  = AdaptiveSpacing.None,
                                        IsSubtle = true,
                                        Wrap     = true,
                                    },
                                },
                                Width = "stretch",
                            },
                        },
                    },
                    new AdaptiveTextBlock()
                    {
                        Text   = Strings.RatingTitle,
                        Weight = AdaptiveTextWeight.Bolder,
                        Wrap   = true,
                    },
                    new AdaptiveTextBlock()
                    {
                        Text    = GetRatingDisplayText(data?.Rating),
                        Spacing = AdaptiveSpacing.None,
                        Wrap    = true,
                    },
                },
                Actions = new List <AdaptiveAction>
                {
                    new AdaptiveOpenUrlAction
                    {
                        Title     = string.Format(CultureInfo.InvariantCulture, Strings.ChatTextButton, data.UserGivenName),
                        UrlString = $"https://teams.microsoft.com/l/chat/0/0?users={Uri.EscapeDataString(data.UserPrincipalName)}",
                    },
                },
            };

            // Description fact is available in the card only when user enters description text.
            if (!string.IsNullOrWhiteSpace(data.Subject))
            {
                smeFeedbackCard.Body.Insert(3, new AdaptiveTextBlock()
                {
                    Text   = Strings.SubjectFact,
                    Weight = AdaptiveTextWeight.Bolder,
                    Wrap   = true,
                });

                smeFeedbackCard.Body.Insert(4, new AdaptiveTextBlock()
                {
                    Text    = data.Subject,
                    Spacing = AdaptiveSpacing.None,
                    Wrap    = true,
                });
            }

            // Description fact is available in the card only when user enters description text.
            if (!string.IsNullOrWhiteSpace(data.Description))
            {
                smeFeedbackCard.Body.Add(new AdaptiveTextBlock()
                {
                    Text   = Strings.DescriptionText,
                    Weight = AdaptiveTextWeight.Bolder,
                    Wrap   = true,
                });

                smeFeedbackCard.Body.Add(new AdaptiveTextBlock()
                {
                    Text    = CardHelper.TruncateStringIfLonger(data.Description, CardHelper.DescriptionMaxDisplayLength),
                    Spacing = AdaptiveSpacing.None,
                    Wrap    = true,
                });
            }

            // Question asked fact and view article show card is available when feedback is on QnA Maker response.
            if (!string.IsNullOrWhiteSpace(data.KnowledgeBaseAnswer) && !string.IsNullOrWhiteSpace(data.UserQuestion))
            {
                smeFeedbackCard.Body.Add(new AdaptiveFactSet
                {
                    Facts = new List <AdaptiveFact>
                    {
                        new AdaptiveFact()
                        {
                            Title = Strings.QuestionAskedFactTitle,
                            Value = data.UserQuestion,
                        },
                    },
                });

                smeFeedbackCard.Actions.AddRange(new List <AdaptiveAction>
                {
                    new AdaptiveShowCardAction
                    {
                        Title = Strings.ViewArticleButtonText,
                        Card  = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
                        {
                            Body = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text = CardHelper.TruncateStringIfLonger(data.KnowledgeBaseAnswer, CardHelper.KnowledgeBaseAnswerMaxDisplayLength),
                                    Wrap = true,
                                },
                            },
                        },
                    },
                });
            }

            return(new Attachment
            {
                ContentType = AdaptiveCard.ContentType,
                Content = smeFeedbackCard,
            });
        }
예제 #10
0
        /// <summary>
        /// Returns an attachment based on the state and information of the ticket.
        /// </summary>
        /// <param name="localTimestamp">Local timestamp of the user activity.</param>
        /// <param name="appBaseUri">Application base uri.</param>
        /// <param name="showValidationErrors">Determines whether we show validation errors.</param>
        /// <returns>Returns the attachment that will be sent in a message.</returns>
        public Attachment ToAttachment(DateTimeOffset?localTimestamp, string appBaseUri, bool showValidationErrors)
        {
            var card = new AdaptiveCard(new AdaptiveSchemaVersion(1, 0))
            {
                Body = new List <AdaptiveElement>
                {
                    new AdaptiveTextBlock
                    {
                        Text   = string.Format(CultureInfo.InvariantCulture, Strings.SMETicketHeaderText, this.Ticket.TicketId, this.Ticket.Title),
                        Size   = AdaptiveTextSize.Medium,
                        Weight = AdaptiveTextWeight.Bolder,
                        Wrap   = true,
                    },
                },
            };

            if (this.ticket.KnowledgeBaseQuestion != null)
            {
                card.Body.Add(new AdaptiveTextBlock
                {
                    Text    = string.Format(CultureInfo.InvariantCulture, Strings.SMETicketActualQuestionInKBText, this.Ticket.KnowledgeBaseQuestion),
                    Wrap    = true,
                    Size    = AdaptiveTextSize.Small,
                    Spacing = AdaptiveSpacing.None,
                });
            }
            else
            {
                card.Body.Add(new AdaptiveColumnSet
                {
                    Columns = new List <AdaptiveColumn>
                    {
                        new AdaptiveColumn
                        {
                            Width = "auto",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveImage
                                {
                                    Url = new Uri(string.Format("{0}/content/RedInfoIcon.png", appBaseUri)),
                                    HorizontalAlignment = AdaptiveHorizontalAlignment.Left,
                                    AltText             = "Info icon",
                                },
                            },
                        },
                        new AdaptiveColumn
                        {
                            Width = "auto",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text    = Strings.SMETicketNoQuestionInKBText,
                                    Wrap    = true,
                                    Size    = AdaptiveTextSize.Small,
                                    Spacing = AdaptiveSpacing.None,
                                },
                            },
                        },
                    },
                });
            }

            if (this.Ticket.Status == (int)TicketState.Answered)
            {
                card.Body.Add(new AdaptiveColumnSet
                {
                    Columns = new List <AdaptiveColumn>
                    {
                        new AdaptiveColumn
                        {
                            Width = "80px",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text = Strings.StatusFactTitle,
                                    Wrap = true,
                                },
                            },
                        },
                        new AdaptiveColumn
                        {
                            Width   = "auto",
                            Spacing = AdaptiveSpacing.Medium,
                            Items   = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text  = "**" + CardHelper.GetTicketDisplayStatusForSme(this.Ticket, this.updateTicketResponsePayload) + "**",
                                    Color = AdaptiveTextColor.Good,
                                    Wrap  = true,
                                },
                            },
                        },
                    },
                });
            }
            else
            {
                card.Body.Add(new AdaptiveColumnSet
                {
                    Columns = new List <AdaptiveColumn>
                    {
                        new AdaptiveColumn
                        {
                            Width = "80px",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text    = Strings.StatusFactTitle,
                                    Wrap    = true,
                                    Spacing = AdaptiveSpacing.None,
                                },
                            },
                        },
                        new AdaptiveColumn
                        {
                            Width   = "auto",
                            Spacing = AdaptiveSpacing.Medium,
                            Items   = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text  = "**" + CardHelper.GetTicketDisplayStatusForSme(this.Ticket, this.updateTicketResponsePayload) + "**",
                                    Color = AdaptiveTextColor.Attention,
                                    Wrap  = true,
                                },
                            },
                        },
                    },
                });
            }

            card.Body.Add(new AdaptiveColumnSet
            {
                Columns = new List <AdaptiveColumn>
                {
                    new AdaptiveColumn
                    {
                        Width = "80px",
                        Items = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text = Strings.DescriptionFact,
                                Wrap = true,
                            },
                        },
                    },
                    new AdaptiveColumn
                    {
                        Width   = "auto",
                        Spacing = AdaptiveSpacing.Medium,
                        Items   = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text     = this.Ticket.Description,
                                Wrap     = true,
                                MaxLines = 3,
                            },
                        },
                    },
                },
            });

            card.Body.Add(new AdaptiveColumnSet
            {
                Columns = new List <AdaptiveColumn>
                {
                    new AdaptiveColumn
                    {
                        Width = "80px",
                        Items = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text = Strings.QuestionAskedByFactTitle,
                                Wrap = true,
                            },
                        },
                    },
                    new AdaptiveColumn
                    {
                        Width   = "auto",
                        Spacing = AdaptiveSpacing.Medium,
                        Items   = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text = this.Ticket.RequesterName,
                                Wrap = true,
                            },
                        },
                    },
                },
            });

            card.Body.Add(new AdaptiveColumnSet
            {
                Columns = new List <AdaptiveColumn>
                {
                    new AdaptiveColumn
                    {
                        Width = "80px",
                        Items = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text = Strings.DateFactTitle,
                                Wrap = true,
                            },
                        },
                    },
                    new AdaptiveColumn
                    {
                        Width   = "auto",
                        Spacing = AdaptiveSpacing.Medium,
                        Items   = new List <AdaptiveElement>
                        {
                            new AdaptiveTextBlock
                            {
                                Text = CardHelper.GetFormattedDateInUserTimeZone(this.Ticket.DateCreated, localTimestamp),
                                Wrap = true,
                            },
                        },
                    },
                },
            });

            if (!string.IsNullOrEmpty(this.Ticket.KnowledgeBaseQuestion))
            {
                card.Body.Add(new AdaptiveColumnSet
                {
                    Columns = new List <AdaptiveColumn>
                    {
                        new AdaptiveColumn
                        {
                            Width = "80px",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveTextBlock
                                {
                                    Text = Strings.ExistingAnswerFactTitle,
                                    Wrap = true,
                                },
                            },
                        },
                        new AdaptiveColumn
                        {
                            Width = "auto",
                            Items = new List <AdaptiveElement>
                            {
                                new AdaptiveChoiceSetInput
                                {
                                    Id            = Strings.ExistingAnswerFactTitle,
                                    IsMultiSelect = false,
                                    Style         = AdaptiveChoiceInputStyle.Compact,
                                    Value         = Strings.ExistingAnswerFactTitle,
                                    Choices       = new List <AdaptiveChoice>
                                    {
                                        new AdaptiveChoice
                                        {
                                            Title = this.Ticket.KnowledgeBaseAnswer,
                                            Value = Strings.ExistingAnswerFactTitle,
                                        },
                                    },
                                },
                            },
                        },
                    },
                });
            }

            if (this.ticket.AnswerBySME == null && !showValidationErrors)
            {
                card.Actions = this.BuildActions(appBaseUri);
            }
            else
            {
                if (this.updateTicketResponsePayload.Action == UpdateTicketResponsePayload.RespondAction)
                {
                    card.Body.Add(
                        new AdaptiveColumnSet
                    {
                        Columns = new List <AdaptiveColumn>
                        {
                            new AdaptiveColumn
                            {
                                Width = AdaptiveColumnWidth.Auto,
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text = Strings.SMETicketCardYourAnswerLabel,
                                        Wrap = true,
                                        Size = AdaptiveTextSize.Small,
                                    },
                                },
                            },
                            new AdaptiveColumn
                            {
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text  = (showValidationErrors && string.IsNullOrWhiteSpace(this.updateTicketResponsePayload.Answer)) ? Strings.MandatoryAnswerFieldText : string.Empty,
                                        Color = AdaptiveTextColor.Attention,
                                        HorizontalAlignment = AdaptiveHorizontalAlignment.Right,
                                        Wrap = true,
                                    },
                                },
                            },
                        },
                    });
                    card.Body.Add(new AdaptiveTextInput
                    {
                        Spacing     = AdaptiveSpacing.Small,
                        Id          = nameof(UpdateTicketResponsePayload.AnswerForRespond),
                        Placeholder = Strings.ResponsePlaceholderText,
                        IsMultiline = true,
                        Value       = this.updateTicketResponsePayload.AnswerForRespond,
                    });

                    card.Body.Add(new AdaptiveChoiceSetInput
                    {
                        Id            = nameof(UpdateTicketResponsePayload.AddorAppendAction),
                        IsMultiSelect = true,
                        Style         = AdaptiveChoiceInputStyle.Expanded,
                        Value         = this.updateTicketResponsePayload.AddorAppendAction,
                        Choices       = new List <AdaptiveChoice>
                        {
                            new AdaptiveChoice
                            {
                                Title = Strings.AppendToKBText,
                                Value = Strings.AppendActionMessage,
                            },
                        },
                    });

                    if (showValidationErrors)
                    {
                        card.Actions.Add(new AdaptiveSubmitAction
                        {
                            Title = Strings.SubmitResponseButtonText,
                            Data  = new UpdateTicketResponsePayload
                            {
                                TicketId = this.Ticket.TicketId,
                                Action   = UpdateTicketResponsePayload.RespondAction,
                            },
                        });
                    }
                }
                else if (this.updateTicketResponsePayload.Action == UpdateTicketResponsePayload.AddRespondAction)
                {
                    card.Body.Add(
                        new AdaptiveColumnSet
                    {
                        Columns = new List <AdaptiveColumn>
                        {
                            new AdaptiveColumn
                            {
                                Width = AdaptiveColumnWidth.Auto,
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text = Strings.SMETicketCardYourAnswerLabel,
                                        Wrap = true,
                                        Size = AdaptiveTextSize.Small,
                                    },
                                },
                            },
                            new AdaptiveColumn
                            {
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text  = (showValidationErrors && string.IsNullOrWhiteSpace(this.updateTicketResponsePayload.AnswerForRespond)) ? Strings.MandatoryAnswerFieldText : string.Empty,
                                        Color = AdaptiveTextColor.Attention,
                                        HorizontalAlignment = AdaptiveHorizontalAlignment.Right,
                                        Wrap = true,
                                    },
                                },
                            },
                        },
                    });
                    card.Body.Add(new AdaptiveTextInput
                    {
                        Spacing     = AdaptiveSpacing.Small,
                        Id          = nameof(UpdateTicketResponsePayload.Answer),
                        Placeholder = Strings.ResponsePlaceholderText,
                        IsMultiline = true,
                        Value       = this.updateTicketResponsePayload.Answer,
                    });

                    card.Body.Add(new AdaptiveChoiceSetInput
                    {
                        Id            = nameof(UpdateTicketResponsePayload.AddorAppendAction),
                        IsMultiSelect = true,
                        Style         = AdaptiveChoiceInputStyle.Expanded,
                        Value         = this.updateTicketResponsePayload.AddorAppendAction,
                        Choices       = new List <AdaptiveChoice>
                        {
                            new AdaptiveChoice
                            {
                                Title = Strings.AddToKBText,
                                Value = Strings.AddActionMessage,
                            },
                        },
                    });

                    if (showValidationErrors)
                    {
                        card.Actions.Add(new AdaptiveSubmitAction
                        {
                            Title = Strings.SubmitResponseButtonText,
                            Data  = new UpdateTicketResponsePayload
                            {
                                TicketId = this.Ticket.TicketId,
                                Action   = UpdateTicketResponsePayload.AddRespondAction,
                            },
                        });
                    }
                }
                else
                {
                    card.Body.Add(new AdaptiveColumnSet
                    {
                        Columns = new List <AdaptiveColumn>
                        {
                            new AdaptiveColumn
                            {
                                Width = AdaptiveColumnWidth.Auto,
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text = Strings.UpdateExistingButtonText,
                                        Wrap = true,
                                        Size = AdaptiveTextSize.Small,
                                    },
                                },
                            },
                            new AdaptiveColumn
                            {
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text  = (showValidationErrors && string.IsNullOrWhiteSpace(this.updateTicketResponsePayload.Answer)) ? Strings.MandatoryAnswerFieldText : string.Empty,
                                        Color = AdaptiveTextColor.Attention,
                                        HorizontalAlignment = AdaptiveHorizontalAlignment.Right,
                                        Wrap = true,
                                    },
                                },
                            },
                        },
                    });
                    card.Body.Add(new AdaptiveTextInput
                    {
                        Spacing     = AdaptiveSpacing.Small,
                        Id          = nameof(UpdateTicketResponsePayload.Answer),
                        Placeholder = Strings.ResponsePlaceholderText,
                        IsMultiline = true,
                        Value       = this.updateTicketResponsePayload.Answer,
                    });
                    card.Body.Add(new AdaptiveColumnSet
                    {
                        Columns = new List <AdaptiveColumn>
                        {
                            new AdaptiveColumn
                            {
                                Width = "auto",
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveImage
                                    {
                                        Url = new Uri(string.Format("{0}/content/RedInfoIcon.png", appBaseUri)),
                                        HorizontalAlignment = AdaptiveHorizontalAlignment.Left,
                                        AltText             = "Info icon",
                                    },
                                },
                            },
                            new AdaptiveColumn
                            {
                                Width = "auto",
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text    = Strings.WarningMessageOnUpdateAnswer,
                                        Wrap    = true,
                                        Size    = AdaptiveTextSize.Small,
                                        Spacing = AdaptiveSpacing.None,
                                    },
                                },
                            },
                        },
                    });

                    if (showValidationErrors)
                    {
                        card.Actions.Add(new AdaptiveSubmitAction
                        {
                            Title = Strings.SubmitResponseButtonText,
                            Data  = new UpdateTicketResponsePayload
                            {
                                TicketId = this.Ticket.TicketId,
                                Action   = UpdateTicketResponsePayload.UpdateResponseAction,
                            },
                        });
                    }
                }
            }

            return(new Attachment
            {
                ContentType = AdaptiveCard.ContentType,
                Content = card,
            });
        }