Example #1
0
        // Helps create an O365 actionable message for a particular task.
        public static O365ConnectorCard CreateCardForInterviewRequest(InterviewRequest request)
        {
            var random = new Random();

            O365ConnectorCard actionableCard = new O365ConnectorCard()
            {
                Sections = new List <O365ConnectorCardSection>()
            };

            O365ConnectorCardSection section = new O365ConnectorCardSection()
            {
                ActivityTitle    = request.Candidate.Name,
                ActivitySubtitle = $"For position: {request.PositionTitle}",
                ActivityText     = $"Req ID: {request.ReqId}",
                ActivityImage    = request.Candidate.ProfilePicture,
                PotentialAction  = new List <O365ConnectorCardActionBase>()
            };

            // Add a more complex form action
            O365ConnectorCardActionCard updateDateAction = new O365ConnectorCardActionCard(type: "ActionCard")
            {
                Id      = "updateInterviewDate",
                Name    = "Set interview date",
                Actions = new List <O365ConnectorCardActionBase>(),
                Inputs  = new List <O365ConnectorCardInputBase>()
            };

            updateDateAction.Actions.Add(new O365ConnectorCardHttpPOST("HttpPOST", "Schedule", "scheduleInterview", request.ReqId));
            updateDateAction.Inputs.Add(new O365ConnectorCardDateInput("DateInput", "interviewDate", false, "Interview date", new DateTime(DateTime.Today.Year, DateTime.Today.Month, DateTime.Today.Day).ToString("MMM d, yyyy"), false));
            section.PotentialAction.Add(updateDateAction);

            actionableCard.Sections.Add(section);

            return(actionableCard);
        }
        public void O365ConnectorCardActionCardInitsWithNoArgs()
        {
            var o365ConnectorCardActionCard = new O365ConnectorCardActionCard();

            Assert.NotNull(o365ConnectorCardActionCard);
            Assert.IsType <O365ConnectorCardActionCard>(o365ConnectorCardActionCard);
        }
Example #3
0
        public static Attachment GetCardsInformation(IEnumerable <Industry> industriesList)
        {
            var list = new List <O365ConnectorCardMultichoiceInputChoice>();

            foreach (var industry in industriesList)
            {
                list.Add(new O365ConnectorCardMultichoiceInputChoice(industry.IndustryName, industry.IndsutryCode));
            }


            var section = new O365ConnectorCardSection
            {
                ActivityTitle = "A peek into inventory across locations across products.",
            };


            var IndustryInfo = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Show Inventory",
                "Multiple Choice Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "Industry",
                    true,
                    "Industry Ex: Airline, Retail",
                    null,
                    list,
                    "compact",
                    false),
            },


                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Industry",
                    Constants.Industry,
                    @"{""Value"":""{{Industry.value}}""}")
            });


            O365ConnectorCard card = new O365ConnectorCard()
            {
                ThemeColor = "#E67A9E",
                Title      = "Inventory Information",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    IndustryInfo
                }
            };

            return(card.ToAttachment());
        }
Example #4
0
        public static Attachment GetCardsInformation()
        {
            var section = new O365ConnectorCardSection
            {
                ActivityTitle = "Your one stop destination to managing your fleet",
            };


            var AirCraftInfo = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Show me aircraft details",
                "Multiple Choice Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "flightNumberInput",
                    true,
                    "Enter flight number Ex: 320,777,220",
                    null,
                    false,
                    null),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "baselocationInput",
                    true,
                    "Enter Base Location Ex: Seattle",
                    null,
                    false,
                    null)
            },


                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show me aircraft details",
                    Constants.ShowAirCraftDetails,
                    @"{""FlightNumber"":""{{flightNumberInput.value}}"", ""BaseLocation"":""{{baselocationInput.value}}""}")
            });

            O365ConnectorCard card = new O365ConnectorCard()
            {
                ThemeColor = "#E67A9E",
                Title      = "Fleet Management",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    AirCraftInfo
                }
            };

            return(card.ToAttachment());
        }
Example #5
0
        public static O365ConnectorCard GetO365ConnectorCardResult(Baggage baggage)
        {
            var section = new O365ConnectorCardSection
            {
                ActivityTitle    = $"Name: **{baggage.Name}**",
                ActivitySubtitle = $"Ticket: **{baggage.TicketNo}**    PNR: **{baggage.PNR}**",
                ActivityImage    = "https://airlinebaggage.azurewebsites.net/resources/" + SplitName(baggage.Name) + ".jpg",
                Facts            = new List <O365ConnectorCardFact>
                {
                    new O365ConnectorCardFact("From", baggage.From),
                    new O365ConnectorCardFact("To", baggage.To),
                    new O365ConnectorCardFact("Number of Checked in Bags", baggage.BagCount.ToString()),
                    new O365ConnectorCardFact("Current Status", baggage.CurrentStatus),
                    new O365ConnectorCardFact("Baggage Identifer Number", baggage.BaggageIdentifer.ToString())
                }
            };
            var RebookingCard1 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Rebook Baggage",
                "PNR",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "flightNumberInput",
                    true,
                    "Enter new flight number (Ex: 220, 350, 787)",
                    null,
                    false,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Rebook",
                    Constants.RebookBaggage,
                    @"{""flightNumberInput"":""{{flightNumberInput.value}}""/*, ""pnrNumberInput"": ""{{pnrNumberInput.value}}""*/}")
            });
            O365ConnectorCard card = new O365ConnectorCard()
            {
                Title      = "Baggage Details",
                ThemeColor = "#E67A9E",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    RebookingCard1,
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Report Missing", Constants.ReportMissing, baggage.PNR)
                }
            };

            return(card);
        }
Example #6
0
        public static O365ConnectorCard GetO365ConnectorCardResult(FlightInfo flight)
        {
            var section = new O365ConnectorCardSection
            {
                ActivityTitle    = $"Flight number: **{flight.FlightNumber}**",
                ActivitySubtitle = $"PNR: **{flight.PNR}**",
                ActivityImage    = "https://flightinfobot.azurewebsites.net/resources/Airline-Flight-Bot-03.png",
                Facts            = new List <O365ConnectorCardFact>
                {
                    new O365ConnectorCardFact("From", flight.FromCity),
                    new O365ConnectorCardFact("To", flight.ToCity),
                    new O365ConnectorCardFact("Date of Journey", flight.JourneyDate.ToShortDateString())
                }
            };
            var PNRNumberCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Rebook the Passenger",
                "PNR",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "pnrNumberInput",
                    true,
                    "Enter PNR number",
                    null,
                    false,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Rebook the Passenger",
                    Constants.Rebook,
                    @"{""pnrNumberInput"":""{{pnrNumberInput.value}}"", ""flightNumberInput"":" + flight.FlightNumber + " }")
            });



            O365ConnectorCard card = new O365ConnectorCard()
            {
                Title      = "Rebook Passenger",
                ThemeColor = "#E67A9E",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    PNRNumberCard
                }
            };

            return(card);
        }
