public async Task RetrieveExceptionReportListAsyncTest()
        {
            var exceptionReportSearchParameters = new ExceptionReportSearchParameters
            {
                DepartmentIds = "1",
                ClearanceStatus = "1",
                AgeFrom = "21",
                FirstName = "trott",
                LastName = "ryan",
                AgeTo = "42",
                ExceptionTypeIds = "23",
                PersonTypeId = "23",
                Gender = "M",
                VoyageId = "3",
                MaxResults = 50,
                OrderBy = "DepartmentIds",
                PageNumber = 2,
                Parts = "$all",
            };

            var exceptionReport = new ExceptionReport { Age = "48", Birthdate = System.DateTime.Now, BookingNo = "2", PersonId = "DK4 MID Port", Contact = "3456789098", Nationality = "Crew", FirstName = "Ryan", Gender = "M", LastName = "Trott", MiddleName = "henry", Stateroom = "1" };

            exceptionReport.IdentificationManifests.Add(new IdentificationManifest { CrewmemberId = "1", DocumentType = "2", GuestId = "2", Number = "22", PersonId = "1", PersonTypeId = "1", VisitorId = "1" });

            this.exceptionReport.Items.Add(exceptionReport);

            this.exceptionReportRepository.Setup(mockItem => mockItem.ListAsync(It.IsNotNull<ExceptionReportSearchParameters>())).Returns(Task.FromResult(this.exceptionReport));
            var alert = await this.exceptionReportData.ListAsync(exceptionReportSearchParameters);
            var searchQueryString = exceptionReportSearchParameters.ToQueryString();
            Assert.IsNotNull(alert);
            Assert.IsTrue(searchQueryString.Contains("DepartmentIds"));
            Assert.IsNotNull(alert);
        }
 /// <summary>
 /// Lists the asynchronous.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>the exception list</returns>
 public async Task<ListResult<ExceptionReport>> ListAsync(ExceptionReportSearchParameters filter)
 {
     var task = await this.exceptionClient.RetrieveExceptionListAsync(
        exceptionTypeIds: filter.ExceptionTypeIds,
        personTypeId: filter.PersonTypeId,
        clearanceStatus: filter.ClearanceStatus,
        departmentIds: filter.DepartmentIds,
        voyageId: filter.VoyageId,
        firstName: filter.FirstName,
        lastName: filter.LastName,
        ageFrom: filter.AgeFrom,
        ageTo: filter.AgeTo,
        gender: filter.Gender,
        parts: filter.Parts ?? DefaultPartsValue,
        pageNumber: filter.PageNumber.RetrievePageNumber(),
        maxResults: filter.MaxResults.RetrieveMaxResults(),
        orderBy: filter.OrderBy);
     return !string.IsNullOrEmpty(task) ? JsonConvert.DeserializeObject<ListResult<ExceptionReport>>(task) : default(ListResult<ExceptionReport>);
 }
 public async Task RetrieveExceptionReportsListAsyncTest()
 {
     try
     {
         this.SetupGetRequests();
         ExceptionReportSearchParameters objParam = new ExceptionReportSearchParameters();
         objParam.MaxResults = 50;
         objParam.PageNumber = 1;
         this.exceptionReportManager.Setup(mokeItem => mokeItem.ListAsync(It.IsNotNull<ExceptionReportSearchParameters>())).Returns(Task.FromResult(new ListResult<ExceptionReport>()));
         var response = await this.exceptionReportsController.Get(objParam);
         var result = await response.ExecuteAsync(new CancellationToken(false));
         Assert.IsTrue(result.IsSuccessStatusCode);
         Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
     }
     finally
     {
         this.Dispose();
     }
 }
