Пример #1
0
        /// <summary>
        /// In port manning report print view.
        /// </summary>
        /// <returns>
        /// The Task
        /// </returns>
        public async Task<ActionResult> InPortManningReportPrint()
        {
            var reportPresenter = new ReportPresenter();
            reportPresenter.InPortManningReportSearchParameters = SessionData.Instance.InPortManningReportSearchParameters;
            var searchFilter = SessionData.Instance.InPortManningReportSearchParameters;
            searchFilter.PageSize = 0;
            searchFilter.PageNumber = 1;
            var inPortData = await this.reportManager.RetrieveInPortManningReportAsync(searchFilter);

            if (inPortData.Items.Count > 0)
            {
                reportPresenter.AssignInPortManningSearchResult(inPortData);
            }

            return this.View(InPortManningPrintView, reportPresenter);
        }
Пример #2
0
        public async Task<ActionResult> InPortManningReport(ReportPresenter presenter, string pageNumber)
        {
            presenter.InPortManningReportSearchParameters = SessionData.Instance.InPortManningReportSearchParameters != null && !string.IsNullOrEmpty(pageNumber) ? SessionData.Instance.InPortManningReportSearchParameters : presenter.InPortManningReportSearchParameters;

            if (presenter != null && presenter.InPortManningReportSearchParameters != null)
            {
                var voyages = SessionData.Instance.MasterData.Voyages.FirstOrDefault(c => c.VoyageId == presenter.InPortManningReportSearchParameters.VoyageId);
                var departments = !string.IsNullOrEmpty(presenter.InPortManningReportSearchParameters.DepartmentIds) ? presenter.InPortManningReportSearchParameters.DepartmentIds.Split(',').ToList() : null;
                presenter.InPortManningReportSearchParameters.DepartmentIds = departments != null && departments.Count < SessionData.Instance.MasterData.CrewDepartments.Count ? presenter.InPortManningReportSearchParameters.DepartmentIds : string.Empty;

                if (voyages != null)
                {
                    var selectedPort = voyages.Itineraries.FirstOrDefault(portItem => portItem.VoyageItineraryId == presenter.InPortManningReportSearchParameters.VoyageItineraryId);

                    if (selectedPort != null)
                    {
                        presenter.InPortManningReportSearchParameters.ShipId = selectedPort.ShipId;
                        presenter.InPortManningReportSearchParameters.AssignedDate = selectedPort.ArrivalTime.HasValue ? selectedPort.ArrivalTime.Value.ToString(ArrivalTimeFormat, CultureInfo.InvariantCulture) : string.Empty;
                        presenter.InPortManningReportSearchParameters.PortName = selectedPort.PortName;
                        presenter.InPortManningReportSearchParameters.ViewAssignedDate = selectedPort.ArrivalTime.HasValue ? string.Format(ArrivalDateFormat, selectedPort.ArrivalTime.Value) : string.Empty;
                        presenter.InPortManningReportSearchParameters.PortId = selectedPort.PortId;
                    }
                }

                presenter.InPortManningReportSearchParameters.PageNumber = (!string.IsNullOrEmpty(pageNumber) && !pageNumber.Equals(UndefinedConstant)) ? (Convert.ToInt32(pageNumber) > 0 ? Convert.ToInt32(pageNumber) / ApplicationSettings.MaxPageSize : 1) : 1;
                presenter.InPortManningReportSearchParameters.PageSize = SessionData.Instance.PagingNumberOfRecords;

                var inPortData = await this.reportManager.RetrieveInPortManningReportAsync(presenter.InPortManningReportSearchParameters);
                if (inPortData.Items.Count > 0)
                {
                    presenter.AssignInPortManningSearchResult(inPortData);
                    presenter.TotalRecordCount = inPortData.TotalResults;
                }

                presenter.NoRecordFound = inPortData.Items.Count <= 0;

                SessionData.Instance.AssignInPortManningData(presenter.InPortManningReportSearchParameters);
            }

            SetActivePage(presenter, InPortManningReportView);
            SetInPortManningFilterOption(presenter);

            return this.PartialView(InPortManningPartialView, presenter);
        }