Example #7
0
        public static O365ConnectorCard GetO365ConnectorCard(Baggage baggage)
        {
            var section = new O365ConnectorCardSection
            {
                ActivityTitle    = $"Name: **{baggage.Name}**",
                ActivitySubtitle = $"Ticket: **{baggage.TicketNo}**    PNR: **{baggage.PNR}**",
                ActivityImage    = "https://airlinebaggage.azurewebsites.net/resources/" + SplitName(baggage.Name) + ".jpg"
            };

            var RebookingCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Rebook Baggage",
                "PNR",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "flightNumberInput",
                    true,
                    "Enter new flight number(Ex: 220, 350, 787)",
                    null,
                    false,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Rebook",
                    Constants.RebookBaggage,
                    @"{""flightNumberInput"":""{{flightNumberInput.value}}""/*, ""pnrNumberInput"": ""{{pnrNumberInput.value}}""*/}")
            });
            O365ConnectorCard card = new O365ConnectorCard()
            {
                Title      = "What do you want to do?",
                ThemeColor = "#E67A9E",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Show Baggage Details", Constants.CurrentStatus, $"{{'Value':'{baggage.PNR}'}}"),
                    RebookingCard,
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Report Missing", Constants.ReportMissing, baggage.PNR)
                }
            };

            return(card);
        }
        public void O365ConnectorCardActionCardInits()
        {
            var name   = "Set due date";
            var id     = "dueDate";
            var inputs = new List <O365ConnectorCardInputBase>()
            {
                new O365ConnectorCardInputBase("dateInput")
            };
            var actions = new List <O365ConnectorCardActionBase>()
            {
                new O365ConnectorCardActionBase("ActionCard")
            };

            var o365ConnectorCardActionCard = new O365ConnectorCardActionCard("ActionCard", name, id, inputs, actions);

            Assert.NotNull(o365ConnectorCardActionCard);
            Assert.IsType <O365ConnectorCardActionCard>(o365ConnectorCardActionCard);
            Assert.Equal(name, o365ConnectorCardActionCard.Name);
            Assert.Equal(id, o365ConnectorCardActionCard.Id);
            Assert.Equal(inputs, o365ConnectorCardActionCard.Inputs);
            Assert.Equal(actions, o365ConnectorCardActionCard.Actions);
        }
Example #9
0
        public Attachment GetFilter()
        {
            var section = new O365ConnectorCardSection("Your Passport to Airline Services from within Microsoft Teams", "Use PassengerInfoBot to do the following:\n<ul>\n<li>List <strong>passengers & their profiles</strong> for this flight</li>\n<li>List <strong>frequest flyers</strong> to serve them best</li>\n<li>Locate passengers with <strong>special assistance</strong>  needs</li>\n<li>Get all <strong>passengers seated in a specific zone</strong></li>\n<li>Find out <strong>who is seated</strong> at a specific location</li>\n</ul>\n\n\n\n", null, null, null, null);

            var classWiseCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Class",
                "classWiseCard",
                new List <O365ConnectorCardInputBase>
            {
                new  O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "class",
                    true,
                    "Select class",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Business", "Business"),
                    new O365ConnectorCardMultichoiceInputChoice("Economy", "Economy")
                },
                    "compact"
                    , false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show",
                    Constants.ClassWise,
                    @"{""Value"":""{{class.value}}""}")
            });

            var zoneWiseCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Passengers by Zone",
                "zoneWiseCard",
                new List <O365ConnectorCardInputBase>
            {
                new  O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "zone",
                    true,
                    "Select Zone",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("A", "A"),
                    new O365ConnectorCardMultichoiceInputChoice("B", "B"),
                    new O365ConnectorCardMultichoiceInputChoice("C", "C")
                },
                    "compact"
                    , false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show",
                    Constants.Zone,
                    @"{""Value"":""{{zone.value}}""}")
            });

            var seatNumberCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Passenger by Seat #",
                "seatNumber",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "seatNumberInput",
                    true,
                    "Enter Seat Number",
                    null,
                    false,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show",
                    Constants.SeatNumber,
                    @"{""Value"":""{{seatNumberInput.value}}""}")
            });

            O365ConnectorCard card = new O365ConnectorCard()
            {
                ThemeColor = "#E67A9E",
                Title      = "Welcome to PassengerInfoBot",
                Summary    = "",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "See All Passengers", Constants.All),
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "See Frequent Flyers", Constants.FrequentFlyer),
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Passengers with Special Assistance", Constants.SpecialAssistance),
                    zoneWiseCard,
                    seatNumberCard,
                    classWiseCard,
                }
            };

            return(card.ToAttachment());
        }
Example #10
0
        public static Attachment GetFilter(string email)
        {
            var section = new O365ConnectorCardSection("Please select the option below to create Team");

            // "C:\Users\v-washai\Downloads\Picture1.png"
            // var heroImage = new O365ConnectorCardSection(null, null, null, null, null, "");

            var inputs = new List <O365ConnectorCardMultichoiceInputChoice>();

            foreach (var member in MessagesController.GetMemberList(email))
            {
                inputs.Add(new O365ConnectorCardMultichoiceInputChoice(member.Split('@').First(), member));
            }

            var memberSelection = new O365ConnectorCardMultichoiceInput(
                O365ConnectorCardMultichoiceInput.Type,
                "members",
                true,
                "Select Team Members",
                null,
                inputs
                ,
                "compact"
                , true);

            var createCustomTeam = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Create Custom Team",
                "createCustomTeam",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "teamName",
                    true,
                    "Enter Team Name",
                    null,
                    false,
                    null),
                memberSelection
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Create Team",
                    "Custom",
                    @"{""TeamName"":""{{teamName.value}}"", ""Members"":""{{members.value}}""}")
            });

            var createTeamForFlight = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Create Team for Upcoming Flight",
                "flightWiseTeam",
                new List <O365ConnectorCardInputBase>
            {
                new  O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "flight",
                    true,
                    "Select flight",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("783", "783"),
                    new O365ConnectorCardMultichoiceInputChoice("784", "784"),
                    new O365ConnectorCardMultichoiceInputChoice("785", "785")
                },
                    "compact"
                    , false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Create Team",
                    "Flight",
                    @"{""Value"":""{{flight.value}}""}")
            });


            O365ConnectorCard card = new O365ConnectorCard()
            {
                ThemeColor = "#E67A9E",
                Title      = "Welcome to FlightTeamCreationBot.",
                Summary    = "",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    createTeamForFlight,
                    createCustomTeam
                }
            };

            return(card.ToAttachment());
        }
