public IEnumerable<DRCOG.Domain.Models.RTP.RtpSummary> RtpGetAmendablePendingProjects(RtpGetAmendableProjectsRequest request) { try { var currentCycleId = TripsRepository.GetRtpActivePlanCycleId(request.rtpPlanYearId); if (currentCycleId == 0) { Logger.Debug("Getting projects from Current Plan"); var planId = TripsRepository.GetRtpCurrentPlanId(); currentCycleId = TripsRepository.GetRtpActivePlanCycleId(planId); } if (currentCycleId == 0) { throw new Exception("There is no Current Plan, or it has no Active Cycle"); } return RtpRepository.GetAmendableProjects(currentCycleId, false); } catch (Exception ex) { Logger.WarnException("RtpGetAmendableProjects failed", ex); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.ExpectationFailed) { ReasonPhrase = ex.Message }); } }
public IEnumerable<System.Web.Mvc.SelectListItem> RtpGetAvailableRestoreProjects(RtpGetAmendableProjectsRequest request) { var results = new List<System.Web.Mvc.SelectListItem>(); try { var availableProjects = RtpRepository.GetRestoreProjectList(request.cycleId).ToList(); availableProjects.ForEach(x => { results.Add(new System.Web.Mvc.SelectListItem { Text = x.RtpYear + ": " + x.ProjectName, Value = x.ProjectVersionId.ToString() }); }); } catch (Exception ex) { Logger.WarnException("RtpGetAmendableProjects failed", ex); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.ExpectationFailed) { ReasonPhrase = ex.Message }); } return results; }
public IEnumerable<System.Web.Mvc.SelectListItem> RtpGetSponsorOrganizations(RtpGetAmendableProjectsRequest request) { try { var orgs = TripsRepository.RtpGetSponsorOrganizations(request.rtpPlanYearId); return orgs; } catch (Exception ex) { Logger.WarnException("RtpGetSponsorOrganizations failed", ex); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.ExpectationFailed) { ReasonPhrase = ex.Message }); } }
public IEnumerable<System.Web.Mvc.SelectListItem> RtpGetAmendableProjects(RtpGetAmendableProjectsRequest request) { var results = new List<System.Web.Mvc.SelectListItem>(); try { var currentCycleId = TripsRepository.GetRtpActivePlanCycleId(request.rtpPlanYearId); if (currentCycleId == 0) { Logger.Debug("Getting projects from Current Plan"); var planId = TripsRepository.GetRtpCurrentPlanId(); currentCycleId = TripsRepository.GetRtpActivePlanCycleId(planId); } if (currentCycleId == 0) { throw new Exception("There is no Current Plan, or it has no Active Cycle"); } var availableProjects = RtpRepository.GetAmendableProjects(currentCycleId, true).ToList(); availableProjects.ForEach(x => { results.Add(new System.Web.Mvc.SelectListItem { Text = x.Cycle.Name + ": " + x.ProjectName, Value = x.ProjectVersionId.ToString() }); }); } catch (Exception ex) { Logger.WarnException("RtpGetAmendableProjects failed", ex); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.ExpectationFailed) { ReasonPhrase = ex.Message }); } return results; }