Пример #1
0
        public async Task<ActionResult> GuestManifestReport(ReportPresenter presenter, string pageNumber)
        {
            presenter.GuestManifestSearchParameter = SessionData.Instance.GuestManifestSearchParameter != null && !string.IsNullOrEmpty(pageNumber) ? SessionData.Instance.GuestManifestSearchParameter : presenter.GuestManifestSearchParameter;

            if (presenter != null && presenter.GuestManifestSearchParameter != null)
            {
                presenter.GuestManifestSearchParameter.ClearanceStatus = presenter.GuestManifestSearchParameter.ClearanceStatus == ZeroConst ? string.Empty : presenter.GuestManifestSearchParameter.ClearanceStatus;
                presenter.GuestManifestSearchParameter.PageNumber = (!string.IsNullOrEmpty(pageNumber) && !pageNumber.Equals(UndefinedConstant)) ? (Convert.ToInt32(pageNumber) > 0 ? Convert.ToInt32(pageNumber) / ApplicationSettings.MaxPageSize : 1) : 1;
                presenter.GuestManifestSearchParameter.PageSize = SessionData.Instance.PagingNumberOfRecords;

                if (!string.IsNullOrEmpty(presenter.GuestManifestSearchParameter.CheckedInStatus) && !string.IsNullOrWhiteSpace(presenter.GuestManifestSearchParameter.CheckedInStartDate) && !string.IsNullOrWhiteSpace(presenter.GuestManifestSearchParameter.CheckedInEndDate))
                {
                    presenter.GuestManifestSearchParameter.CheckedInStartDate = Convert.ToDateTime(presenter.GuestManifestSearchParameter.CheckedInStartDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                    presenter.GuestManifestSearchParameter.CheckedInEndDate = Convert.ToDateTime(presenter.GuestManifestSearchParameter.CheckedInEndDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                }

                if (presenter.GuestManifestSearchParameter.VoyageId == null)
                {
                    presenter.GuestManifestSearchParameter.VoyageId = GetVoyageId();
                }

                if (!string.IsNullOrEmpty(presenter.GuestManifestSearchParameter.SearchName))
                {
                    if (presenter.GuestManifestSearchParameter.SearchName.Contains(Comma))
                    {
                        var name = presenter.GuestManifestSearchParameter.SearchName.Trim().Split(Comma);
                        presenter.GuestManifestSearchParameter.LastName = name[0];
                        presenter.GuestManifestSearchParameter.FirstName = name[1].Trim();
                    }
                    else
                    {
                        presenter.GuestManifestSearchParameter.LastName = presenter.GuestManifestSearchParameter.SearchName.Trim();
                    }
                }

                if (presenter.GuestManifestSearchParameter.IsMovementActivity && !string.IsNullOrWhiteSpace(presenter.GuestManifestSearchParameter.MovementActivityStartDate) && !string.IsNullOrWhiteSpace(presenter.GuestManifestSearchParameter.MovementActivityEndDate))
                {
                    presenter.GuestManifestSearchParameter.MovementActivityStartDate = Convert.ToDateTime(presenter.GuestManifestSearchParameter.MovementActivityStartDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                    presenter.GuestManifestSearchParameter.MovementActivityEndDate = Convert.ToDateTime(presenter.GuestManifestSearchParameter.MovementActivityEndDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                }

                var guestManifest = await this.reportManager.RetrieveGuestManifestAsync(presenter.GuestManifestSearchParameter);
                if (guestManifest.Items.Count > 0)
                {
                    guestManifest.AssignItems(guestManifest.Items.Select(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) ? item.MediaItemAddress + AuthConst + presenter.AuthenticationToken + ImageSizeConst + ThumbnailConst : DefaultThumbnailImage; return item; }).ToList());
                    presenter.AssignGuestManifestSearchResult(guestManifest);
                    presenter.TotalRecordCount = guestManifest.TotalResults;
                }

                presenter.NoRecordFound = guestManifest.Items.Count <= 0;
                SessionData.Instance.AssignGuestData(presenter.GuestManifestSearchParameter);
            }

            return this.PartialView(GuestManifestPartialView, presenter);
        }
Пример #2
0
        /// <summary>
        /// Guests the manifest report print.
        /// </summary>
        /// <returns>The Task</returns>
        public async Task<ActionResult> GuestManifestReportPrint()
        {
            var reportPresenter = new ReportPresenter();

            var searchFilter = new GuestManifestSearchParameter();
            searchFilter = SessionData.Instance.GuestManifestSearchParameter;
            searchFilter.PageSize = 0;
            searchFilter.PageNumber = 1;
            var guestManifest = await this.reportManager.RetrieveGuestManifestAsync(searchFilter);

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

            return this.View(GuestManifestReportPrintView, reportPresenter);
        }