Example #11
0
        /// <summary>
        /// Create a sample O365 connector card.
        /// </summary>
        /// <returns>The result card with actions.</returns>
        private static O365ConnectorCard CreateSampleO365ConnectorCard()
        {
            var actionCard1 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Multiple Choice",
                "card-1",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-1",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice 1", "1"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 2", "2"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 3", "3")
                },
                    "expanded",
                    true),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-2",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice 4", "4"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 5", "5"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 6", "6")
                },
                    "compact",
                    true),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-3",
                    false,
                    "Pick an option",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice a", "a"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice b", "b"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice c", "c")
                },
                    "expanded",
                    false),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-4",
                    false,
                    "Pick an option",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice x", "x"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice y", "y"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice z", "z")
                },
                    "compact",
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "card-1-btn-1",
                    @"{""list1"":""{{list-1.value}}"", ""list2"":""{{list-2.value}}"", ""list3"":""{{list-3.value}}"", ""list4"":""{{list-4.value}}""}")
            });

            var actionCard2 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Text Input",
                "card-2",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-1",
                    false,
                    "multiline, no maxLength",
                    null,
                    true,
                    null),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-2",
                    false,
                    "single line, no maxLength",
                    null,
                    false,
                    null),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-3",
                    true,
                    "multiline, max len = 10, isRequired",
                    null,
                    true,
                    10),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-4",
                    true,
                    "single line, max len = 10, isRequired",
                    null,
                    false,
                    10)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "card-2-btn-1",
                    @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}")
            });

            var actionCard3 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Date Input",
                "card-3",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "date-1",
                    true,
                    "date with time",
                    null,
                    true),
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "date-2",
                    false,
                    "date only",
                    null,
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "card-3-btn-1",
                    @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}")
            });

            var section = new O365ConnectorCardSection(
                "**section title**",
                "section text",
                "activity title",
                "activity subtitle",
                "activity text",
                "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
                true,
                new List <O365ConnectorCardFact>
            {
                new O365ConnectorCardFact("Fact name 1", "Fact value 1"),
                new O365ConnectorCardFact("Fact name 2", "Fact value 2"),
            },
                new List <O365ConnectorCardImage>
            {
                new O365ConnectorCardImage
                {
                    Image = "http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg",
                    Title = "image 1"
                },
                new O365ConnectorCardImage
                {
                    Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg",
                    Title = "image 2"
                },
                new O365ConnectorCardImage
                {
                    Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg",
                    Title = "image 3"
                }
            });

            O365ConnectorCard card = new O365ConnectorCard()
            {
                Summary    = "O365 card summary",
                ThemeColor = "#E67A9E",
                Title      = "card title",
                Text       = "card text",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    actionCard1,
                    actionCard2,
                    actionCard3,
                    new O365ConnectorCardViewAction(
                        O365ConnectorCardViewAction.Type,
                        "View Action",
                        null,
                        new List <string>
                    {
                        "http://microsoft.com"
                    }),
                    new O365ConnectorCardOpenUri(
                        O365ConnectorCardOpenUri.Type,
                        "Open Uri",
                        "open-uri",
                        new List <O365ConnectorCardOpenUriTarget>
                    {
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "default",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "iOS",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "android",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "windows",
                            Uri = "http://microsoft.com"
                        }
                    })
                }
            };

            return(card);
        }
Example #12
0
        public static Attachment GetCardsInformation(IEnumerable <Cities> citieslist)
        {
            var list = new List <O365ConnectorCardMultichoiceInputChoice>();

            foreach (var city in citieslist)
            {
                list.Add(new O365ConnectorCardMultichoiceInputChoice(city.CityName, city.CityCode));
            }


            var section = new O365ConnectorCardSection
            {
                ActivityTitle = "Your one stop for all flight details",
            };


            var FlightInfo = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Show Flights",
                "Multiple Choice Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "From",
                    true,
                    "From Ex: Seattle",
                    null,
                    list,
                    "compact",
                    false),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "To",
                    true,
                    "To Ex: Newark",
                    null,
                    list,
                    "compact",
                    false),
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "journeyDate",
                    true,
                    "Journey Date Ex: 30 Dec 2018",
                    null,
                    false)
            },


                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show flights",
                    Constants.ShowFlights,
                    @"{""From"":""{{From.value}}"", ""To"":""{{To.value}}"" , ""JourneyDate"":""{{journeyDate.value}}"" }")
            });


            O365ConnectorCard card = new O365ConnectorCard()
            {
                ThemeColor = "#E67A9E",
                Title      = "Flight Information",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    FlightInfo
                }
            };

            return(card.ToAttachment());
        }
        public static O365ConnectorCard GetConnectorCard()
        {
            var section = new O365ConnectorCardSection(
                null,
                null,
                null,
                null,
                null,
                null,
                true,
                new List <O365ConnectorCardFact>
            {
                new O365ConnectorCardFact("Gmail", "All your gmail actions in Teams"),
                new O365ConnectorCardFact("Wiki", "Know all the facts around the world"),
                new O365ConnectorCardFact("VSTS", "Know all your task details"),
            });

            var actionCard1 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Run This Command",
                "card-1",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-1",
                    false,
                    "Select Command",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Gmail", "gmail"),
                    new O365ConnectorCardMultichoiceInputChoice("Wiki", "wiki"),
                    new O365ConnectorCardMultichoiceInputChoice("VSTS", "vsts")
                },
                    "compact",
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Run",
                    "card-1-btn-1",
                    @"{""list1"":""{{list-1.value}}""}")
            });

            var actionCard2 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Know this Command",
                "card-2",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-2",
                    false,
                    "Select Command",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Gmail", "gmail"),
                    new O365ConnectorCardMultichoiceInputChoice("Wiki", "wiki"),
                    new O365ConnectorCardMultichoiceInputChoice("VSTS", "vsts")
                },
                    "compact",
                    false),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-3",
                    false,
                    "Select Command -2",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Gmail-2", "gmail"),
                    new O365ConnectorCardMultichoiceInputChoice("Wiki-2", "wiki"),
                    new O365ConnectorCardMultichoiceInputChoice("VSTS-2", "vsts")
                },
                    "compact",
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show help",
                    "card-2-btn-2",
                    @"{""list2"":""{{list-2.value}}"",""list3"":""{{list-3.value}}""}")
            });

            O365ConnectorCard card = new O365ConnectorCard()
            {
                Summary    = "O365 card summary",
                ThemeColor = "#E67A9E",
                Title      = "Supported commands:",
                Text       = "These are all your integrations:",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    actionCard1,
                    actionCard2
                }
            };

            return(card);
        }
