public async Task RetrieveVisitorManifestListAsyncTest()
        {
            var visitorSearchParameters = new VisitorManifestSearchParameter
            {
                BoardingStatus = "1",
                ClearanceStatus = "1",
                VisitorTypeId = "2",
                FirstName = "trott",
                LastName = "ryan",
                MovementActivityEndDate = "2015-07-10 12:12:12:120",
                MovementActivityStartDate = "2015-07-10 12:12:12:120",
                DepartmentId = "4",
                MaxResults = 50,
                OrderBy = "FirstName",
                PageNumber = 2,
                Parts = "$all",
            };

            var visitorManifest = new VisitorManifest { Age = "48", Birthdate = DateTime.Now, CardId = "2", CitizenshipCountry = "US", Contact = "3456789098", Department = "Crew", FirstName = "Ryan", Gender = "M", LastName = "Trott", MediaItemAddress = "http://gei.webv/btzay/izazh/nccmu.aspx", MiddleName = "henry", VisitorId = "1", VisitPurpose = "visit" };

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

            visitorManifest.MovementManifests.Add(new MovementManifest { VisitorId = "1", PersonTypeId = "1", PersonId = "2", GuestId = "2", CrewmemberId = "1", EventDate = DateTime.Now, Location = "MIAMI", Port = "aghj" });
            this.visitorManifest.Items.Add(visitorManifest);

            this.visitorManifestRepository.Setup(mockItem => mockItem.ListVisitorManifestAsync(It.IsNotNull<VisitorManifestSearchParameter>())).Returns(Task.FromResult(this.visitorManifest));
            var alert = await this.visitorManifestData.ListAsync(visitorSearchParameters);
            var searchQueryString = visitorSearchParameters.ToQueryString();
            Assert.IsNotNull(alert);
            Assert.IsTrue(searchQueryString.Contains("FirstName"));
            Assert.IsNotNull(alert);
        }
 /// <summary>
 /// Lists the visitor manifest asynchronous.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>Visitor manifest list</returns>
 public async Task<ListResult<VisitorManifest>> ListVisitorManifestAsync(VisitorManifestSearchParameter filter)
 {
     var task = await this.visitorManifestClient.RetrieveVisitorManifestListAsync(
         firstName: filter.FirstName,
         lastName: filter.LastName,
         departmentIds: filter.DepartmentId,
         visitorTypeId: filter.VisitorTypeId,
         boardingStatus: filter.BoardingStatus,
         clearanceStatus: filter.ClearanceStatus,
         movementActivityStartDate: filter.MovementActivityStartDate != null ? Convert.ToDateTime(filter.MovementActivityStartDate, CultureInfo.InvariantCulture) : default(DateTime?),
         movementActivityEndDate: filter.MovementActivityEndDate != null ? Convert.ToDateTime(filter.MovementActivityEndDate, CultureInfo.InvariantCulture) : default(DateTime?),
         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<VisitorManifest>>(task) : default(ListResult<VisitorManifest>);
 }
 public async Task RetrieveVisitorManifestsListAsyncTest()
 {
     try
     {
         this.SetupGetRequests();
         VisitorManifestSearchParameter objParam = new VisitorManifestSearchParameter();
         objParam.MaxResults = 50;
         objParam.PageNumber = 1;
         this.visitorManifestManager.Setup(mocketem => mocketem.ListAsync(It.IsNotNull<VisitorManifestSearchParameter>())).Returns(Task.FromResult(new ListResult<VisitorManifest>()));
         var response = await this.visitorManifestsController.Get(objParam);
         var result = await response.ExecuteAsync(new CancellationToken(false));
         Assert.IsTrue(result.IsSuccessStatusCode);
         Assert.AreEqual(HttpStatusCode.OK, result.StatusCode);
     }
     finally
     {
         this.Dispose();
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Assigns the visitor data.
 /// </summary>
 /// <param name="searchParameter">The parameter.</param>
 public void AssignVisitorData(VisitorManifestSearchParameter searchParameter)
 {
     if (searchParameter != null)
     {
         this.visitorManifestSearchParameter = searchParameter;
     }
 }
 /// <summary>
 /// Lists the asynchronous.
 /// </summary>
 /// <param name="filter">The filter.</param>
 /// <returns>
 /// Task containing visitor manifest and total results
 /// </returns>
 public async Task<ListResult<VisitorManifest>> ListAsync(VisitorManifestSearchParameter filter)
 {
     return await this.visitorManifestData.ListAsync(filter);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Retrieves the visitor manifest asynchronous.
 /// </summary>
 /// <param name="searchFilter">The search filter.</param>
 /// <returns>
 /// Visitor Manifest List according to search parameter
 /// </returns>
 public async Task<ListResult<VisitorManifest>> RetrieveVisitorManifestAsync(VisitorManifestSearchParameter 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(GetVisitorManifestRelativeAddress, BaseAddress, VisitorManifestResource, searchFilter.FirstName, searchFilter.LastName, searchFilter.DepartmentId, searchFilter.VisitorTypeId, searchFilter.BoardingStatus, searchFilter.ClearanceStatus, searchFilter.MovementActivityStartDate, searchFilter.MovementActivityEndDate, searchFilter.Gender, orderBy, searchFilter.PageSize, searchFilter.PageNumber);
     var visitorManifest = await this.httpClientHelper.Retrieve(uri, new CancellationToken(false));
     var visitorManifestData = !string.IsNullOrEmpty(visitorManifest) ? JsonConvert.DeserializeObject<ListResult<VisitorManifest>>(visitorManifest) : default(ListResult<VisitorManifest>);
     return visitorManifestData;
 }
 /// <summary>
 /// Lists the asynchronous.
 /// </summary>
 /// <param name="operationResult">The operation result.</param>
 /// <param name="visitormanifestSearchParameter">The visitor manifest search parameter.</param>
 /// <returns>the visitor manifest list</returns>
 private async Task ListAsync(OperationResult<ListResultWithMetadata<VisitorManifest>> operationResult, VisitorManifestSearchParameter visitormanifestSearchParameter)
 {
     var result = await this.visitorManager.ListAsync(visitormanifestSearchParameter);
     operationResult.Content = new ListResultWithMetadata<VisitorManifest>(result, visitormanifestSearchParameter, this.Request.RequestUri);
 }
 public async Task RetrieveVisitorManifestAsyncTests()
 {
     this.httpClientHelper.Setup(mock => mock.Retrieve(It.IsAny<string>(), It.IsAny<CancellationToken>())).Returns(Task.FromResult(string.Empty));
     var searchParameter = new VisitorManifestSearchParameter { BoardingStatus = "1", ClearanceStatus = "True", FirstName = "John", LastName = "Devis", MovementActivityEndDate = "15-07-2015", MovementActivityStartDate = "15-07-2016", SortBy = "Name", ThenBy = "staterooms" };
     await this.reportRepository.RetrieveVisitorManifestAsync(searchParameter);
     Assert.IsTrue(true);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Retrieves the visitor manifest asynchronous.
 /// </summary>
 /// <param name="searchFilter">The search filter.</param>
 /// <returns>
 /// Visitor Manifest List according to search parameter
 /// </returns>
 public async Task<ListResult<VisitorManifest>> RetrieveVisitorManifestAsync(VisitorManifestSearchParameter searchFilter)
 {
     return await this.reportRepository.RetrieveVisitorManifestAsync(searchFilter);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Visitors the manifest report.
 /// </summary>
 /// <returns>The Action Result.</returns>
 public ActionResult VisitorManifestReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     var visitorSearchParameter = new VisitorManifestSearchParameter
     {
         BoardingStatus = OneConst,
         ClearanceStatus = ZeroConst
     };
     reportPresenter.VisitorManifestSearchParameter = visitorSearchParameter;
     SetActivePage(reportPresenter, VisitorManifestReportView);
     SetVisitorFilterOption(reportPresenter);
     return this.View(VisitorManifestReportView, reportPresenter);
 }
Ejemplo n.º 11
0
        /// <summary>
        /// Visitors the manifest report print.
        /// </summary>
        /// <returns>The Task</returns>
        public async Task<ActionResult> VisitorManifestReportPrint()
        {
            var reportPresenter = new ReportPresenter();

            var searchFilter = new VisitorManifestSearchParameter();
            searchFilter = SessionData.Instance.VisitorManifestSearchParameter;
            searchFilter.PageSize = 0;
            searchFilter.PageNumber = 1;
            var visitorManifest = await this.reportManager.RetrieveVisitorManifestAsync(searchFilter);

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

            return this.View(VisitorManifestReportPrintView, reportPresenter);
        }