public async Task<ActionResult> DepartureExceptionReport(ReportPresenter reportPresenter, string pageNumber) { reportPresenter.Filters = SessionData.Instance.DepartureExceptionFilters != null && !string.IsNullOrEmpty(pageNumber) ? SessionData.Instance.DepartureExceptionFilters : reportPresenter.Filters; if (reportPresenter != null && reportPresenter.PersonTypes != null && reportPresenter.Filters != null) { var personType = reportPresenter.PersonTypes.FirstOrDefault(type => type.PersonTypeId == reportPresenter.Filters.PersonTypeId); reportPresenter.Filters.SearchType = personType != null ? personType.Name : string.Empty; reportPresenter.Filters.PageNumber = (!string.IsNullOrEmpty(pageNumber) && !pageNumber.Equals(UndefinedConstant)) ? (Convert.ToInt32(pageNumber) > 0 ? Convert.ToInt32(pageNumber) / ApplicationSettings.MaxPageSize : 1) : 1; reportPresenter.Filters.PageSize = SessionData.Instance.PagingNumberOfRecords; if (reportPresenter.Filters.VoyageId == null) { var voyage = reportPresenter.ActiveVoyages.OrderByDescending(d => d.EmbarkDate).FirstOrDefault(item => item.IsActive); reportPresenter.Filters.VoyageId = voyage != null ? voyage.VoyageId : string.Empty; } switch (reportPresenter.Filters.PersonTypeId) { case OneConst: var crewData = await this.reportManager.CrewDepartureExceptionAsync(reportPresenter.Filters); if (crewData.Items.Count > 0) { reportPresenter.AssignDepartureExceptionCrewManifestSearchResult(crewData); reportPresenter.TotalRecordCount = crewData.TotalResults; SessionData.Instance.AssignDepartureExceptionData(reportPresenter.Filters); } reportPresenter.NoRecordFound = crewData.Items.Count <= 0; break; case TwoConst: var guestData = await this.reportManager.GuestDepartureExceptionAsync(reportPresenter.Filters); if (guestData.Items.Count > 0) { reportPresenter.AssignDepartureExceptionGuestManifestSearchResult(guestData); reportPresenter.NoRecordFound = guestData.Items.Count <= 0; reportPresenter.TotalRecordCount = guestData.TotalResults; SessionData.Instance.AssignDepartureExceptionData(reportPresenter.Filters); } reportPresenter.NoRecordFound = guestData.Items.Count <= 0; break; case ThreeConst: var visitorData = await this.reportManager.VisitorDepartureExceptionAsync(reportPresenter.Filters); if (visitorData.Items.Count > 0) { reportPresenter.AssignDepartureExceptionVisitorManifestSearchResult(visitorData); reportPresenter.TotalRecordCount = visitorData.TotalResults; SessionData.Instance.AssignDepartureExceptionData(reportPresenter.Filters); } reportPresenter.NoRecordFound = visitorData.Items.Count <= 0; break; default: reportPresenter.NoRecordFound = true; break; } SessionData.Instance.AssignDepartureExceptionData(reportPresenter.Filters); } return this.PartialView(DepartureExceptionPartialView, reportPresenter); }
/// <summary> /// Departures the exception report print. /// </summary> /// <returns>The Task</returns> public async Task<ActionResult> DepartureExceptionReportPrint() { var reportPresenter = new ReportPresenter(); var searchFilter = new SearchFilters(); searchFilter = SessionData.Instance.DepartureExceptionFilters; searchFilter.PageSize = 0; searchFilter.PageNumber = 1; switch (searchFilter.PersonTypeId) { case OneConst: var crewData = await this.reportManager.CrewDepartureExceptionAsync(searchFilter); if (crewData != null && crewData.Items.Count > 0) { reportPresenter.AssignDepartureExceptionCrewManifestSearchResult(crewData); } break; case TwoConst: var guestData = await this.reportManager.GuestDepartureExceptionAsync(searchFilter); if (guestData != null && guestData.Items.Count > 0) { reportPresenter.AssignDepartureExceptionGuestManifestSearchResult(guestData); } break; case ThreeConst: var visitorData = await this.reportManager.VisitorDepartureExceptionAsync(searchFilter); if (visitorData != null && visitorData.Items.Count > 0) { reportPresenter.AssignDepartureExceptionVisitorManifestSearchResult(visitorData); } break; default: var guestDefaultData = await this.reportManager.GuestDepartureExceptionAsync(searchFilter); if (guestDefaultData != null && guestDefaultData.Items.Count > 0) { reportPresenter.AssignDepartureExceptionGuestManifestSearchResult(guestDefaultData); } break; } return this.View(DepartureExceptionReportPrintView, reportPresenter); }