public async Task RetrieveMovementReportListAsyncTest()
        {
            var movementReportSearchParameters = new MovementReportSearchParameters
            {
                BoardingStatus = "1",
                ClearanceStatus = "1",
                AgeFrom = "21",
                FirstName = "trott",
                LastName = "ryan",
                MovementActivityEndDate = "2015-07-10 12:12:12:120",
                MovementActivityStartDate = "2015-07-10 12:12:12:120",
                AgeTo = "42",
                DepartmentId = "23",
                ModifiedParts = "visitor",
                PersonTypeId = "23",
                Gender = "M",
                VoyageId = "3",
                MaxResults = 50,
                OrderBy = "DepartmentIds",
                PageNumber = 2,
                Parts = "$all",
            };

            this.movementReport.Items.Add(new MovementReport { Age = "48", Activity = "OnBoard", ActivityCount = "2", Location = "DK4 MID Port", Contact = "3456789098", Nationality = "Crew", FirstName = "Ryan", Gender = "M", LastName = "Trott", Port = "MIAMI", MiddleName = "henry", Stateroom = "1", ActivityDate = DateTime.Now, MediaItemAddress = "http://dci/ImagingMediaService/MediaItems/600001" });

            this.movementReportRepository.Setup(mockItem => mockItem.ListMovementReportAsync(It.IsNotNull<MovementReportSearchParameters>())).Returns(Task.FromResult(this.movementReport));
            var alert = await this.movementReportData.ListAsync(movementReportSearchParameters);
            var searchQueryString = movementReportSearchParameters.ToQueryString();
            Assert.IsNotNull(alert);
            Assert.IsTrue(searchQueryString.Contains("DepartmentIds"));
            Assert.IsNotNull(alert);
        }
 public async Task RetrieveMovementReportsListAsyncTest()
 {
     try
     {
         this.SetupGetRequests();
         MovementReportSearchParameters objParam = new MovementReportSearchParameters();
         objParam.MaxResults = 50;
         objParam.PageNumber = 1;
         this.movementReportManager.Setup(mocketem => mocketem.ListAsync(It.IsNotNull<MovementReportSearchParameters>())).Returns(Task.FromResult(new ListResult<MovementReport>()));
         var response = await this.movementReportController.Get(objParam);
         var result = await response.ExecuteAsync(new CancellationToken(false));
         Assert.IsTrue(result.IsSuccessStatusCode);
         Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
     }
     finally
     {
         this.Dispose();
     }
 }
 /// <summary>
 /// Lists the visitor manifest asynchronous.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>Movement Report list</returns>
 public async Task<ListResult<MovementReport>> ListMovementReportAsync(MovementReportSearchParameters filter)
 {
     var task = await this.movementClient.RetrieveMovementReportListAsync(
         firstName: filter.FirstName,
         lastName: filter.LastName,
         departmentIds: filter.DepartmentId,
         personTypeId: filter.PersonTypeId,
         boardingStatus: filter.BoardingStatus,
         clearanceStatus: filter.ClearanceStatus,
         gender: filter.Gender,
         ageFrom: filter.AgeFrom,
         ageTo: filter.AgeTo,
         voyageId: filter.VoyageId,
         movementActivityStartDate: filter.MovementActivityStartDate != null ? Convert.ToDateTime(filter.MovementActivityStartDate, CultureInfo.InvariantCulture) : default(DateTime?),
         movementActivityEndDate: filter.MovementActivityEndDate != null ? Convert.ToDateTime(filter.MovementActivityEndDate, CultureInfo.InvariantCulture) : default(DateTime?),
         parts: filter.Parts ?? DefaultPartsValue,
         pageNumber: filter.PageNumber.RetrievePageNumber(),
         maxResults: filter.MaxResults.RetrieveMaxResults(),
         orderBy: filter.OrderBy);
     return !string.IsNullOrEmpty(task) ? JsonConvert.DeserializeObject<ListResult<MovementReport>>(task) : default(ListResult<MovementReport>);
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Assigns the movement data.
 /// </summary>
 /// <param name="searchParameter">The parameter.</param>
 public void AssignMovementData(MovementReportSearchParameters searchParameter)
 {
     if (searchParameter != null)
     {
         this.movementReportSearchParameters = searchParameter;
     }
 }
 /// <summary>
 /// Gets the asynchronous.
 /// </summary>
 /// <param name="operationResult">The operation result.</param>
 /// <param name="filter">The filter.</param>
 /// <returns>The Task</returns>
 private async Task GetAsync(OperationResult<ListResultWithMetadata<MovementReport>> operationResult, MovementReportSearchParameters filter)
 {
     var movement = await this.movementReportManager.ListAsync(filter);
     operationResult.Content = new ListResultWithMetadata<MovementReport>(movement, filter, this.Request.RequestUri);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Retrieves the movement report asynchronous.
 /// </summary>
 /// <param name="searchFilter">The search filter.</param>
 /// <returns>Movement report list according to search parameter</returns>
 public async Task<ListResult<MovementReport>> RetrieveMovementReportAsync(MovementReportSearchParameters 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(GetMovementRelativeAddress, BaseAddress, MovementReportResource, searchFilter.FirstName, searchFilter.LastName, searchFilter.BoardingStatus, searchFilter.PersonTypeId, searchFilter.DepartmentId, searchFilter.ClearanceStatus, searchFilter.VoyageId, searchFilter.Gender, searchFilter.AgeFrom, searchFilter.AgeTo, searchFilter.MovementActivityStartDate, searchFilter.MovementActivityEndDate, orderBy, searchFilter.PageSize, searchFilter.PageNumber);
     var movementReport = await this.httpClientHelper.Retrieve(uri, new CancellationToken(false));
     var movementReportData = !string.IsNullOrEmpty(movementReport) ? JsonConvert.DeserializeObject<ListResult<MovementReport>>(movementReport) : default(ListResult<MovementReport>);
     return movementReportData;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Lists the asynchronous.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>
 /// the  movement report parameter list
 /// </returns>
 public async Task<ListResult<MovementReport>> ListAsync(MovementReportSearchParameters filter)
 {
     return await this.movementReportRepository.ListMovementReportAsync(filter);
 }
 public async Task RetrieveMovementReportAsyncTests()
 {
     this.httpClientHelper.Setup(mock => mock.Retrieve(It.IsAny<string>(), It.IsAny<CancellationToken>())).Returns(Task.FromResult(string.Empty));
     var searchParameter = new MovementReportSearchParameters { AgeFrom = "15-07-1992", AgeTo = "15-07-2015", ThenBy = "staterooms", ClearanceStatus = "true", FirstName = "John", Gender = "Male", LastName = "Devis", PersonTypeId = "1", BoardingStatus = "true", DepartmentId = "1", MovementActivityEndDate = "15-07-2015", MovementActivityStartDate = "15-07-2014" };
     await this.reportRepository.RetrieveMovementReportAsync(searchParameter);
     Assert.IsTrue(true);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Retrieves the movement report asynchronous.
 /// </summary>
 /// <param name="searchFilter">The search filter.</param>
 /// <returns>
 /// Movement List according to search parameter
 /// </returns>
 public async Task<ListResult<MovementReport>> RetrieveMovementReportAsync(MovementReportSearchParameters searchFilter)
 {
     return await this.reportRepository.RetrieveMovementReportAsync(searchFilter);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Movements the report.
 /// </summary>
 /// <returns>Movement Report View</returns>
 public ActionResult MovementReport()
 {
     var reportPresenter = new ReportPresenter();
     var movementReportSearchParameters = new MovementReportSearchParameters { ClearanceStatus = ZeroConst };
     SetData(reportPresenter);
     reportPresenter.MovementSearchParameters = movementReportSearchParameters;
     SetActivePage(reportPresenter, MovementReportView);
     SetExceptionFilterOption(reportPresenter);
     return this.View(MovementReportView, reportPresenter);
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Guests the movement report print.
        /// </summary>
        /// <returns>The Task</returns>
        public async Task<ActionResult> GuestMovementReportPrint()
        {
            var reportPresenter = new ReportPresenter();

            var searchFilter = new MovementReportSearchParameters();
            searchFilter = SessionData.Instance.MovementReportSearchParameters;
            searchFilter.PageSize = 0;
            searchFilter.PageNumber = 1;
            var movement = await this.reportManager.RetrieveMovementReportAsync(searchFilter);

            if (movement != null && movement.Items.Count > 0)
            {
                var authenticationToken = await Client.Common.TokenManager.CreateAsync(new CancellationToken(false));
                movement.AssignItems(movement.Items.Select(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) ? item.MediaItemAddress + AuthConst + authenticationToken + ImageSizeConst + ThumbnailConst : DefaultThumbnailImage; return item; }).ToList());
                reportPresenter.AssignMovementSearchResult(movement);
            }

            return this.View(MovementReportPrintView, reportPresenter);
        }