Example #14
0
        public void CardTests_O365ConnectorCard()
        {
            var actionCard1 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Multiple Choice",
                "card-1",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-1",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice 1", "1"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 2", "2"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 3", "3")
                },
                    "expanded",
                    true),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-2",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice 4", "4"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 5", "5"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice 6", "6")
                },
                    "compact",
                    true),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-3",
                    false,
                    "Pick an option",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice a", "a"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice b", "b"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice c", "c")
                },
                    "expanded",
                    false),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "list-4",
                    false,
                    "Pick an option",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Choice x", "x"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice y", "y"),
                    new O365ConnectorCardMultichoiceInputChoice("Choice z", "z")
                },
                    "compact",
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "card-1-btn-1",
                    @"{""list1"":""{{list-1.value}}"", ""list2"":""{{list-2.value}}"", ""list3"":""{{list-3.value}}"", ""list4"":""{{list-4.value}}""}")
            });

            var actionCard2 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Text Input",
                "card-2",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-1",
                    false,
                    "multiline, no maxLength",
                    null,
                    true,
                    null),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-2",
                    false,
                    "single line, no maxLength",
                    null,
                    false,
                    null),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-3",
                    true,
                    "multiline, max len = 10, isRequired",
                    null,
                    true,
                    10),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-4",
                    true,
                    "single line, max len = 10, isRequired",
                    null,
                    false,
                    10)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "card-2-btn-1",
                    @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}")
            });

            var actionCard3 = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Date Input",
                "card-3",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "date-1",
                    true,
                    "date with time",
                    null,
                    true),
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "date-2",
                    false,
                    "date only",
                    null,
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "card-3-btn-1",
                    @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}")
            });

            var section = new O365ConnectorCardSection(
                "This is the **section's title** property",
                "This is the section's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                "This is the section's activityTitle property",
                "This is the section's activitySubtitle property",
                "This is the section's activityText property.",
                "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
                "avatar",
                true,
                new List <O365ConnectorCardFact>()
            {
                new O365ConnectorCardFact("This is a fact name", "This is a fact value"),
                new O365ConnectorCardFact("This is a fact name", "This is a fact value"),
                new O365ConnectorCardFact("This is a fact name", "This is a fact value")
            },
                new List <O365ConnectorCardImage>()
            {
                new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg"),
                new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg"),
                new O365ConnectorCardImage("http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg")
            },
                new List <O365ConnectorCardActionBase>()
            {
                new O365ConnectorCardViewAction(
                    O365ConnectorCardViewAction.Type,
                    "View",
                    null,
                    new List <string>()
                {
                    "http://microsoft.com"
                }),
                new O365ConnectorCardViewAction(
                    O365ConnectorCardViewAction.Type,
                    "View",
                    null,
                    new List <string>()
                {
                    "http://microsoft.com"
                }),
            });

            O365ConnectorCard card = new O365ConnectorCard()
            {
                Summary    = "This is the summary property",
                ThemeColor = "E81123",
                Title      = "This is the card title property",
                Text       = "This is the card's text property. Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    actionCard1,
                    actionCard2,
                    actionCard3,
                    new O365ConnectorCardViewAction(
                        O365ConnectorCardViewAction.Type,
                        "View Action",
                        null,
                        new List <string>
                    {
                        "http://microsoft.com"
                    }),
                    new O365ConnectorCardOpenUri(
                        O365ConnectorCardOpenUri.Type,
                        "Open Uri",
                        "open-uri",
                        new List <O365ConnectorCardOpenUriTarget>
                    {
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "default",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "iOS",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "android",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "windows",
                            Uri = "http://microsoft.com"
                        }
                    })
                }
            };

            this.TestCard(new Attachment
            {
                Content     = card,
                ContentType = O365ConnectorCard.ContentType
            });
        }
Example #15
0
        /// <summary>
        /// Create a sample O365 connector card.
        /// </summary>
        /// <returns>The result card with actions.</returns>
        ///
        public static Attachment CreateSampleO365ConnectorCard(string baseUri)
        {
            string imageUrl = baseUri + "/public/assets/ActionableCardIconImage.png";

            #region Multichoice Card
            var multichoiceCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Multiple Choice",
                "Multiple Choice Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "CardsType",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"),
                    new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"),
                    new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card")
                },
                    "expanded",
                    true),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "Teams",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Bot", "Bot"),
                    new O365ConnectorCardMultichoiceInputChoice("Tab", "Tab"),
                    new O365ConnectorCardMultichoiceInputChoice("Connector", "Connector"),
                    new O365ConnectorCardMultichoiceInputChoice("Compose Extension", "Compose Extension")
                },
                    "compact",
                    true)
            },

                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST
                (
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "multichoice",
                    @"{""CardsType"":""{{CardsType.value}}"", ""Teams"":""{{Teams.value}}""}")
            });

            #endregion

            #region Input Card
            var inputCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Text Input",
                "Input Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-1",
                    false,
                    "multiline, no maxLength",
                    null,
                    true,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "inputText",
                    @"{""text1"":""{{text-1.value}}""}")
            });
            #endregion

            #region Date Card
            var dateCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Date Input",
                "Date Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "date-2",
                    false,
                    "date only",
                    null,
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "dateInput",
                    @"{""date1"":""{{date-1.value}}""")
            });
            #endregion

            var section = new O365ConnectorCardSection
            {
                Title             = "",
                Text              = "",
                ActivityTitle     = "Actionable Message",
                ActivitySubtitle  = "",
                ActivityText      = "This is an actionable message card. You can add operations within the card.",
                ActivityImage     = imageUrl,
                ActivityImageType = null,
                Markdown          = true,
                Facts             = null,
                Images            = null
            };

            O365ConnectorCard card = new O365ConnectorCard()
            {
                Summary    = "O365 card summary",
                ThemeColor = "#E67A9E",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },

                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    multichoiceCard,
                    inputCard,
                    dateCard
                }
            };

            return(card.ToAttachment());
        }
