Exemple #1
0
        public FormReport()
        {
            InitializeComponent();
            Repository repository = new Repository();

            reportPresenter = new ReportPresenter(this, repository);
        }
Exemple #2
0
        public ReportForm()
        {
            this.presenter = new ReportPresenter(this);

            InitializeComponent();
            InitializeReportTypesMenu();
        }
Exemple #3
0
        private void BtnReport_Click(object sender, EventArgs e)
        {
            ReportForm      rf = new ReportForm();
            ReportPresenter rp = new ReportPresenter(reportManager, groupManager, rf);

            rf.ShowDialog();
        }
 public MainReportView()
 {
     InitializeComponent();
     this.FormBorderStyle = FormBorderStyle.FixedDialog;
     this.MinimumSize     = new Size(1000, 700);
     this.MaximumSize     = new Size(1000, 700);
     this.StartPosition   = FormStartPosition.CenterScreen;
     presenter            = new ReportPresenter(this);
     presenter.GetReport();
 }
        public async Task DepartureExceptionReportPosttest()
        {
            try
            {
                var reportPresenter = new ReportPresenter { Filters = new SearchFilters { MaxResult = 5 } };
                var departureExceptionCrewManifest = SetUpDepartureExceptionCrewManifest();
                var departureExceptionGuestManifest = SetUpDepartureExceptionGuestManifest();
                var departureExceptionVisitorManifest = SetUpDepartureExceptionVisitorManifest();

                this.reportManager.Setup(mockItem => mockItem.CrewDepartureExceptionAsync(It.IsNotNull<SearchFilters>())).Returns(Task.FromResult(departureExceptionCrewManifest));
                this.reportManager.Setup(mockItem => mockItem.GuestDepartureExceptionAsync(It.IsNotNull<SearchFilters>())).Returns(Task.FromResult(departureExceptionGuestManifest));
                this.reportManager.Setup(mockItem => mockItem.VisitorDepartureExceptionAsync(It.IsNotNull<SearchFilters>())).Returns(Task.FromResult(departureExceptionVisitorManifest));

                reportPresenter.PersonType = OneConst;
                reportPresenter.Filters = new SearchFilters { PersonTypeId = OneConst };
                var result = await this.reportController.DepartureExceptionReport(reportPresenter, OneConst) as PartialViewResult;
                Assert.AreEqual(DepartureExceptionPartialView, result.ViewName);
                Assert.IsNotNull(result);
                Assert.IsTrue(true);

                SessionData.Instance.DepartureExceptionFilters = new SearchFilters { PersonTypeId = OneConst };
                var viewResult = await this.reportController.DepartureExceptionReportPrint() as ViewResult;
                Assert.IsNotNull(viewResult);
                Assert.IsTrue(true);

                reportPresenter.PersonType = TwoConst;
                reportPresenter.Filters = new SearchFilters { PersonTypeId = TwoConst };
                result = await this.reportController.DepartureExceptionReport(reportPresenter, OneConst) as PartialViewResult;
                Assert.AreEqual(DepartureExceptionPartialView, result.ViewName);
                Assert.IsNotNull(result);
                Assert.IsTrue(true);

                SessionData.Instance.DepartureExceptionFilters = new SearchFilters { PersonTypeId = TwoConst };
                viewResult = await this.reportController.DepartureExceptionReportPrint() as ViewResult;
                Assert.IsNotNull(viewResult);
                Assert.IsTrue(true);

                reportPresenter.PersonType = ThreeConst;
                reportPresenter.Filters = new SearchFilters { PersonTypeId = ThreeConst };
                result = await this.reportController.DepartureExceptionReport(reportPresenter, OneConst) as PartialViewResult;
                Assert.AreEqual(DepartureExceptionPartialView, result.ViewName);
                Assert.IsNotNull(result);
                Assert.IsTrue(true);

                SessionData.Instance.DepartureExceptionFilters = new SearchFilters { PersonTypeId = ThreeConst };
                viewResult = await this.reportController.DepartureExceptionReportPrint() as ViewResult;
                Assert.IsNotNull(viewResult);
                Assert.IsTrue(true);

                reportPresenter.PersonType = string.Empty;
                result = await this.reportController.DepartureExceptionReport(reportPresenter, OneConst) as PartialViewResult;
                Assert.AreEqual(DepartureExceptionPartialView, result.ViewName);
                Assert.IsNotNull(result);
                Assert.IsTrue(true);

                SessionData.Instance.DepartureExceptionFilters = new SearchFilters { PersonTypeId = string.Empty };
                viewResult = await this.reportController.DepartureExceptionReportPrint() as ViewResult;
                Assert.IsNotNull(viewResult);
                Assert.IsTrue(true);
            }
            finally
            {
                this.Dispose();
            }
        }
 /// <summary>
 /// Locations the report.
 /// </summary>
 /// <returns>Location Report View</returns>
 public ActionResult LocationReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     var locationReportSearchParameters = new LocationReportSearchParameters { BoardingStatus = OneConst, ClearanceStatus = ZeroConst };
     reportPresenter.LocationSearchParameters = locationReportSearchParameters;
     SetActivePage(reportPresenter, LocationReportView);
     SetExceptionFilterOption(reportPresenter);
     return this.View(LocationReportView, reportPresenter);
 }
        /// <summary>
        /// Sets the crew filter option.
        /// </summary>
        /// <param name="reportPresenter">The report presenter.</param>
        private static void SetCrewFilterOption(ReportPresenter reportPresenter)
        {
            if (SessionData.Instance.MasterData.CrewDepartments != null && SessionData.Instance.MasterData.CrewDepartments.Count > 0)
            {
                var list = new List<CrewDepartment>();
                list.Add(new CrewDepartment { Name = "All Department", DepartmentId = string.Empty });
                foreach (var crew in SessionData.Instance.MasterData.CrewDepartments)
                {
                    list.Add(crew);
                }

                reportPresenter.CrewDepartments = list;
            }

            reportPresenter.FilterOptionList = new List<FilterOption> { new FilterOption { Id = "Stateroom", Name = "Cabin No." }, new FilterOption { Id = "Department", Name = "Department" }, new FilterOption { Id = "CrewmemberId", Name = "Id" }, new FilterOption { Id = "LastName", Name = "Last Name" }, new FilterOption { Id = "FirstName", Name = "First Name" }, new FilterOption { Id = "FssRole", Name = "Position" } };
        }
        /// <summary>
        /// Retrieves the guest reconciliation.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>
        /// The Task
        /// </returns>
        private async Task RetrieveGuestReconciliation(string type)
        {
            string reportName = "GuestReconciliation", reportTitle = "Guest Reconciliation Report", voyageIds = string.Empty;

            var searchFilter = SessionData.Instance.GuestReconciliationSearchParameters;
            searchFilter.PageSize = 0;
            searchFilter.PageNumber = 1;

            var reportPresenter = new ReportPresenter();

            var guestReconciliation = await this.reportManager.RetrieveGuestReconciliationReportAsync(searchFilter);
            if (guestReconciliation != null)
            {
                reportPresenter.MapGuestReconciliationSearchResult(guestReconciliation);
                if (reportPresenter.CheckedInGuestsItems.Count > 0)
                {
                    reportPresenter.CheckedInGuestsItems.ToList().ForEach(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) && CheckValidImagePath(item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst) ? new Uri(item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst).AbsoluteUri : GetImagePath(); });
                }

                if (reportPresenter.OnboardGuestsItems.Count > 0)
                {
                    reportPresenter.OnboardGuestsItems.ToList().ForEach(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) && CheckValidImagePath(item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst) ? new Uri(item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst).AbsoluteUri : GetImagePath(); });
                }
            }

            if (string.IsNullOrEmpty(searchFilter.VoyageId))
            {
                if (SessionData.Instance.MasterData.Voyages.Count > 0)
                {
                    voyageIds = string.Join(CommaSeparator, SessionData.Instance.MasterData.Voyages.Select(id => id.VoyageId));
                }
            }
            else
            {
                if (searchFilter.VoyageId.IndexOf(",", StringComparison.InvariantCultureIgnoreCase) > 0)
                {
                    var voyageList = searchFilter.VoyageId.Split(',');

                    foreach (var item in voyageList)
                    {
                        var voyageItem = SessionData.Instance.MasterData.Voyages.FirstOrDefault(voyage => voyage.VoyageId.Equals(item.ToString(CultureInfo.InvariantCulture)));
                        voyageIds += string.Format(CultureInfo.InvariantCulture, "{0}{1}", voyageItem != null ? voyageItem.Name : string.Empty, CommaSeparator);
                    }

                    voyageIds = voyageIds.TrimEnd(',');
                }
                else
                {
                    var voyageItem = SessionData.Instance.MasterData.Voyages.FirstOrDefault(voyage => voyage.VoyageId.Equals(searchFilter.VoyageId));
                    voyageIds = voyageItem != null ? voyageItem.Name : string.Empty;
                }
            }

            var dt = new DataTable();
            dt.Clear();
            dt.Columns.Add("System");
            dt.Columns.Add("Total");
            dt.Columns.Add("Onboard");
            dt.Columns.Add("No Show");

            foreach (var summary in reportPresenter.ShipSummaryItems)
            {
                DataRow dataRow = dt.NewRow();
                dataRow["System"] = summary.SystemType;
                dataRow["Total"] = summary.TotalOccupancy;
                dataRow["Onboard"] = summary.StatusCount;
                dataRow["No Show"] = summary.NoShowCount;
                dt.Rows.Add(dataRow);
            }

            var dataOG = new DataTable();
            dataOG.Clear();
            dataOG.Columns.Add("Stateroom");
            dataOG.Columns.Add("Name");
            dataOG.Columns.Add("Booking No");
            dataOG.Columns.Add("Sequence No");
            dataOG.Columns.Add("Apass Swipe Time");
            dataOG.Columns.Add("Photo");
            dataOG.Columns.Add("Cancellation");
            dataOG.Columns.Add("GuestStatus");

            foreach (var guest in reportPresenter.OnboardGuestsItems)
            {
                DataRow dataOGRow = dataOG.NewRow();
                dataOGRow["Stateroom"] = guest.Stateroom;
                dataOGRow["Name"] = guest.LastName + " " + guest.FirstName;
                dataOGRow["Booking No"] = guest.BookingNo;
                dataOGRow["Sequence No"] = guest.SequenceNumber;
                dataOGRow["Apass Swipe Time"] = guest.OnboardTime;
                dataOGRow["Photo"] = guest.MediaItemAddress;
                dataOGRow["Cancellation"] = string.Empty;
                dataOGRow["GuestStatus"] = guest.Status;
                dataOG.Rows.Add(dataOGRow);
            }

            var dataCI = new DataTable();
            dataCI.Clear();
            dataCI.Columns.Add("Stateroom");
            dataCI.Columns.Add("Name");
            dataCI.Columns.Add("Booking No");
            dataCI.Columns.Add("Checked-In Time");
            dataCI.Columns.Add("Check-In By");
            dataCI.Columns.Add("Photo");
            dataCI.Columns.Add("GuestStatus");

            foreach (var guest in reportPresenter.CheckedInGuestsItems)
            {
                DataRow dataCIRow = dataCI.NewRow();
                dataCIRow["Stateroom"] = guest.Stateroom;
                dataCIRow["Name"] = guest.LastName + " " + guest.FirstName;
                dataCIRow["Booking No"] = guest.BookingNo;
                dataCIRow["Checked-In Time"] = guest.CheckedInDate;
                dataCIRow["Check-In By"] = guest.CheckInBy;
                dataCIRow["Photo"] = guest.MediaItemAddress;
                dataCIRow["GuestStatus"] = guest.Status;
                dataCI.Rows.Add(dataCIRow);
            }

            DataSet dataSet = new DataSet();
            dataSet.Tables.Add(dt);
            dataSet.Tables.Add(dataOG);
            dataSet.Tables.Add(dataCI);

            if (type == ExcelConst)
            {
                this.excelProvider.PrepareExcel(dataSet, reportName, reportTitle, this.Response, this.Server, voyageIds);
            }
            else if (type == PDFConst)
            {
                string html = string.Empty;

                var pdfTable = new PdfPTable(4);
                pdfTable.DefaultCell.Padding = 3;
                pdfTable.WidthPercentage = 100;
                pdfTable.HorizontalAlignment = Element.ALIGN_LEFT;
                pdfTable.DefaultCell.BorderWidth = 1;

                var header = new PdfPCell(new Phrase("\nGuest Reconciliation Report", new Font(Font.FontFamily.TIMES_ROMAN, 30)));
                header.VerticalAlignment = Element.ALIGN_MIDDLE;
                header.HorizontalAlignment = Element.ALIGN_CENTER;
                header.FixedHeight = 100;
                header.Colspan = 17;
                pdfTable.AddCell(header);

                var summaryHeader = new PdfPCell(new Phrase("\nEmbarkation Statistics For " + voyageIds));
                summaryHeader.VerticalAlignment = Element.ALIGN_MIDDLE;
                summaryHeader.HorizontalAlignment = Element.ALIGN_CENTER;
                summaryHeader.FixedHeight = 50;
                summaryHeader.Colspan = 8;
                pdfTable.AddCell(summaryHeader);

                foreach (DataColumn column in dt.Columns)
                {
                    var cell = new PdfPCell();
                    cell = new PdfPCell(new Phrase(column.ColumnName));
                    cell.BackgroundColor = BaseColor.LIGHT_GRAY;
                    pdfTable.AddCell(cell);
                }

                foreach (DataRow row in dt.Rows)
                {
                    foreach (DataColumn column in dt.Columns)
                    {
                        pdfTable.AddCell(row[column.ColumnName].ToString());
                    }
                }

                iTextSharp.text.Image guestPhoto = null;

                var pdfOGTable = new PdfPTable(8);
                pdfOGTable.DefaultCell.Padding = 3;
                pdfOGTable.WidthPercentage = 100;
                pdfOGTable.HorizontalAlignment = Element.ALIGN_LEFT;
                pdfOGTable.DefaultCell.BorderWidth = 1;

                var onboardHeader = new PdfPCell(new Phrase("\nOnboard Not Checked In : " + reportPresenter.OnboardGuestsItems.Count));
                onboardHeader.VerticalAlignment = Element.ALIGN_MIDDLE;
                onboardHeader.HorizontalAlignment = Element.ALIGN_CENTER;
                onboardHeader.FixedHeight = 50;
                onboardHeader.Colspan = 8;
                pdfOGTable.AddCell(onboardHeader);

                foreach (DataColumn column in dataOG.Columns)
                {
                    var cell = new PdfPCell();
                    cell = new PdfPCell(new Phrase(column.ColumnName));
                    cell.BackgroundColor = BaseColor.LIGHT_GRAY;
                    pdfOGTable.AddCell(cell);
                }

                foreach (DataRow row in dataOG.Rows)
                {
                    foreach (DataColumn column in dataOG.Columns)
                    {
                        if (column.ColumnName == PhotoConst)
                        {
                            var cell = new PdfPCell();
                            guestPhoto = iTextSharp.text.Image.GetInstance(row[column.ColumnName].ToString());
                            guestPhoto.ScaleAbsolute(40f, 60f);
                            cell.FixedHeight = 80f;
                            cell = new PdfPCell(guestPhoto);
                            cell.HorizontalAlignment = Element.ALIGN_CENTER;
                            cell.VerticalAlignment = Element.ALIGN_MIDDLE;
                            cell.PaddingTop = 5f;
                            cell.PaddingBottom = 5f;
                            pdfOGTable.AddCell(cell);
                        }
                        else
                        {
                            var cell = new PdfPCell();
                            cell = new PdfPCell(new Phrase(row[column.ColumnName].ToString()));
                            pdfOGTable.AddCell(cell);
                        }
                    }
                }

                var pdfCITable = new PdfPTable(7);
                pdfCITable.DefaultCell.Padding = 3;
                pdfCITable.WidthPercentage = 100;
                pdfCITable.HorizontalAlignment = Element.ALIGN_LEFT;
                pdfCITable.DefaultCell.BorderWidth = 1;
                var checkedInHeader = new PdfPCell(new Phrase("\nChecked-in But Not Onboard : " + reportPresenter.CheckedInGuestsItems.Count));
                checkedInHeader.VerticalAlignment = Element.ALIGN_MIDDLE;
                checkedInHeader.HorizontalAlignment = Element.ALIGN_CENTER;
                checkedInHeader.FixedHeight = 50;
                checkedInHeader.Colspan = 8;
                pdfCITable.AddCell(checkedInHeader);

                foreach (DataColumn column in dataCI.Columns)
                {
                    var cell = new PdfPCell();
                    cell = new PdfPCell(new Phrase(column.ColumnName));
                    cell.BackgroundColor = BaseColor.LIGHT_GRAY;
                    pdfCITable.AddCell(cell);
                }

                foreach (DataRow row in dataCI.Rows)
                {
                    foreach (DataColumn column in dataCI.Columns)
                    {
                        if (column.ColumnName == PhotoConst)
                        {
                            var cell = new PdfPCell();
                            guestPhoto = iTextSharp.text.Image.GetInstance(row[column.ColumnName].ToString());
                            guestPhoto.ScaleAbsolute(40f, 60f);
                            cell.FixedHeight = 80f;
                            cell = new PdfPCell(guestPhoto);
                            cell.HorizontalAlignment = Element.ALIGN_CENTER;
                            cell.VerticalAlignment = Element.ALIGN_MIDDLE;
                            cell.PaddingTop = 5f;
                            cell.PaddingBottom = 5f;
                            pdfCITable.AddCell(cell);
                        }
                        else
                        {
                            var cell = new PdfPCell();
                            cell = new PdfPCell(new Phrase(row[column.ColumnName].ToString()));
                            pdfCITable.AddCell(cell);
                        }
                    }
                }

                var sr = new StringReader(html);
                var pdfDoc = new Document(PageSize.A2, 10f, 10f, 10f, 0f);
                PdfWriter wri = PdfWriter.GetInstance(pdfDoc, this.Response.OutputStream);
                pdfDoc.Open();
                pdfDoc.Add(pdfTable);
                pdfDoc.Add(pdfOGTable);
                pdfDoc.Add(pdfCITable);
                XMLWorkerHelper.GetInstance().ParseXHtml(wri, pdfDoc, sr);
                pdfDoc.Close();
                Response.ContentType = PDFTypeConst;
                Response.AddHeader(ContentDisposition, "attachment;filename=GuestReconciliationReport.pdf");
                Response.Cache.SetCacheability(HttpCacheability.NoCache);
                Response.Write(pdfDoc);
                Response.End();
            }
        }
 /// <summary>
 /// Movements the summary report.
 /// </summary>
 /// <returns>The Action Result.</returns>
 public ActionResult MovementSummaryReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     SetActivePage(reportPresenter, MovementSummaryReportView);
     return this.View(MovementSummaryReportView, reportPresenter);
 }
 /// <summary>
 /// Sets the visitor filter option.
 /// </summary>
 /// <param name="reportPresenter">The report presenter.</param>
 private static void SetVisitorFilterOption(ReportPresenter reportPresenter)
 {
     reportPresenter.FilterOptionList = new List<FilterOption> { new FilterOption { Id = "Department", Name = "Department" }, new FilterOption { Id = "VisitorId", Name = "Id" }, new FilterOption { Id = "LastName", Name = "Last Name" }, new FilterOption { Id = "FirstName", Name = "First Name" } };
 }
        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);
        }
 /// <summary>
 /// Guests the reconciliation report.
 /// </summary>
 /// <returns>The Action Result.</returns>
 public ActionResult GuestReconciliationReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     SetActivePage(reportPresenter, GuestReconciliationReportView);
     SetGuestFilterOption(reportPresenter);
     return this.View(GuestReconciliationReportView, reportPresenter);
 }
 /// <summary>
 /// Sets the active page.
 /// </summary>
 /// <param name="reportPresenter">The report presenter.</param>
 /// <param name="pageName">Name of the page.</param>
 private static void SetActivePage(ReportPresenter reportPresenter, string pageName)
 {
     reportPresenter.ActivePageName = pageName;
 }
 /// <summary>
 /// Indexes this instance.
 /// </summary>
 /// <returns>default Report View</returns>
 public ActionResult Index()
 {
     var reportPresenter = new ReportPresenter();
     SetActivePage(reportPresenter, ReportView);
     return this.View(reportPresenter);
 }
 /// <summary>
 /// Sets the other filter option.
 /// </summary>
 /// <param name="reportPresenter">The report presenter.</param>
 private static void SetExceptionFilterOption(ReportPresenter reportPresenter)
 {
     reportPresenter.FilterOptionList = new List<FilterOption> { new FilterOption { Id = "Stateroom", Name = "Stateroom" }, new FilterOption { Id = "PersonId", Name = "Id" }, new FilterOption { Id = "LastName", Name = "Last Name" }, new FilterOption { Id = "FirstName", Name = "First Name" } };
 }
 /// <summary>
 /// Sets the other filter option.
 /// </summary>
 /// <param name="reportPresenter">The report presenter.</param>
 private static void SetOtherFilterOption(ReportPresenter reportPresenter)
 {
     reportPresenter.FilterOptionList = new List<FilterOption> { new FilterOption { Id = "Stateroom", Name = "Cabin No." }, new FilterOption { Id = "Department", Name = "Department" }, new FilterOption { Id = "PersonId", Name = "Id" }, new FilterOption { Id = "LastName", Name = "Last Name" }, new FilterOption { Id = "FirstName", Name = "First Name" }, new FilterOption { Id = "FssRole", Name = "Position" } };
 }
        /// <summary>
        /// Sets the in port manning filter option.
        /// </summary>
        /// <param name="reportPresenter">The report presenter.</param>
        private static void SetInPortManningFilterOption(ReportPresenter reportPresenter)
        {
            reportPresenter.FilterOptionList = new List<FilterOption> { new FilterOption { Id = "SafetyNo", Name = "Safety Number" }, new FilterOption { Id = "CrewName", Name = "Name" } };

            reportPresenter.SafetyPosition = new List<SafetyPosition> { new SafetyPosition { PositionTypeId = string.Empty, PositionName = "All" }, new SafetyPosition { PositionTypeId = "1", PositionName = "With Assignment" }, new SafetyPosition { PositionTypeId = "2", PositionName = "Without Assignment" } };
        }
 /// <summary>
 /// Guests the manifest report.
 /// </summary>
 /// <returns>
 /// The Action Result.
 /// </returns>
 public ActionResult GuestManifestReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     reportPresenter.GuestManifestSearchParameter = new GuestManifestSearchParameter();
     SetActivePage(reportPresenter, GuestManifestReportView);
     SetGuestFilterOption(reportPresenter);
     return this.View(GuestManifestReportView, reportPresenter);
 }
 /// <summary>
 /// Exceptions the report.
 /// </summary>
 /// <returns>Exception Report View</returns>
 public ActionResult ExceptionReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     reportPresenter.ExceptionSearchParameters = new ExceptionReportSearchParameters();
     SetActivePage(reportPresenter, ExceptionReportView);
     SetExceptionFilterOption(reportPresenter);
     return this.View(ExceptionReportView, reportPresenter);
 }
        public async Task<ActionResult> CBPSummaryReport(ReportPresenter reportPresenter)
        {
            if (reportPresenter != null && reportPresenter.Filters != null)
            {
                var shipTime = BaseController.GenerateLocalDateTime(DateTime.UtcNow);
                reportPresenter.Filters.ShipTime = shipTime.ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                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;
                }

                var summaryReport = await this.reportManager.RetrieveCBPSummaryReportAsync(reportPresenter.Filters);
                if (summaryReport.Items.Count > 0)
                {
                    reportPresenter.AssignCBPSummarySearchResult(summaryReport);
                    reportPresenter.TotalRecordCount = summaryReport.Items.Count;
                }

                reportPresenter.NoRecordFound = summaryReport.Items.Count <= 0;
                SessionData.Instance.AssignCBPData(reportPresenter.Filters);
            }

            return this.PartialView(CBPSummaryPartialView, reportPresenter);
        }
        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);
        }
        public async Task<ActionResult> GuestReconciliationReport(ReportPresenter reportPresenter, string pageNumber)
        {
            reportPresenter.GuestReconciliationSearchParameters = SessionData.Instance.GuestReconciliationSearchParameters != null && !string.IsNullOrEmpty(pageNumber) ? SessionData.Instance.GuestReconciliationSearchParameters : reportPresenter.GuestReconciliationSearchParameters;

            if (reportPresenter != null && reportPresenter.GuestReconciliationSearchParameters != null)
            {
                reportPresenter.GuestReconciliationSearchParameters.PageNumber = (!string.IsNullOrEmpty(pageNumber) && !pageNumber.Equals(UndefinedConstant)) ? (Convert.ToInt32(pageNumber) > 0 ? Convert.ToInt32(pageNumber) / ApplicationSettings.MaxPageSize : 1) : 1;
                if (string.IsNullOrEmpty(reportPresenter.GuestReconciliationSearchParameters.VoyageId))
                {
                    var voyage = reportPresenter.ActiveVoyages.OrderByDescending(d => d.EmbarkDate).FirstOrDefault(item => item.IsActive);
                    reportPresenter.GuestReconciliationSearchParameters.VoyageName = voyage != null ? voyage.Name : string.Empty;
                    reportPresenter.GuestReconciliationSearchParameters.VoyageId = voyage != null ? voyage.VoyageId : string.Empty;
                }
                else
                {
                    var voyage = reportPresenter.ActiveVoyages.FirstOrDefault(item => item.VoyageId.Equals(reportPresenter.GuestReconciliationSearchParameters.VoyageId));
                    reportPresenter.GuestReconciliationSearchParameters.VoyageName = voyage != null ? voyage.Name : string.Empty;
                }

                reportPresenter.GuestReconciliationSearchParameters.ShipId = SessionData.Instance.MasterData.Ship.ShipId;
                reportPresenter.GuestReconciliationSearchParameters.ItineraryDate = BaseController.GenerateLocalDateTime(DateTime.UtcNow).ToString(this.ApplicationSettings.ShipDateTimeFormat);
                reportPresenter.GuestReconciliationSearchParameters.PageSize = SessionData.Instance.PagingNumberOfRecords;
                reportPresenter.GuestReconciliationSearchParameters.ExceptionStartDate = !string.IsNullOrEmpty(reportPresenter.GuestReconciliationSearchParameters.ExceptionStartDate) ? Convert.ToDateTime(reportPresenter.GuestReconciliationSearchParameters.ExceptionStartDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture) : null;
                reportPresenter.GuestReconciliationSearchParameters.ExceptionEndDate = !string.IsNullOrEmpty(reportPresenter.GuestReconciliationSearchParameters.ExceptionEndDate) ? Convert.ToDateTime(reportPresenter.GuestReconciliationSearchParameters.ExceptionEndDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture) : null;

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

                var guestReconciliation = await this.reportManager.RetrieveGuestReconciliationReportAsync(reportPresenter.GuestReconciliationSearchParameters);
                if (guestReconciliation != null)
                {
                    reportPresenter.MapGuestReconciliationSearchResult(guestReconciliation);
                    if (reportPresenter.CheckedInGuestsItems.Count > 0)
                    {
                        reportPresenter.CheckedInGuestsItems.ToList().ForEach(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) ? item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst : DefaultThumbnailImage; });
                    }

                    if (reportPresenter.OnboardGuestsItems.Count > 0)
                    {
                        reportPresenter.OnboardGuestsItems.ToList().ForEach(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) ? item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst : DefaultThumbnailImage; });
                    }

                    reportPresenter.TotalRecordCount = guestReconciliation.GuestReconciliationReport.TotalResult;

                    reportPresenter.TotalOnboardGuest = guestReconciliation.GuestReconciliationReport.TotalOnboardGuest;

                    reportPresenter.TotalCheckedInGuest = guestReconciliation.GuestReconciliationReport.TotalCheckedInGuest;
                }

                reportPresenter.NoRecordFound = reportPresenter.ShipSummaryItems.Count <= 0 && reportPresenter.CheckedInGuestsItems.Count <= 0 && reportPresenter.OnboardGuestsItems.Count <= 0;
                SessionData.Instance.AssignGuestReconciliationData(reportPresenter.GuestReconciliationSearchParameters);
            }

            return this.PartialView(GuestReconciliationPartialView, reportPresenter);
        }
 /// <summary>
 /// Movements the report.
 /// </summary>
 /// <returns>Movement Report View</returns>
 public ActionResult MovementReport()
 {
     var reportPresenter = new ReportPresenter();
     var movementReportSearchParameters = new MovementReportSearchParameters { ClearanceStatus = ZeroConst };
     SetData(reportPresenter);
     reportPresenter.MovementSearchParameters = movementReportSearchParameters;
     SetActivePage(reportPresenter, MovementReportView);
     SetExceptionFilterOption(reportPresenter);
     return this.View(MovementReportView, reportPresenter);
 }
 /// <summary>
 /// Ins the port manning report.
 /// </summary>
 /// <returns>The Action Result.</returns>
 public ActionResult InPortManningReport()
 {
     var reportPresenter = new ReportPresenter();
     SetActivePage(reportPresenter, InPortManningReportView);
     SetInPortManningFilterOption(reportPresenter);
     return this.View(InPortManningReportView, reportPresenter);
 }
        public async Task<ActionResult> MovementReport(ReportPresenter reportPresenter, string pageNumber)
        {
            reportPresenter.MovementSearchParameters = SessionData.Instance.MovementReportSearchParameters != null && !string.IsNullOrEmpty(pageNumber) ? SessionData.Instance.MovementReportSearchParameters : reportPresenter.MovementSearchParameters;

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

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

                if (!string.IsNullOrEmpty(reportPresenter.MovementSearchParameters.MovementActivityStartDate) && !string.IsNullOrEmpty(reportPresenter.MovementSearchParameters.MovementActivityEndDate))
                {
                    reportPresenter.MovementSearchParameters.MovementActivityStartDate = Convert.ToDateTime(reportPresenter.MovementSearchParameters.MovementActivityStartDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                    reportPresenter.MovementSearchParameters.MovementActivityEndDate = Convert.ToDateTime(reportPresenter.MovementSearchParameters.MovementActivityEndDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                }

                var movement = await this.reportManager.RetrieveMovementReportAsync(reportPresenter.MovementSearchParameters);
                if (movement.Items.Count > 0)
                {
                    movement.AssignItems(movement.Items.Select(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) ? item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst : DefaultThumbnailImage; return item; }).ToList());
                    reportPresenter.AssignMovementSearchResult(movement);
                    reportPresenter.TotalRecordCount = movement.TotalResults;
                }

                reportPresenter.NoRecordFound = movement.Items.Count <= 0;
                SessionData.Instance.AssignMovementData(reportPresenter.MovementSearchParameters);
            }

            return this.PartialView(MovementPartialView, reportPresenter);
        }
