public ActionResult ProposedAmendmentList(string year)
        {
            var viewModel = new ProjectListViewModel();
            viewModel.TipSummary.TipYear = year;
            //viewModel.ProjectList = _tipRepository.GetProposedTIPProjects(year).Projects;

            return View(viewModel);
        }
        public ActionResult RestoreProjectList(string yearDestination, int yearSourceID, string tipID)
        {
            var viewModel = new ProjectListViewModel();
            viewModel.TipSummary.TipYear = yearDestination;

            //This is not going to work because we are going to need multiple search criteria.
            //var projectSearchModel = new TIPSearchModel();
            //projectSearchModel.TipYear = year;
            //viewModel.ProjectList = _tipRepository.GetTIPProjects(projectSearchModel);

            viewModel.ProjectList = _tipRepository.GetTIPRestoreCandidateProjects(yearDestination, yearSourceID, tipID);

            return View(viewModel);
        }
        /// <summary>
        /// Returns a list of projects associated with this TIP
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public ActionResult ProjectListCustom(TIPSearchModel projectSearchModel)
        {
            //DTS did NOT undersand this. The 'year' variable here is NOT a search criterium. -DBD
            //The 'df' variable is a dashboard (quick search) filter.

            LoadSession();

            projectSearchModel.VersionStatusId = (int)Enums.TIPVersionStatus.Active;

            var viewModel = new ProjectListViewModel();
            viewModel.TipSummary.TipYear = projectSearchModel.TipYear;
            viewModel.ProjectList = GetProjectList(projectSearchModel);
            viewModel.CurrentSponsors = _tipRepository.GetCurrentTimePeriodSponsorAgencies(projectSearchModel.TipYear, Enums.ApplicationState.TIP).ToDictionary(x => (int)x.OrganizationId, x => x.OrganizationName);

            return View(viewModel);
        }
        /// <summary>
        /// Returns a list of projects associated with this TIP
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public ActionResult ProjectList(string year, string dft, string df, int? page, int? amendmentTypeId, int? amendmentStatusId)
        {
            //DTS did NOT undersand this. The 'year' variable here is NOT a search criterium. -DBD
            //The 'df' variable is a dashboard (quick search) filter.

            LoadSession();
            //CurrentSessionApplicationState.ProjectSearchModel = null;
            //Get a reference to session object
            //ApplicationState appSession = this.GetSession();
            //ApplicationState appSession = (ApplicationState)Session[DRCOGApp.SessionIdentifier];

            //Make a ProjectViewModel object from the search criteria
            var projectSearchModel = (CurrentSessionApplicationState.ProjectSearchModel as TIPSearchModel) ?? new TIPSearchModel();
            //CurrentSessionApplicationState.ProjectSearchModel = null;

            //If there is a 'df' dashboard filter, then the Session search criteria are reset.
            if (df != null)
            {
                //Reset Session search criteria
                //CurrentSessionApplicationState.ProjectSearchModel = null;

                //Assign dashboard search filter criteria
                projectSearchModel.TipYear = year;

                //ToDo: convert 'df' we need to know what DashboardListType ('dft') it is (Sponsor = 1,ProjectType = 2,AmendmentStatus = 3)
                //ToDo: Assign the 'df' variable to projectSearchModel
                switch (dft)
                {
                    case "AmendmentStatus":
                        projectSearchModel.AmendmentStatus = df;
                        break;
                    case "Sponsor":
                        projectSearchModel.SponsorAgency = df;
                        break;
                    case "ProjectType":
                        projectSearchModel.ProjectType = df;
                        break;
                    case "ImprovementType":
                        projectSearchModel.ImprovementType = df;
                        break;
                }

                //Assume from dashboard that we only want active projects.
                projectSearchModel.VersionStatusId = (int)Enums.TIPVersionStatus.Active;
            }
            //else if (projectSearchModel.AmendmentStatusID.HasValue)
            //{
            //    projectSearchModel.TipYear = year;
            //    projectSearchModel.AmendmentTypeId = (int)amendmentTypeId;
            //    projectSearchModel.AmendmentStatusID = amendmentStatusId;
            //}
            else if (amendmentTypeId != null)
            {
                projectSearchModel.TipYear = year;
                projectSearchModel.AmendmentTypeId = (int)amendmentTypeId;
                projectSearchModel.AmendmentStatusID = amendmentStatusId;
            }
            else
            {
                //Check to see if there is a projectSearchModel in Session. If not, then we have nt selected a dashboard or project search tab option.
                if ((CurrentSessionApplicationState.ProjectSearchModel as TIPSearchModel) != null)
                {
                    //Pull ProjectSearchModel from session and use
                    projectSearchModel = (TIPSearchModel)CurrentSessionApplicationState.ProjectSearchModel;
                }
                else
                {
                    //Create search using TipYear and Active Version only (default).
                    projectSearchModel.TipYear = year;
                    projectSearchModel.VersionStatusId = (int)Enums.TIPVersionStatus.Active;
                }

                if (!projectSearchModel.AmendmentTypeId.Equals(default(int)))
                {
                    projectSearchModel.VersionStatusId = (int)Enums.TIPVersionStatus.Pending;
                }

                projectSearchModel.AmendmentTypeId = amendmentTypeId.HasValue ? (int)amendmentTypeId : default(int);
                projectSearchModel.AmendmentStatusID = amendmentStatusId.HasValue ? (int)amendmentStatusId : default(int);
            }

            var viewModel = new ProjectListViewModel();
            viewModel.TipSummary.TipYear = year;
            viewModel.ProjectList = GetProjectList(projectSearchModel);
            viewModel.CurrentSponsors = _tipRepository.GetCurrentTimePeriodSponsorAgencies(year, Enums.ApplicationState.TIP).ToDictionary(x => (int)x.OrganizationId, x => x.OrganizationName);

            var allowedTypes = new List<Enums.AmendmentType>();
            allowedTypes.Add(Enums.AmendmentType.Administrative);
            allowedTypes.Add(Enums.AmendmentType.Policy);
            viewModel.AmendmentTypes = new Dictionary<int, string>();
            foreach (Enums.AmendmentType type in allowedTypes)
            {
                viewModel.AmendmentTypes.Add((int)type, StringEnum.GetStringValue(type));
            }

            // ??? why save it in GetProjectList?
            CurrentSessionApplicationState.ProjectSearchModel = null;

            return View(viewModel);
        }
        public ActionResult NonTipProjectList(string year)
        {
            var viewModel = new ProjectListViewModel();
            viewModel.TipSummary.TipYear = year;
            var projectSearchModel = new TIPSearchModel();
            projectSearchModel.TipYear = year;
            viewModel.ProjectList = _tipRepository.GetTIPProjects(projectSearchModel);

            return View(viewModel);
        }
        public ActionResult ManageAmendmentList(string year)
        {
            var viewModel = new ProjectListViewModel();
            viewModel.TipSummary.TipYear = year;
            viewModel.ProjectList = _tipRepository.GetAmendableTIPProjects(year);

            return View(viewModel);
        }
        public ActionResult WaitingProjectList(string year)
        {
            var viewModel = new ProjectListViewModel();
            viewModel.TipSummary.TipYear = year;
            viewModel.ProjectList = _tipRepository.GetWaitingListTIPProjects(year);

            return View(viewModel);
        }