Example #16
0
        /// <summary>
        /// Create a sample O365 connector card.
        /// </summary>
        /// <returns>The result card with actions.</returns>
        ///
        public static Attachment CreateSampleO365ConnectorCard()
        {
            #region Multichoice Card
            var multichoiceCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Multiple Choice",
                "Multiple Choice Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "CardsType",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"),
                    new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"),
                    new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card")
                },
                    "expanded",
                    true),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "Teams",
                    true,
                    "Pick multiple options",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Bot", "Bot"),
                    new O365ConnectorCardMultichoiceInputChoice("Tab", "Tab"),
                    new O365ConnectorCardMultichoiceInputChoice("Connector", "Connector"),
                    new O365ConnectorCardMultichoiceInputChoice("Compose Extension", "Compose Extension")
                },
                    "compact",
                    true),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "Apps",
                    false,
                    "Pick an App",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("VSTS", "VSTS"),
                    new O365ConnectorCardMultichoiceInputChoice("Wiki", "Wiki"),
                    new O365ConnectorCardMultichoiceInputChoice("Github", "Github")
                },
                    "expanded",
                    false),
                new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "OfficeProduct",
                    false,
                    "Pick an Office Product",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Outlook", "Outlook"),
                    new O365ConnectorCardMultichoiceInputChoice("MS Teams", "MS Teams"),
                    new O365ConnectorCardMultichoiceInputChoice("Skype", "Skype")
                },
                    "compact",
                    false)
            },

                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "multichoice",
                    @"{""CardsType"":""{{CardsType.value}}"", ""Teams"":""{{Teams.value}}"", ""Apps"":""{{Apps.value}}"", ""OfficeProduct"":""{{OfficeProduct.value}}""}")
            });

            #endregion

            #region Input Card
            var inputCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Text Input",
                "Input Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-1",
                    false,
                    "multiline, no maxLength",
                    null,
                    true,
                    null),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-2",
                    false,
                    "single line, no maxLength",
                    null,
                    false,
                    null),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-3",
                    true,
                    "multiline, max len = 10, isRequired",
                    null,
                    true,
                    10),
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "text-4",
                    true,
                    "single line, max len = 10, isRequired",
                    null,
                    false,
                    10)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "inputText",
                    @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}")
            });
            #endregion

            #region Date Card
            var dateCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Date Input",
                "Date Card",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "date-1",
                    true,
                    "date with time",
                    null,
                    true),
                new O365ConnectorCardDateInput(
                    O365ConnectorCardDateInput.Type,
                    "date-2",
                    false,
                    "date only",
                    null,
                    false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Send",
                    "dateInput",
                    @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}")
            });
            #endregion

            var section = new O365ConnectorCardSection(
                "**section title**",
                "section text",
                "activity title",
                "activity subtitle",
                "activity text",
                "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
                true,
                new List <O365ConnectorCardFact>
            {
                new O365ConnectorCardFact("Fact name 1", "Fact value 1"),
                new O365ConnectorCardFact("Fact name 2", "Fact value 2"),
            },
                new List <O365ConnectorCardImage>
            {
                new O365ConnectorCardImage
                {
                    Image = "http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg",
                    Title = "image 1"
                },
                new O365ConnectorCardImage
                {
                    Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg",
                    Title = "image 2"
                },
                new O365ConnectorCardImage
                {
                    Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg",
                    Title = "image 3"
                }
            });

            O365ConnectorCard card = new O365ConnectorCard()
            {
                Summary    = "O365 card summary",
                ThemeColor = "#E67A9E",
                Title      = "card title",
                Text       = "card text",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    multichoiceCard,
                    inputCard,
                    dateCard,
                    new O365ConnectorCardViewAction(
                        O365ConnectorCardViewAction.Type,
                        "View Action",
                        null,
                        new List <string>
                    {
                        "http://microsoft.com"
                    }),
                    new O365ConnectorCardOpenUri(
                        O365ConnectorCardOpenUri.Type,
                        "Open Uri",
                        "open-uri",
                        new List <O365ConnectorCardOpenUriTarget>
                    {
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "default",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "iOS",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "android",
                            Uri = "http://microsoft.com"
                        },
                        new O365ConnectorCardOpenUriTarget
                        {
                            Os  = "windows",
                            Uri = "http://microsoft.com"
                        }
                    })
                }
            };

            return(card.ToAttachment());
        }
        /// <summary>
        /// this is the default example's content
        /// multiple choice (compact & expanded), text input, date and placing images in card
        /// </summary>
        /// <returns>The result card with actions.</returns>
        ///
        public static Attachment O365ActionableCardDefault()
        {
            #region multi choice examples

            var multichoice = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type)
            {
                Name   = "Multiple Choice",
                Id     = "Multiple Choice Card",
                Inputs = new List <O365ConnectorCardInputBase>
                {
                    // multiple choice control with required, multiselect, expanded style
                    new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type)
                    {
                        Id         = "CardsType",
                        IsRequired = true,
                        Title      = "Pick multiple options",
                        Value      = null,
                        Choices    = new List <O365ConnectorCardMultichoiceInputChoice>
                        {
                            new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"),
                            new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"),
                            new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card")
                        },
                        Style         = "expanded",
                        IsMultiSelect = true
                    },
                    // multiple choice control with required, multiselect, compact style
                    new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type)
                    {
                        Id         = "Teams",
                        IsRequired = true,
                        Title      = "Pick multiple options",
                        Value      = null,
                        Choices    = new List <O365ConnectorCardMultichoiceInputChoice>
                        {
                            new O365ConnectorCardMultichoiceInputChoice("Bot", "Bot"),
                            new O365ConnectorCardMultichoiceInputChoice("Tab", "Tab"),
                            new O365ConnectorCardMultichoiceInputChoice("Connector", "Connector"),
                            new O365ConnectorCardMultichoiceInputChoice("Compose Extension", "Compose Extension")
                        },
                        Style         = "compact",
                        IsMultiSelect = true
                    },
                    // multiple choice control with single item select, expanded style
                    new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type)
                    {
                        Id         = "Apps",
                        IsRequired = false,
                        Title      = "Pick an App",
                        Value      = null,
                        Choices    = new List <O365ConnectorCardMultichoiceInputChoice>
                        {
                            new O365ConnectorCardMultichoiceInputChoice("VSTS", "VSTS"),
                            new O365ConnectorCardMultichoiceInputChoice("Wiki", "Wiki"),
                            new O365ConnectorCardMultichoiceInputChoice("Github", "Github")
                        },
                        Style         = "expanded",
                        IsMultiSelect = false
                    },
                    // multiple choice control with single item select, compact style
                    new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type)
                    {
                        Id         = "OfficeProduct",
                        IsRequired = false,
                        Title      = "Pick an Office Product",
                        Value      = null,
                        Choices    = new List <O365ConnectorCardMultichoiceInputChoice>
                        {
                            new O365ConnectorCardMultichoiceInputChoice("Outlook", "Outlook"),
                            new O365ConnectorCardMultichoiceInputChoice("MS Teams", "MS Teams"),
                            new O365ConnectorCardMultichoiceInputChoice("Skype", "Skype")
                        },
                        Style         = "compact",
                        IsMultiSelect = false
                    }
                },

                Actions = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type)
                    {
                        Name = "Send",
                        Id   = "multichoice",
                        Body = @"{""CardsType"":""{{CardsType.value}}"", ""Teams"":""{{Teams.value}}"", ""Apps"":""{{Apps.value}}"", ""OfficeProduct"":""{{OfficeProduct.value}}""}"
                    }
                }
            };

            #endregion

            #region text input examples
            var inputCard = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type)
            {
                Name   = "Text Input",
                Id     = "Input Card",
                Inputs = new List <O365ConnectorCardInputBase>
                {
                    // text input control with multiline
                    new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type)
                    {
                        Id          = "text-1",
                        IsRequired  = false,
                        Title       = "multiline, no maxLength",
                        Value       = null,
                        IsMultiline = true,
                        MaxLength   = null
                    },
                    // text input control without multiline
                    new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type)
                    {
                        Id          = "text-2",
                        IsRequired  = false,
                        Title       = "single line, no maxLength",
                        Value       = null,
                        IsMultiline = false,
                        MaxLength   = null
                    },
                    // text input control with multiline, reuired,
                    // and control the length of input box
                    new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type)
                    {
                        Id          = "text-3",
                        IsRequired  = true,
                        Title       = "multiline, max len = 10, isRequired",
                        Value       = null,
                        IsMultiline = true,
                        MaxLength   = 10
                    },
                    // text input control without multiline, reuired,
                    // and control the length of input box
                    new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type)
                    {
                        Id          = "text-4",
                        IsRequired  = true,
                        Title       = "single line, max len = 10, isRequired",
                        Value       = null,
                        IsMultiline = false,
                        MaxLength   = 10
                    }
                },
                Actions = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type)
                    {
                        Name = "Send",
                        Id   = "inputText",
                        Body = @"{""text1"":""{{text-1.value}}"", ""text2"":""{{text-2.value}}"", ""text3"":""{{text-3.value}}"", ""text4"":""{{text-4.value}}""}"
                    }
                }
            };
            #endregion

            #region date/time input examples
            var dateCard = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type)
            {
                Name   = "Date Input",
                Id     = "Date Card",
                Inputs = new List <O365ConnectorCardInputBase>
                {
                    // date input control, with date and time, required
                    new O365ConnectorCardDateInput(O365ConnectorCardDateInput.Type)
                    {
                        Id          = "date-1",
                        IsRequired  = true,
                        Title       = "date with time",
                        Value       = null,
                        IncludeTime = true
                    },
                    // date input control, only date, no time, not required
                    new O365ConnectorCardDateInput(O365ConnectorCardDateInput.Type)
                    {
                        Id          = "date-2",
                        IsRequired  = false,
                        Title       = "date only",
                        Value       = null,
                        IncludeTime = false
                    }
                },
                Actions = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type)
                    {
                        Name = "Send",
                        Id   = "dateInput",
                        Body = @"{""date1"":""{{date-1.value}}"", ""date2"":""{{date-2.value}}""}"
                    }
                }
            };
            #endregion

            var section = new O365ConnectorCardSection
            {
                Title             = "**section title**",
                Text              = "section text",
                ActivityTitle     = "activity title",
                ActivitySubtitle  = "activity subtitle",
                ActivityText      = "activity text",
                ActivityImage     = "http://connectorsdemo.azurewebsites.net/images/MSC12_Oscar_002.jpg",
                ActivityImageType = null,
                Markdown          = true,
                Facts             = new List <O365ConnectorCardFact>
                {
                    new O365ConnectorCardFact
                    {
                        Name  = "Fact name 1",
                        Value = "Fact value 1"
                    },
                    new O365ConnectorCardFact
                    {
                        Name  = "Fact name 2",
                        Value = "Fact value 2"
                    },
                },
                Images = new List <O365ConnectorCardImage>
                {
                    new O365ConnectorCardImage
                    {
                        Image = "http://connectorsdemo.azurewebsites.net/images/MicrosoftSurface_024_Cafe_OH-06315_VS_R1c.jpg",
                        Title = "image 1"
                    },
                    new O365ConnectorCardImage
                    {
                        Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Scene_01.jpg",
                        Title = "image 2"
                    },
                    new O365ConnectorCardImage
                    {
                        Image = "http://connectorsdemo.azurewebsites.net/images/WIN12_Anthony_02.jpg",
                        Title = "image 3"
                    }
                }
            };

            O365ConnectorCard card = new O365ConnectorCard()
            {
                Summary    = "O365 card summary",
                ThemeColor = "#E67A9E",
                Title      = "card title",
                Text       = "card text",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    multichoice,
                    inputCard,
                    dateCard,
                    new O365ConnectorCardViewAction(O365ConnectorCardViewAction.Type)
                    {
                        Name   = "View Action",
                        Id     = null,
                        Target = new List <string>
                        {
                            "http://microsoft.com"
                        }
                    },
                    new O365ConnectorCardOpenUri(O365ConnectorCardOpenUri.Type)
                    {
                        Name    = "Open Uri",
                        Id      = "open-uri",
                        Targets = new List <O365ConnectorCardOpenUriTarget>
                        {
                            new O365ConnectorCardOpenUriTarget
                            {
                                Os  = "default",
                                Uri = "http://microsoft.com"
                            },
                            new O365ConnectorCardOpenUriTarget
                            {
                                Os  = "iOS",
                                Uri = "http://microsoft.com"
                            },
                            new O365ConnectorCardOpenUriTarget
                            {
                                Os  = "android",
                                Uri = "http://microsoft.com"
                            },
                            new O365ConnectorCardOpenUriTarget
                            {
                                Os  = "windows",
                                Uri = "http://microsoft.com"
                            }
                        }
                    }
                }
            };

            return(card.ToAttachment());
        }
        /// <summary>
        /// Actionable cards can have multiple sections, each with its own set of actions.
        /// If a section contains only 1 card action, that is automatically expanded
        /// </summary>
        /// <returns>The result card with actions.</returns>
        ///
        public static Attachment O365ActionableCardMultipleSection()
        {
            #region Section1

            #region Multichoice Card
            // multiple choice control with required, multiselect, compact style
            var multichoiceCardSection1 = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type)
            {
                Name   = "Multiple Choice",
                Id     = "Multiple Choice Card",
                Inputs = new List <O365ConnectorCardInputBase>
                {
                    new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type)
                    {
                        Id         = "cardstype",
                        IsRequired = true,
                        Title      = "Pick multiple options",
                        Value      = null,
                        Choices    = new List <O365ConnectorCardMultichoiceInputChoice>
                        {
                            new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"),
                            new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"),
                            new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card")
                        },
                        Style         = "compact",
                        IsMultiSelect = true
                    },
                },
                Actions = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type)
                    {
                        Name = "send",
                        Id   = "multichoice",
                        Body = @"{""cardstype"":""{{cardstype.value}}"""
                    }
                }
            };

            #endregion

            var potentialActionSection1 = new List <O365ConnectorCardActionBase>
            {
                multichoiceCardSection1
            };

            var section1 = new O365ConnectorCardSection
            {
                Title             = "Section Title 1",
                Text              = "",
                ActivityTitle     = "",
                ActivitySubtitle  = "",
                ActivityText      = "",
                ActivityImage     = null,
                ActivityImageType = null,
                Markdown          = true,
                Facts             = null,
                Images            = null,
                PotentialAction   = potentialActionSection1
            };
            #endregion

            #region Section2

            #region Input Card
            // text input examples
            var inputCard = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type)
            {
                Id   = "Text Input",
                Name = "Input Card",
                // text input control with multiline
                Inputs = new List <O365ConnectorCardInputBase>
                {
                    new O365ConnectorCardTextInput(O365ConnectorCardTextInput.Type)
                    {
                        Id          = "text-1",
                        IsRequired  = false,
                        Title       = "This is the title of text box",
                        Value       = null,
                        IsMultiline = true,
                        MaxLength   = null
                    }
                },
                Actions = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type)
                    {
                        Name = "Send",
                        Id   = "inputText",
                        Body = @"{""text1"":""{{text-1.value}}""}"
                    }
                }
            };
            #endregion

            #region Multichoice Card For Section2
            // multiple choice control with not required, multiselect, compact style
            var multichoiceCardSection2 = new O365ConnectorCardActionCard(O365ConnectorCardActionCard.Type)
            {
                Name   = "Multiple Choice",
                Id     = "Multiple Choice Card",
                Inputs = new List <O365ConnectorCardInputBase>
                {
                    new O365ConnectorCardMultichoiceInput(O365ConnectorCardMultichoiceInput.Type)
                    {
                        Id         = "CardsTypesection1", //please make sure that id of the control must be unique across card to work properly
                        IsRequired = false,
                        Title      = "This is a title of combo box",
                        Value      = null,
                        Choices    = new List <O365ConnectorCardMultichoiceInputChoice>
                        {
                            new O365ConnectorCardMultichoiceInputChoice("Hero Card", "Hero Card"),
                            new O365ConnectorCardMultichoiceInputChoice("Thumbnail Card", "Thumbnail Card"),
                            new O365ConnectorCardMultichoiceInputChoice("O365 Connector Card", "O365 Connector Card")
                        },
                        Style         = "compact",
                        IsMultiSelect = true
                    }
                },
                Actions = new List <O365ConnectorCardActionBase>
                {
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type)
                    {
                        Name = "Send",
                        Id   = "multichoice",
                        Body = @"{""CardsTypesection1"":""{{CardsTypesection1.value}}"""
                    }
                }
            };
            #endregion

            // please always attach new potential action to individual sections
            var potentialActionSection2 = new List <O365ConnectorCardActionBase>
            {
                inputCard,
                multichoiceCardSection2
            };

            var section2 = new O365ConnectorCardSection
            {
                Title             = "Section Title 2",
                Text              = "",
                ActivityTitle     = "",
                ActivitySubtitle  = "",
                ActivityText      = "",
                ActivityImage     = null,
                ActivityImageType = null,
                Markdown          = true,
                Facts             = null,
                Images            = null,
                PotentialAction   = potentialActionSection2
            };
            #endregion

            O365ConnectorCard card = new O365ConnectorCard()
            {
                Title      = "This is Actionable Card Title",
                Summary    = "O365 card summary",
                ThemeColor = "#E67A9E",
                Sections   = new List <O365ConnectorCardSection> {
                    section1, section2
                },
            };

            return(card.ToAttachment());
        }
        public static O365ConnectorCard GetO365ConnectorCardResult(Product product)
        {
            int balanceItems = product.Quantity - product.Committed;
            var actionId     = Guid.NewGuid().ToString();

            var section = new O365ConnectorCardSection
            {
                ActivityTitle    = $"Item Name: **{product.ProductName}**",
                ActivitySubtitle = $"Item Code: **{product.ItemCode}**",
                ActivityImage    = product.ProductImageUrl,
                Facts            = new List <O365ConnectorCardFact>
                {
                    new O365ConnectorCardFact("Location", product.Location),
                    new O365ConnectorCardFact("Total Inventory", product.Quantity.ToString()),
                    new O365ConnectorCardFact("Quantity committed", product.Committed.ToString()),
                    new O365ConnectorCardFact("Quantity available", balanceItems.ToString()),
                }
            };
            var addInventory = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Add Inventory",
                "Text Input",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "itemCount",
                    true,
                    "Number of items to add",
                    null,
                    false,
                    null)
            },


                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Add Inventory",
                    Constants.newInventoryCount,
                    @"{'newItem':'{{itemCount.value}}', 'ProductId':'" + product.PrdouctId + "'}")
            });

            var blockInventory = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Block Inventory",
                "Text Input1",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "itemCount1",
                    true,
                    "Number of items to blocked",
                    null,
                    false,
                    null)
            },


                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Block Inventory",
                    Constants.BlockInventory,
                    @"{'newItem':'{{itemCount1.value}}', 'ProductId':'" + product.PrdouctId + "'}")
            });
            var retireInventory = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Retire Inventory",
                "Text Input2",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "itemCount2",
                    true,
                    "Number of items to Retire",
                    null,
                    false,
                    null)
            },


                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Retire Inventory",
                    Constants.RetireInventory,
                    @"{'newItem':'{{itemCount2.value}}', 'ProductId':'" + product.PrdouctId + "'}")
            });
            O365ConnectorCard card = new O365ConnectorCard()
            {
                Title      = "Product Information",
                ThemeColor = "#E67A9E",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    addInventory,
                    blockInventory,
                    retireInventory,
                    new O365ConnectorCardHttpPOST(O365ConnectorCardHttpPOST.Type, "Request for stock", Constants.RequestNewStock, $"{{'Value':'{product.PrdouctId}'}}"),
                }
            };

            return(card);
        }
