/// <summary> /// Retrieves the Gangway History. /// </summary> /// <param name="searchParameters">The search parameters.</param> /// <returns> /// List result of person alert. /// </returns> public async Task<ListResult<GangwayHistory>> RetrieveEventListAsync(PersonHistorySearchParameters searchParameters) { var task = await this.personEventClient.RetrievePersonEventsListAsync(personTypeId: searchParameters.PersonTypeId, eventTypeIds: searchParameters.EventTypeIds, voyageIds: searchParameters.VoyageIds, personIds: searchParameters.PersonIds, machineName: searchParameters.MachineName, shipIds: searchParameters.ShipId, applicationIds: this.applicationSetting.ApplicationId.ToString(CultureInfo.InvariantCulture), eventDateFrom: searchParameters.FromDate, eventDateTo: searchParameters.ToDate, distinct: searchParameters.Distinct, parts: !string.IsNullOrWhiteSpace(searchParameters.Parts) ? searchParameters.Parts : Parts, pageNumber: searchParameters.PageNumber.RetrievePageNumber(), maxResults: searchParameters.MaxResults.RetrieveMaxResults(), orderBy: OrderBy); return task != null ? GangwayHistoryMapper.MapListAsync(JsonConvert.DeserializeObject<ListResult<PersonEvent>>(task)) : default(ListResult<GangwayHistory>); }
public async Task RetrieveRecentPersonListAsyncTestMethod() { try { var searchParameters = new PersonHistorySearchParameters { MaxResults = 50, PageNumber = 1, EventTypeIds = "1,2" }; CommonDependencies(); this.SetupData(); this.SetRecentPersonData(); this.SetupDataForStatusTypeList(); this.SetupRetrievePersonStatusListAsync(); this.SetupDataForPersonTypeList(); this.SetupVisitorDepartmentListAsync(); this.SetupVisitorVisitPurposeListAsync(); this.SetupRetrieveVisitTypeListAsync(); var response = await this.manager.RetrieveRecentPersonListAsync(searchParameters); Assert.IsNotNull(response); } finally { this.Dispose(); } }
/// <summary> /// Retrieves the event list asynchronous. /// </summary> /// <param name="searchParameters">The search parameters.</param> /// <returns> /// Return List result of Gangway History. /// </returns> public async Task<ListResult<GangwayHistory>> RetrieveEventListAsync(PersonHistorySearchParameters searchParameters) { return await this.personEventClientRepository.RetrieveEventListAsync(searchParameters); }
/// <summary> /// Retrieves the recent person list asynchronous. /// </summary> /// <param name="searchParameters">The search parameters.</param> /// <returns> /// Return List Result of person /// </returns> public async Task<ListResult<Person>> RetrieveRecentPersonListAsync(PersonHistorySearchParameters searchParameters) { var listResult = new ListResult<Person>(); var parameters = searchParameters; parameters.Distinct = TrueConstant; parameters.Parts = RecentPersonParts; var list = await this.personRepository.RetrievePersonEventsListAsync(parameters); if (list.Items.Count > 0) { var personTypeList = await this.referenceDataRepository.RetrievePersonTypeListAsync(); var guestTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(GuestType, StringComparison.OrdinalIgnoreCase)); var crewTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(CrewType, StringComparison.OrdinalIgnoreCase)); var visitorTypePerson = personTypeList.Items.FirstOrDefault(personType => personType.Name.Equals(VisitorType, StringComparison.OrdinalIgnoreCase)); var guestIds = guestTypePerson != null ? list.Items.DistinctBy(b => b.PersonId).Where(a => a.PersonTypeId.Equals(guestTypePerson.PersonTypeId)).ToList().RetrieveIds(a => a.PersonId) : null; var crewMemberIds = crewTypePerson != null ? list.Items.DistinctBy(b => b.PersonId).Where(a => a.PersonTypeId.Equals(crewTypePerson.PersonTypeId)).ToList().RetrieveIds(a => a.PersonId) : null; var visitorIds = visitorTypePerson != null ? list.Items.DistinctBy(b => b.PersonId).Where(a => a.PersonTypeId.Equals(visitorTypePerson.PersonTypeId)).ToList().RetrieveIds(a => a.PersonId) : null; listResult = await this.ListAsync(new PersonSearchParameter { AlertMessageStartDate = searchParameters.AlertMessageStartDate, AlertMessageEndDate = searchParameters.AlertMessageEndDate, GuestIds = guestIds, PersonType = PersonTypes.All, CrewmemberIds = crewMemberIds, VisitorIds = visitorIds, ShipId = parameters.ShipId, StartDate = searchParameters.FromDate, EndDate = searchParameters.ToDate, PageNumber = searchParameters.PageNumber, MaxResults = searchParameters.MaxResults, OrderBy = searchParameters.OrderBy }); } return listResult; }
public async Task RecentPersons() { try { var searchParameter = new PersonHistorySearchParameters { MaxResults = 5, PageNumber = 1, Distinct = "true", FromDate = DateTime.Now.ToString(), EventTypeIds = "1,2", AlertMessageStartDate = string.Empty, AlertMessageEndDate = string.Empty, ToDate = string.Empty }; var actionResult = await this.controller.RecentPersons(searchParameter); Assert.IsNotNull(actionResult); } finally { this.Dispose(); } }