示例#1
0
        public FinalTaskFlightsBot(ChatbotAccessor accessor)
        {
            this._accessor = accessor ?? throw new System.ArgumentException("Accessor object is empty!");

            _dialogSet = new DialogSet(this._accessor.ConversationDialogStateAccessor);
            _dialogSet.Add(new MainDialogClass(MainDialogId, _accessor));
        }
        /// <summary>
        /// GetFlightDetailsDialog constructor.
        /// </summary>
        /// <param name="dialogId">Dialog Id parameter inherited from CompenentDialog Class.</param>
        /// <param name="accessor">Chatbot accessors.</param>
        public GetFlightDetailsDialog(string dialogId, ChatbotAccessor accessor) : base(dialogId)
        {
            this.InitialDialogId = GetFlightDetailsDialogId;
            this._accessor       = accessor ?? throw new System.ArgumentException("Accessor object is empty!");

            //Definition of waterfall steps to be executed in this class as a waterfall dialog.
            WaterfallStep[] waterfallSteps = new WaterfallStep[]
            {
                GetPassengerNameAsync,
                GetFromAirportAsync,
                GetToAirportAsync,
                GetOneOrTwoWayFlightAsync,
                GetStartDateAsync,
                GetEndDateAsync,
                ClassChoiceAsync,
                DisplayReservationAsync,
                ConfirmReservationAsync,
                AskForCarRentalAsync,
                EndDialogAsync
            };

            //Definition of dialogs which are executed in GetFlightDetailsDialog class.
            AddDialog(new WaterfallDialog(GetFlightDetailsDialogId, waterfallSteps));
            AddDialog(new GetRentalDetailsDialog(GetRentalDetailsDialogId, _accessor));
            //Definition of prompts which are used in the GetFlightDetailsDialog class.
            AddDialog(new TextPrompt("PassengerName", PassengerNameValidatorAsync));
            AddDialog(new TextPrompt("FromAirport", FromValidatorAsync));
            AddDialog(new TextPrompt("ToAirport", ToValidatorAsync));
            AddDialog(new ChoicePrompt("OneOrTwoWayFlight"));
            AddDialog(new DateTimePrompt("StartDate", StartDateValidatorAsync));
            AddDialog(new DateTimePrompt("EndDate", EndDateValidatorAsync));
            AddDialog(new ChoicePrompt("ClassChoice"));
            AddDialog(new ChoicePrompt("ConfirmChoice"));
            AddDialog(new ChoicePrompt("CarReservationChoice"));
        }
        /// <summary>
        /// ShowAllReservationsDialog constructor.
        /// </summary>
        /// <param name="dialogId">Dialog Id parameter inherited from CompenentDialog Class.</param>
        /// <param name="accessor">Chatbot accessor.</param>
        public ShowAllReservationsDialog(string dialogId, ChatbotAccessor accessor) : base(dialogId)
        {
            this.InitialDialogId = ShowAllReservationsId;
            this._accessor       = accessor ?? throw new System.ArgumentException("Accessor object is empty!");

            //Definition of waterfall step to be executed in this class as a waterall dialog.
            WaterfallStep[] waterfallSteps = new WaterfallStep[]
            {
                DisplayReservationsAsync,
            };

            //Definition of dialog which is executed in GetFlightDetailsDialog class.
            AddDialog(new WaterfallDialog(ShowAllReservationsId, waterfallSteps));
        }
        /// <summary>
        /// ShowOneReservationDialog constructor.
        /// </summary>
        /// <param name="dialogId">Dialog Id parameter inherited from CompenentDialog Class.</param>
        /// <param name="accessor">Chatbot accessor.</param>
        public ShowOneReservationDialog(string dialogId, ChatbotAccessor accessor) : base(dialogId)
        {
            this.InitialDialogId = ShowOneReservationId;
            this._accessor       = accessor ?? throw new System.ArgumentException("Accessor object is empty!");

            //Definition of waterfall steps to be executed in this class as a waterall dialog.
            WaterfallStep[] waterfallSteps = new WaterfallStep[]
            {
                AskForReservationIdAsync,
                DisplayReservationAsync,
                AskForNextActionAsync,
                EndShowOneReservationAsync
            };

            //Definition of dialog which is executed in GetFlightDetailsDialog class.
            AddDialog(new WaterfallDialog(ShowOneReservationId, waterfallSteps));
            //Definition of prompts which are used in the GetFlightDetailsDialog class.
            AddDialog(new TextPrompt("ReservationId", ReservationIdValidatorAsync));
            AddDialog(new ChoicePrompt("OperationType"));
        }
示例#5
0
        /// <summary>
        /// MainDialogClass constructor.
        /// </summary>
        /// <param name="dialogId">Dialog Id parameter inherited from CompenentDialog Class.</param>
        /// <param name="accessor">Chatbot accessors.</param>
        public MainDialogClass(string dialogId, ChatbotAccessor accessor) : base(dialogId)
        {
            InitialDialogId = MainDialogId;
            this._accessor  = accessor ?? throw new System.ArgumentException("Accessor object is empty!");

            //Definition of waterfall steps to be executed in this class as a waterfall dialog.
            WaterfallStep[] waterfallSteps = new WaterfallStep[]
            {
                GetOperationTypeAsync,
                VerifyOperationTypeAsync,
                RedirectMainDialogAsync,
            };

            //Definition of dialogs which are executed in GetFlightDetailsDialog class.
            AddDialog(new WaterfallDialog(MainDialogId, waterfallSteps));
            AddDialog(new GetFlightDetailsDialog(GetFlightDetailsDialogId, _accessor));
            AddDialog(new ShowOneReservationDialog(ShowOneReservationId, _accessor));
            AddDialog(new ShowAllReservationsDialog(ShowAllReservationsId, _accessor));
            //Definition of prompts which are used in the GetFlightDetailsDialog class.
            AddDialog(new ChoicePrompt("OperationType"));
        }
        /// <summary>
        /// GetRentalDetailsDialog constructor.
        /// </summary>
        /// <param name="dialogId">Dialog Id parameter inherited from CompenentDialog Class</param>
        /// <param name="accessor">Chatbot accessors</param>
        public GetRentalDetailsDialog(string dialogId, ChatbotAccessor accessor) : base(dialogId)
        {
            this.InitialDialogId = GetRentalDetailsDialogId;
            this._accessor       = accessor ?? throw new System.ArgumentException("Accessor object is empty!");

            //Definition of waterfall steps to be executed in this class as a waterfall dialog.
            WaterfallStep[] waterfallSteps = new WaterfallStep[]
            {
                AskForRentalLength,
                AskForPassengersNumberAsync,
                AskForChildSeat,
                AskForCarClass,
                DisplayCarReservation,
                EndCarReservatonDialogAsync
            };
            //Definition of dialogs which are executed in GetFlightDetailsDialog class.
            AddDialog(new WaterfallDialog(GetRentalDetailsDialogId, waterfallSteps));
            //Definition of waterfall steps to be executed in this class as a waterfall dialog.
            AddDialog(new TextPrompt("RentalLength", RentalLengthValidatorAsync));
            AddDialog(new TextPrompt("PassengersNumber", PassengersNumberValidatorAsync));
            AddDialog(new TextPrompt("ChildSeat", ChildSeatValidatorAsync));
            AddDialog(new ChoicePrompt("CarClassChoice"));
            AddDialog(new ChoicePrompt("ConfirmChoice"));
        }