/// <summary> /// Initializes a new instance of the <see cref="RemoteSupportActivityHandler"/> class. /// </summary> /// <param name="microsoftAppCredentials">Microsoft Application credentials for Bot/ME.</param> /// <param name="logger">Sends logs to the Application Insights service.</param> /// <param name="localizer">The current cultures' string localizer.</param> /// <param name="telemetryClient">The Application Insights telemetry client. </param> /// <param name="options">A set of key/value application configuration properties.</param> /// <param name="ticketDetailStorageProvider">Provider to store ticket details to Azure Table Storage.</param> /// <param name="onCallSupportDetailSearchService">Provider to search on call support details in Azure Table Storage.</param> /// <param name="ticketSearchService">Provider to search ticket details in Azure Table Storage.</param> /// <param name="tokenHelper">Generating custom JWT token and retrieving access token for user.</param> /// <param name="cardConfigurationStorageProvider">Provider to search card configuration details in Azure Table Storage.</param> /// <param name="ticketGenerateStorageProvider">Provider to get ticket id to Azure Table Storage.</param> /// <param name="onCallSupportDetailStorageProvider"> Provider for fetching and storing information about on call support in storage table.</param> public RemoteSupportActivityHandler( MicrosoftAppCredentials microsoftAppCredentials, ILogger <RemoteSupportActivityHandler> logger, IStringLocalizer <Strings> localizer, TelemetryClient telemetryClient, IOptions <RemoteSupportActivityHandlerOptions> options, ITicketDetailStorageProvider ticketDetailStorageProvider, IOnCallSupportDetailSearchService onCallSupportDetailSearchService, ITicketSearchService ticketSearchService, ICardConfigurationStorageProvider cardConfigurationStorageProvider, ITokenHelper tokenHelper, ITicketIdGeneratorStorageProvider ticketGenerateStorageProvider, IOnCallSupportDetailStorageProvider onCallSupportDetailStorageProvider) { this.microsoftAppCredentials = microsoftAppCredentials; this.logger = logger; this.localizer = localizer; this.telemetryClient = telemetryClient; this.options = options ?? throw new ArgumentNullException(nameof(options)); this.teamId = this.options.Value.TeamId; this.ticketDetailStorageProvider = ticketDetailStorageProvider; this.ticketSearchService = ticketSearchService; this.onCallSupportDetailSearchService = onCallSupportDetailSearchService; this.appBaseUrl = this.options.Value.AppBaseUri; this.tokenHelper = tokenHelper; this.cardConfigurationStorageProvider = cardConfigurationStorageProvider; this.ticketGenerateStorageProvider = ticketGenerateStorageProvider; this.onCallSupportDetailStorageProvider = onCallSupportDetailStorageProvider; }
public void TestInialize() { MoscowCityId = Guid.NewGuid(); LondonCityId = Guid.NewGuid(); _mockRepository = new Mock <IRepository <Flight> >(); var cities = new List <Flight>() { new Flight() { DepartureDate = DateTime.Now.AddDays(1), CityFromId = MoscowCityId, CityToId = LondonCityId, BookedSeats = 10, TotalSeats = 11 }, new Flight() { DepartureDate = DateTime.Now.AddDays(2), CityFromId = MoscowCityId, CityToId = LondonCityId, BookedSeats = 10, TotalSeats = 11 }, new Flight() { DepartureDate = DateTime.Now.AddDays(3), CityFromId = LondonCityId, CityToId = MoscowCityId, BookedSeats = 10, TotalSeats = 11 }, }; _mockRepository.Setup(x => x.GetAll()).Returns(cities); _ticketService = new TicketSearchService(_mockRepository.Object); }
/// <summary> /// Get the results from Azure search service and populate the result (card + preview). /// </summary> /// <param name="query">Query which the user had typed in message extension search.</param> /// <param name="commandId">Command id to determine which tab in message extension has been invoked.</param> /// <param name="count">Count for pagination.</param> /// <param name="skip">Skip for pagination.</param> /// <param name="searchService">Search service.</param> /// <param name="localizer">The current cultures' string localizer.</param> /// <param name="requestorId">Requester id of the user to get specific tickets.</param> /// <param name="onCallSMEUsers">OncallSMEUsers to give support from group-chat or on-call.</param> /// <returns><see cref="Task"/> Returns MessagingExtensionResult which will be used for providing the card.</returns> public static async Task <MessagingExtensionResult> GetSearchResultAsync( string query, string commandId, int?count, int?skip, ITicketSearchService searchService, IStringLocalizer <Strings> localizer, string requestorId = "", string onCallSMEUsers = "") { MessagingExtensionResult composeExtensionResult = new MessagingExtensionResult { Type = "result", AttachmentLayout = AttachmentLayoutTypes.List, Attachments = new List <MessagingExtensionAttachment>(), }; IList <TicketDetail> searchServiceResults; // commandId should be equal to Id mentioned in Manifest file under composeExtensions section. switch (commandId) { case Constants.UrgentCommandId: searchServiceResults = await searchService?.SearchTicketsAsync(TicketSearchScope.Acil, query, count, skip); composeExtensionResult = GetMessagingExtensionResult(searchServiceResults, localizer, commandId); break; case Constants.AssignedCommandId: searchServiceResults = await searchService?.SearchTicketsAsync(TicketSearchScope.Atanan, query, count, skip); composeExtensionResult = GetMessagingExtensionResult(searchServiceResults, localizer, commandId); break; case Constants.UnassignedCommandId: searchServiceResults = await searchService?.SearchTicketsAsync(TicketSearchScope.Atanmayan, query, count, skip); composeExtensionResult = GetMessagingExtensionResult(searchServiceResults, localizer, commandId); break; case Constants.ActiveCommandId: searchServiceResults = await searchService?.SearchTicketsAsync(TicketSearchScope.Aktif, query, count, skip, requestorId); composeExtensionResult = GetMessagingExtensionResult(searchServiceResults, localizer, commandId, onCallSMEUsers); break; case Constants.ClosedCommandId: searchServiceResults = await searchService?.SearchTicketsAsync(TicketSearchScope.Kapatılmış, query, count, skip, requestorId); composeExtensionResult = GetMessagingExtensionResult(searchServiceResults, localizer, commandId); break; } return(composeExtensionResult); }
/// <summary> /// Contructor /// </summary> /// <param name="service"></param> public TicketsController(ITicketSearchService service) { TicketService = service; }