Example #20
0
        public static Attachment GetWelcomeMessage(string actionId, IList <ChannelAccount> members)
        {
            var section = new O365ConnectorCardSection("Please select the type of notification you want to receive", null, null, null, null);
            var notificationCardAction = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Select Notification",
                "notificationType",
                new List <O365ConnectorCardInputBase>
            {
                new  O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "notificationType",
                    true,
                    "Select Notification",
                    null,
                    new List <O365ConnectorCardMultichoiceInputChoice>
                {
                    new O365ConnectorCardMultichoiceInputChoice("Weather", "Weather"),
                    new O365ConnectorCardMultichoiceInputChoice("Operations Delay", "OperationsDelay"),
                    new O365ConnectorCardMultichoiceInputChoice("Social Events", "SocialEvents")
                },
                    "compact"
                    , false)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show notification",
                    "notificationType",
                    @"{""Value"":""{{notificationType.value}}"",  ""ActionId"":""" + actionId + @"""  " + (members == null?"":@",""Members"":""{{members.value}}""") + "}")
            });

            if (members != null)
            {
                var memberSelection = new O365ConnectorCardMultichoiceInput(
                    O365ConnectorCardMultichoiceInput.Type,
                    "members",
                    false,
                    "Select Members",
                    null, new List <O365ConnectorCardMultichoiceInputChoice>()
                    ,
                    "compact"
                    , true);

                memberSelection.Choices.Add(new O365ConnectorCardMultichoiceInputChoice("ALL TEAM", "ALL TEAM"));

                foreach (var member in members)
                {
                    var nameParts = member.Name.Split(' ');
                    var fullName  = string.Empty;
                    for (int i = 0; i < nameParts.Length && i < 2; i++)
                    {
                        if (!string.IsNullOrEmpty(fullName))
                        {
                            fullName += " ";
                        }
                        fullName += nameParts[i].Trim();
                    }

                    memberSelection.Choices.Add(new O365ConnectorCardMultichoiceInputChoice(fullName, member.Id));
                }

                notificationCardAction.Inputs.Add(memberSelection);
            }


            O365ConnectorCard card = new O365ConnectorCard()
            {
                ThemeColor = "#E67A9E",
                Title      = "Welcome to Notification Bot",
                Summary    = "",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    notificationCardAction
                }
            };

            return(card.ToAttachment());
        }
