コード例 #1
0
        public async Task<ActionResult> ExceptionReport(ReportPresenter reportPresenter, string pageNumber)
        {
            reportPresenter.ExceptionSearchParameters = SessionData.Instance.ExceptionReportSearchParameters != null && !string.IsNullOrEmpty(pageNumber) ? SessionData.Instance.ExceptionReportSearchParameters : reportPresenter.ExceptionSearchParameters;

            if (reportPresenter != null && reportPresenter.ExceptionSearchParameters != null)
            {
                reportPresenter.ExceptionSearchParameters.ClearanceStatus = reportPresenter.ExceptionSearchParameters.ClearanceStatus == ZeroConst ? string.Empty : reportPresenter.ExceptionSearchParameters.ClearanceStatus;
                reportPresenter.ExceptionSearchParameters.PageNumber = (!string.IsNullOrEmpty(pageNumber) && !pageNumber.Equals(UndefinedConstant)) ? (Convert.ToInt32(pageNumber) > 0 ? Convert.ToInt32(pageNumber) / ApplicationSettings.MaxPageSize : 1) : 1;
                reportPresenter.ExceptionSearchParameters.PageSize = SessionData.Instance.PagingNumberOfRecords;
                if (!string.IsNullOrEmpty(reportPresenter.ExceptionSearchParameters.SearchName))
                {
                    if (reportPresenter.ExceptionSearchParameters.SearchName.Contains(Comma))
                    {
                        var name = reportPresenter.ExceptionSearchParameters.SearchName.Trim().Split(Comma);
                        reportPresenter.ExceptionSearchParameters.LastName = name[0];
                        reportPresenter.ExceptionSearchParameters.FirstName = name[1].Trim();
                    }
                    else
                    {
                        reportPresenter.ExceptionSearchParameters.LastName = reportPresenter.ExceptionSearchParameters.SearchName.Trim();
                    }
                }

                if (reportPresenter.ExceptionSearchParameters.VoyageId == null)
                {
                    var voyage = reportPresenter.ActiveVoyages.OrderByDescending(d => d.EmbarkDate).FirstOrDefault(item => item.IsActive);
                    reportPresenter.ExceptionSearchParameters.VoyageId = voyage != null ? voyage.VoyageId : string.Empty;
                }

                var exceptions = await this.reportManager.RetrieveExceptionReportAsync(reportPresenter.ExceptionSearchParameters);
                if (exceptions.Items.Count > 0)
                {
                    reportPresenter.AssignExceptionSearchResult(exceptions);
                    reportPresenter.TotalRecordCount = exceptions.TotalResults;
                }

                SessionData.Instance.AssignExceptionData(reportPresenter.ExceptionSearchParameters);
                reportPresenter.NoRecordFound = exceptions.Items.Count <= 0;
            }

            return this.PartialView(ExceptionPartialView, reportPresenter);
        }
コード例 #2
0
        /// <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);
        }