Exemple #26
0
 protected void Page_Load(object sender, EventArgs e)
 {
     _presenter = new ReportPresenter();
 }
 /// <summary>
 /// Crews the manifest report.
 /// </summary>
 /// <returns>Crew Manifest Report View</returns>
 public ActionResult CrewManifestReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     SetCrewFilterOption(reportPresenter);
     var crewSearchParameters = new CrewManifestSearchParameters { DepartmentIds = string.Empty, BoardingStatus = OneConst, ClearanceStatus = ZeroConst, SignedOnStatus = OneConst };
     reportPresenter.CrewManifestSearchParameters = crewSearchParameters;
     SetActivePage(reportPresenter, CrewManifestReportView);
     return this.View(CrewManifestReportView, reportPresenter);
 }
Exemple #28
0
        public ReportView()
        {
            InitializeComponent();

            _presenter = new ReportPresenter(this);
        }
        public async Task<ActionResult> CrewManifestReport(ReportPresenter reportPresenter, string pageNumber)
        {
            reportPresenter.CrewManifestSearchParameters = SessionData.Instance.CrewManifestSearchParameters != null && !string.IsNullOrEmpty(pageNumber) ? SessionData.Instance.CrewManifestSearchParameters : reportPresenter.CrewManifestSearchParameters;

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

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

                if (!string.IsNullOrEmpty(reportPresenter.CrewManifestSearchParameters.SignedOnStatus) && reportPresenter.CrewManifestSearchParameters.SignedOnStatus.Equals(ZeroConst) && !string.IsNullOrWhiteSpace(reportPresenter.CrewManifestSearchParameters.SignedOnStartDate) && !string.IsNullOrWhiteSpace(reportPresenter.CrewManifestSearchParameters.SignedOnEndDate))
                {
                    reportPresenter.CrewManifestSearchParameters.SignedOnStartDate = Convert.ToDateTime(reportPresenter.CrewManifestSearchParameters.SignedOnStartDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                    reportPresenter.CrewManifestSearchParameters.SignedOnEndDate = Convert.ToDateTime(reportPresenter.CrewManifestSearchParameters.SignedOnEndDate).ToString(this.ApplicationSettings.ShipDateTimeFormat, CultureInfo.InvariantCulture);
                }

                var crewDetail = await this.reportManager.GetAsync(reportPresenter.CrewManifestSearchParameters);
                if (crewDetail.Items.Count > 0)
                {
                    crewDetail.AssignItems(crewDetail.Items.Select(item => { item.MediaItemAddress = !string.IsNullOrEmpty(item.MediaItemAddress) ? item.MediaItemAddress + AuthConst + reportPresenter.AuthenticationToken + ImageSizeConst + ThumbnailConst : DefaultThumbnailImage; return item; }).ToList());
                    reportPresenter.AssignCrewManifest(crewDetail);
                    reportPresenter.TotalRecordCount = crewDetail.TotalResults;
                }

                reportPresenter.NoRecordFound = crewDetail.Items.Count <= 0;
                SessionData.Instance.AssignCrewData(reportPresenter.CrewManifestSearchParameters);
            }

            return this.PartialView(CrewManifestPartialView, reportPresenter);
        }
 /// <summary>
 /// Departures the exception report.
 /// </summary>
 /// <returns>Departure Exception Report View</returns>
 public ActionResult DepartureExceptionReport()
 {
     var reportPresenter = new ReportPresenter();
     SetData(reportPresenter);
     SetActivePage(reportPresenter, DepartureExceptionReportView);
     return this.View(DepartureExceptionReportView, reportPresenter);
 }
        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);
        }
        public async Task SummaryReportPosttest()
        {
            try
            {
                var reportPresenter = new ReportPresenter();
                reportPresenter.SelectedCitizenship = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247";
                var cbpSummaryData = SetUpCBPSummaryReportData();
                this.reportManager.Setup(mockItem => mockItem.RetrieveCBPSummaryReportAsync(It.IsNotNull<SearchFilters>())).Returns(Task.FromResult(cbpSummaryData));

                var result = await this.reportController.CBPSummaryReport(reportPresenter) as PartialViewResult;
                Assert.AreEqual(CBPSummaryPartialView, result.ViewName);
                Assert.IsNotNull(result);
                Assert.IsTrue(true);

                reportPresenter.SelectedCitizenship = "1,2,3,4,5,17,18,19";
                reportPresenter.Filters = new SearchFilters { PageSize = 1 };
                result = await this.reportController.CBPSummaryReport(reportPresenter) as PartialViewResult;
                Assert.AreEqual(CBPSummaryPartialView, result.ViewName);
                Assert.IsNotNull(result);
                Assert.IsTrue(true);

                var viewResult = await this.reportController.GuestCBPReportPrint();
                Assert.IsTrue(true);
                Assert.IsNotNull(viewResult);
            }
            finally
            {
                this.Dispose();
            }
        }
 /// <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);
 }
 public ReportsController(IReportUseCase reportUseCase, ReportPresenter reportPresenter)
 {
     _reportUseCase   = reportUseCase;
     _reportPresenter = reportPresenter;
 }
        /// <summary>
        /// Sets the date.
        /// </summary>
        /// <param name="reportPresenter">The report presenter.</param>
        private static void SetData(ReportPresenter reportPresenter)
        {
            reportPresenter.DepartureExceptionPersonTypes = new List<PersonType> { new PersonType { PersonTypeId = "1", Name = "Crew Signed-on but not On-board" }, new PersonType { PersonTypeId = "2", Name = "Guest Checked-in but not On-board" }, new PersonType { PersonTypeId = "3", Name = "Visitor still On-board" } };

            reportPresenter.GenderList = new List<Gender> { new Gender { Id = string.Empty, Name = "Both" }, new Gender { Id = "M", Name = "Male" }, new Gender { Id = "F", Name = "Female" } };

            reportPresenter.CrewReportStatusList = new List<FilterOption> { new FilterOption { Id = "1", Name = "Signed-on" }, new FilterOption { Id = "2", Name = "Not Signed-on" }, new FilterOption { Id = "0", Name = "Scheduled On" } };

            reportPresenter.ReportStatusList = new List<FilterOption> { new FilterOption { Id = "1", Name = "Checked-in" }, new FilterOption { Id = "2", Name = "Not Checked-in" }, new FilterOption { Id = "0", Name = "Expected to check-in" } };

            reportPresenter.ReportClearanceList = new List<FilterOption> { new FilterOption { Id = "0", Name = "All Clearance Status" }, new FilterOption { Id = "2", Name = "Not Cleared" }, new FilterOption { Id = "1", Name = "Cleared" } };

            reportPresenter.ReportBoardingStatusListList = new List<FilterOption> { new FilterOption { Id = string.Empty, Name = "All Boarding" }, new FilterOption { Id = "1", Name = "Onboard" }, new FilterOption { Id = "2", Name = "Ashore" } };

            reportPresenter.EntriesList = new List<FilterOption> { new FilterOption { Id = "1", Name = "Entries" }, new FilterOption { Id = "2", Name = "Exits" }, new FilterOption { Id = string.Empty, Name = "Entries and Exits" } };

            reportPresenter.ExceptionList = new List<FilterOption> { new FilterOption { Id = "1", Name = "Missing Picture" }, new FilterOption { Id = "2", Name = "Expired Card" }, new FilterOption { Id = "3", Name = "Onboard but not checked-in" }, new FilterOption { Id = "4", Name = "Checked-in but not onboard" } };
        }