コード例 #1
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);
        }
コード例 #2
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);
        }
        /// <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);
        }