コード例 #1
0
        public async Task <IActionResult> ReportChoiceSelectionAsync(PublicationReportModel model)
        {
            if (model.IsFrmReportChoice)
            {
                return(RedirectToAction("SelectValidate"));
            }

            return(RedirectToAction("Index", "UnPublish"));
        }
コード例 #2
0
        public IActionResult Index()
        {
            var model = new PublicationReportModel()
            {
                IsFrmReportChoice = false
            };

            return(View("Index", model));
        }
コード例 #3
0
        public async Task <IActionResult> ValidateFrmAsync(PublicationReportModel model)
        {
            var folderKey = model.PublicationDate.ToString("yyyy-MM-dd");
            var userName  = User.Name();
            var jobId     = await _reportsPublicationService.RunValidationAsync(model.CollectionName, folderKey, model.PeriodNumber, userName);

            var jobDetails = new JobDetails()
            {
                JobId        = jobId,
                PeriodNumber = model.PeriodNumber,
            };

            return(RedirectToAction("HoldingPageAsync", jobDetails));
        }
コード例 #4
0
        public async Task <IActionResult> ReportTypeChanged(PublicationReportModel model)
        {
            var collectionType = CollectionTypeConstants.Publication;
            var reportsData    = await _reportsPublicationService.GetReportsDataAsync(model.CollectionName);

            var lastTwoYears = await _reportsPublicationService.GetLastTwoCollectionYearsAsync(collectionType);

            var lastYearValue = lastTwoYears.LastOrDefault();

            model.PublishedFrm = reportsData.Where(x => x.CollectionYear == lastYearValue); // get all the open periods from the latest year period

            if (lastTwoYears.Count() > 1)                                                   //if there are more than two years in the collection
            {
                var firstYearValue = lastTwoYears.First();
                var firstYearList  = reportsData.Where(x => x.CollectionYear == firstYearValue).TakeLast(1); //take the most recent open period in the previous year
                model.PublishedFrm = firstYearList.Concat(model.PublishedFrm);                               // add it to the front of the list
            }

            var collections = await _collectionsService.GetCollectionsByType(CollectionTypeConstants.Publication);

            ViewData[ViewDataConstants.Collections] = collections.Select(x => x.CollectionTitle);

            return(View("Index", model));
        }