Example #21
0
        public static Attachment GetCardsInformation()
        {
            var section = new O365ConnectorCardSection {
                ActivityTitle = "Track customer belongings",
                Text          = "Using this bot you can<ol><li>Check baggage status</li><li>Track current location</li><li>Re-assign baggage</li><li>Report missing</li></ol> Choose one of the options below to retrieve details"
            };

            var PNRNumberCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Baggage by PNR",
                "PNR",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "pnrNumberInput",
                    true,
                    "Enter PNR number (Ex:DBW6WK, DBW6WF, DBW6RK)",
                    null,
                    false,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show",
                    Constants.PNR,
                    @"{""Value"":""{{pnrNumberInput.value}}""}")
            });
            var TicketNumnerCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Baggage by Ticket#",
                "Ticket Number",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "ticketNumberInput",
                    true,
                    "Enter Ticket number (Ex: DBW612, DBW634, DBW678)",
                    null,
                    false,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show",
                    Constants.TicketNumber,
                    @"{""Value"":""{{ticketNumberInput.value}}""}")
            });
            var NameCard = new O365ConnectorCardActionCard(
                O365ConnectorCardActionCard.Type,
                "Baggage by Passenger Name",
                "Name",
                new List <O365ConnectorCardInputBase>
            {
                new O365ConnectorCardTextInput(
                    O365ConnectorCardTextInput.Type,
                    "NameInput",
                    true,
                    "Enter Passenger Name( Ex: Adele, Alex, Allan)",
                    null,
                    false,
                    null)
            },
                new List <O365ConnectorCardActionBase>
            {
                new O365ConnectorCardHttpPOST(
                    O365ConnectorCardHttpPOST.Type,
                    "Show",
                    Constants.Name,
                    @"{""Value"":""{{NameInput.value}}""}")
            });



            O365ConnectorCard card = new O365ConnectorCard()
            {
                ThemeColor = "#E67A9E",
                Title      = "Passenger Baggage Information",
                Sections   = new List <O365ConnectorCardSection> {
                    section
                },
                PotentialAction = new List <O365ConnectorCardActionBase>
                {
                    PNRNumberCard,
                    TicketNumnerCard,
                    NameCard
                }
            };

            return(card.ToAttachment());
        }