Example #4
0
 /// <summary>
 /// Assigns the exception data.
 /// </summary>
 /// <param name="searchParameter">The parameter.</param>
 public void AssignExceptionData(ExceptionReportSearchParameters searchParameter)
 {
     if (searchParameter != null)
     {
         this.exceptionReportSearchParameters = searchParameter;
     }
 }
 /// <summary>
 /// Lists the asynchronous.
 /// </summary>
 /// <param name="operationResult">The operation result.</param>
 /// <param name="filter">The filter.</param>
 /// <returns>The task</returns>
 private async Task ListAsync(OperationResult<ListResultWithMetadata<ExceptionReport>> operationResult, ExceptionReportSearchParameters filter)
 {
     var result = await this.exceptionReportManager.ListAsync(filter);
     operationResult.Content = new ListResultWithMetadata<ExceptionReport>(result, filter, this.Request.RequestUri);
 }
 /// <summary>
 /// Lists the asynchronous.
 /// </summary>
 /// <param name="filters">The filters.</param>
 /// <returns>
 /// The task
 /// </returns>
 public async Task<ListResult<ExceptionReport>> ListAsync(ExceptionReportSearchParameters filters)
 {
     return await this.exceptionReportData.ListAsync(filters);
 }
 /// <summary>
 /// Retrieves the exception report asynchronous.
 /// </summary>
 /// <param name="searchFilter">The search filter.</param>
 /// <returns>Exception report list according to search parameter</returns>
 public async Task<ListResult<ExceptionReport>> RetrieveExceptionReportAsync(ExceptionReportSearchParameters searchFilter)
 {
     string orderBy = (!string.IsNullOrEmpty(searchFilter.SortBy)) ? (!string.IsNullOrEmpty(searchFilter.ThenBy) ? (searchFilter.SortBy.Equals(searchFilter.ThenBy) ? searchFilter.SortBy : searchFilter.SortBy + "," + searchFilter.ThenBy) : searchFilter.SortBy) : ((!string.IsNullOrEmpty(searchFilter.ThenBy)) ? searchFilter.ThenBy : string.Empty);
     var uri = string.Format(GetExceptionRelativeAddress, BaseAddress, ExceptionReportResource, searchFilter.FirstName, searchFilter.LastName, searchFilter.ExceptionTypeIds, searchFilter.PersonTypeId, searchFilter.DepartmentIds, searchFilter.ClearanceStatus, searchFilter.VoyageId, searchFilter.Gender, searchFilter.AgeFrom, searchFilter.AgeTo, orderBy, searchFilter.PageSize, searchFilter.PageNumber);
     var exceptionReport = await this.httpClientHelper.Retrieve(uri, new CancellationToken(false));
     var exceptionReportData = !string.IsNullOrEmpty(exceptionReport) ? JsonConvert.DeserializeObject<ListResult<ExceptionReport>>(exceptionReport) : default(ListResult<ExceptionReport>);
     return exceptionReportData;
 }
 public async Task RetrieveExceptionReportAsyncTests()
 {
     this.httpClientHelper.Setup(mock => mock.Retrieve(It.IsAny<string>(), It.IsAny<CancellationToken>())).Returns(Task.FromResult(string.Empty));
     var searchParameter = new ExceptionReportSearchParameters { AgeFrom = "15-07-1992", AgeTo = "15-07-2015", ThenBy = "staterooms", ClearanceStatus = "true", DepartmentIds = "1", FirstName = "John", Gender = "Male", LastName = "Devis", PersonTypeId = "1" };
     await this.reportRepository.RetrieveExceptionReportAsync(searchParameter);
     Assert.IsTrue(true);
 }
Example #9
0
 /// <summary>
 /// Retrieves the exception report asynchronous.
 /// </summary>
 /// <param name="searchFilter">The search filter.</param>
 /// <returns>
 /// Exception List according to search parameter
 /// </returns>
 public async Task<ListResult<ExceptionReport>> RetrieveExceptionReportAsync(ExceptionReportSearchParameters searchFilter)
 {
     return await this.reportRepository.RetrieveExceptionReportAsync(searchFilter);
 }
        /// <summary>
        /// Guests the exception report print.
        /// </summary>
        /// <returns>The Task</returns>
        public async Task<ActionResult> GuestExceptionReportPrint()
        {
            var reportPresenter = new ReportPresenter();

            var searchFilter = new ExceptionReportSearchParameters();
            searchFilter = SessionData.Instance.ExceptionReportSearchParameters;
            searchFilter.PageSize = 0;
            searchFilter.PageNumber = 1;
            var exceptions = await this.reportManager.RetrieveExceptionReportAsync(searchFilter);

            if (exceptions != null && exceptions.Items.Count > 0)
            {
                reportPresenter.AssignExceptionSearchResult(exceptions);
            }

            return this.View(ExceptionReportPrintView, reportPresenter);
        }