Exemplo n.º 1
0
        /// <summary>
        /// Card to show confirmation on selecting withdraw action.
        /// </summary>
        /// <param name="onCallSupportDetails"> Collection of class containing details of on call support team.</param>
        /// <param name="localizer">The current cultures' string localizer.</param>
        /// <returns>An attachment with confirmation(yes/no)card.</returns>
        public static AdaptiveCard OnCallSMEUpdateHistoryCard(IEnumerable <OnCallSupportDetail> onCallSupportDetails, IStringLocalizer <Strings> localizer)
        {
            AdaptiveContainer container = new AdaptiveContainer();

            if (onCallSupportDetails != null && onCallSupportDetails.Any())
            {
                foreach (var onCallSupportDetail in onCallSupportDetails)
                {
                    AdaptiveColumnSet columnSet = new AdaptiveColumnSet
                    {
                        Columns = new List <AdaptiveColumn>
                        {
                            new AdaptiveColumn
                            {
                                Width = "1",
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text = onCallSupportDetail.ModifiedByName,
                                        Size = AdaptiveTextSize.Medium,
                                    },
                                },
                            },
                            new AdaptiveColumn
                            {
                                Width = "1",
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text = CardHelper.AdaptiveTextParseWithDateTime(onCallSupportDetail.ModifiedOn?.ToString(CultureInfo.InvariantCulture)),
                                        Size = AdaptiveTextSize.Medium,
                                    },
                                },
                            },
                        },
                    };

                    container.Items.Add(columnSet);
                }
            }
            else
            {
                container.Items.Add(new AdaptiveTextBlock
                {
                    Text   = localizer.GetString("NoUpdateHistoryText"),
                    Weight = AdaptiveTextWeight.Bolder,
                    Size   = AdaptiveTextSize.Medium,
                });
            }

            AdaptiveCard onCallSupportUpdateHistoryCard = new AdaptiveCard(Constants.AdaptiveCardVersion)
            {
                Body = new List <AdaptiveElement>
                {
                    new AdaptiveColumnSet
                    {
                        Columns = new List <AdaptiveColumn>
                        {
                            new AdaptiveColumn
                            {
                                Width = "5",
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text   = localizer.GetString("NameTitleText"),
                                        Weight = AdaptiveTextWeight.Bolder,
                                        Size   = AdaptiveTextSize.Medium,
                                    },
                                },
                            },
                            new AdaptiveColumn
                            {
                                Width = "5",
                                Items = new List <AdaptiveElement>
                                {
                                    new AdaptiveTextBlock
                                    {
                                        Text   = localizer.GetString("DatetimeTitleText"),
                                        Weight = AdaptiveTextWeight.Bolder,
                                        Size   = AdaptiveTextSize.Medium,
                                    },
                                },
                            },
                        },
                    },

                    container,
                },
            };

            return(onCallSupportUpdateHistoryCard);
        }