Пример #1
0
        public ActionResult ProjectSearch(ProjectSearchViewModel model)
        {
            LoadSession();
            CurrentSessionApplicationState.ProjectSearchModel = model.ProjectSearchModel;

            //Redirect to the project list. Determine TIP Year (text) for redirect from appSession
            return new RedirectToRouteResult(
                              new RouteValueDictionary {
                              { "controller", "TIP" },
                              { "action", "ProjectList" },
                              { "year", CurrentSessionApplicationState.CurrentTIP }
                        });
        }
Пример #2
0
        public ProjectSearchViewModel GetProjectSearchViewModel(string currentProgram, string year)
        {
            var result = new ProjectSearchViewModel();

            // get project search model. This is now done in the (Tip)Controller.
            //result.ProjectSearchModel = this.GetProjectSearchModel();

            // fill form collections
            result.AvailableSponsors = GetCurrentTimePeriodSponsorAgencies(year, _appState).ToDictionary(x => (int)x.OrganizationId, x => x.OrganizationName);
            //result.AvailableSponsors = GetLookupCollection("Lookup_GetSponsorOrganizations", "Id", "Label");
            result.AvailableTipYears = GetLookupCollection("Lookup_GetTipYears", "Id", "Label");
            result.AvailableImprovementTypes = GetLookupCollection("Lookup_GetImprovementTypes", "Id", "Label");
            result.AvailableProjectTypes = GetLookupCollection("Lookup_GetProjectTypes", "Id", "Label");
            IList<SqlParameter> fundingParam = new List<SqlParameter>();
            fundingParam.Add(new SqlParameter("@ProgramId", (int)StringEnum.Parse(typeof(Enums.ApplicationState), currentProgram)));
            fundingParam.Add(new SqlParameter("@TimePeriodId", result.AvailableTipYears.FirstOrDefault(x=>x.Value == year).Key));
            result.AvailableFundingTypes = GetLookupCollection("Lookup_GetFundingTypes", "FundingTypeID", "FundingType", fundingParam);

            List<SqlParameter> sqlParms = new List<SqlParameter>();
            sqlParms.Add(new SqlParameter("@ProgramId", (int)StringEnum.Parse(typeof(Enums.ApplicationState), currentProgram)));
            result.AvailableVersionStatuses = GetLookupCollection("dbo.Lookup_GetVersionStatuses", "Id", "Label", sqlParms);
            result.AvailableGeographies = GetLookupCollection("[dbo].[Lookup_GetGeographies]", "Label");

            var regions = GetCategories(27).Select(x => new SelectListItem { Text = x.Value, Value = x.Key.ToString() }).ToList();
            regions.Insert(0, new SelectListItem { Text = "---(Include all or select from list)---", Value = "" });
            result.CdotRegions = regions;

               //Select the list of statuses appropriate for this program
            string statusType = "";
            switch (currentProgram)
            {
                case "Transportation Improvement Plan":
                    statusType = "Amendment Status";
                    break;
                case "Regional Transportation Plan":
                    statusType = "RTP Amendment Status";
                    break;
                case "Transportation Improvement Survey":
                    statusType = "Survey Amendment Status";
                    break;
                default:
                    statusType = "Amendment Status";
                    break;
            }

             IList<SqlParameter> paramList = new List<SqlParameter>();
             paramList.Add(new SqlParameter("@StatusType", statusType));
             result.AvailableAmendmentStatuses = GetLookupCollection("Lookup_GetStatuses", "Id", "Label", paramList);

            return result;
        }
Пример #3
0
        public ActionResult ProjectSearch(string year)
        {
            LoadSession();
            var viewModel = new ProjectSearchViewModel();

            //Get the current criteria out of session and stuff into the view model
            //ApplicationState session = this.GetSession();
            viewModel = _tipRepository.GetProjectSearchViewModel(StringEnum.GetStringValue(CurrentSessionApplicationState.CurrentProgram), year);
            viewModel.ProjectSearchModel = this.GetProjectSearchModel();

            viewModel.TipSummary.TipYear = year;
            viewModel.TipSummary.TipYearTimePeriodID = (short)_tipRepository.GetYearId(year, Enums.TimePeriodType.TimePeriod);

            viewModel.ProjectSearchModel.TipYear = year;
            viewModel.ProjectSearchModel.TipYearID = viewModel.TipSummary.TipYearTimePeriodID;

            return View(viewModel);
        }