public ActionResult ChangeTeam(RegionalTeam regionalTeam, VacanciesSummaryFilterTypes filterType, string searchString, ManageVacancySearchMode searchMode) { var claimsPrincipal = (ClaimsPrincipal)User; _agencyUserMediator.SaveAgencyUser(claimsPrincipal, new AgencyUserViewModel { RegionalTeam = regionalTeam }); return(RedirectToRoute(ManagementRouteNames.Dashboard, new DashboardVacancySummariesSearchViewModel { FilterType = filterType, Mode = DashboardVacancySummariesMode.Review, SearchString = searchString, SearchMode = searchMode })); }
/// <summary> /// Search and filter vacancies for the calling provider /// </summary> /// <param name="filter">Filter by vacancy status</param> /// <param name="providerSiteId">The site Id of the provider</param> /// <param name="providerId">The providers database id</param> /// <param name="type">The type of vacancy; Apprenticeship or Traineeeship</param> /// <returns>A list of vacancies</returns> public IEnumerable <VacancySummary> Get(VacancyType type, VacanciesSummaryFilterTypes filter, int providerId, int providerSiteId) { var query = new VacancySummaryQuery() { PageSize = 100, RequestedPage = 1, VacancyType = type, Filter = filter, OrderByField = VacancySummaryOrderByColumn.OrderByFilter, Order = Order.Ascending, ProviderId = providerId, ProviderSiteId = providerSiteId }; int totalRecords; return(_VacancySummaryService.GetSummariesForProvider(query, out totalRecords)); }
public DashboardVacancySummariesSearchViewModel(DashboardVacancySummariesSearchViewModel viewModel, VacanciesSummaryFilterTypes filterType) : this(viewModel) { FilterType = filterType; Mode = DashboardVacancySummariesMode.Review; }
public VacanciesSummarySearchViewModel(VacanciesSummarySearchViewModel viewModel, VacanciesSummaryFilterTypes filterType, string searchString) : this(viewModel, filterType) { SearchString = searchString; SearchMode = VacancySearchMode.All; }
public VacanciesSummarySearchViewModel(VacanciesSummarySearchViewModel viewModel, VacanciesSummaryFilterTypes filterType) : this(viewModel) { FilterType = filterType; CurrentPage = 1; }
private static string GetFilterSql(VacanciesSummaryFilterTypes filter, string sqlFilterKeyword = "AND") { var filterSql = new StringBuilder(); switch (filter) { case VacanciesSummaryFilterTypes.All: break; case VacanciesSummaryFilterTypes.Live: filterSql.Append($"{sqlFilterKeyword} v.VacancyStatusId = {(int)VacancyStatus.Live}"); break; case VacanciesSummaryFilterTypes.Submitted: filterSql.Append($"{sqlFilterKeyword} (v.VacancyStatusId = {(int)VacancyStatus.Submitted} OR v.VacancyStatusId = {(int)VacancyStatus.ReservedForQA})"); break; case VacanciesSummaryFilterTypes.Rejected: filterSql.Append($"{sqlFilterKeyword} v.VacancyStatusId = {(int)VacancyStatus.Referred}"); break; case VacanciesSummaryFilterTypes.ClosingSoon: filterSql.Append($"{sqlFilterKeyword} (v.VacancyStatusId = {(int)VacancyStatus.Live} AND v.ApplicationClosingDate >= CONVERT(DATE, GETDATE()) AND v.ApplicationClosingDate < (DATEADD(day,5,CONVERT(DATE, GETDATE()))))"); break; case VacanciesSummaryFilterTypes.Closed: filterSql.Append($"{sqlFilterKeyword} v.VacancyStatusId = {(int)VacancyStatus.Closed}"); break; case VacanciesSummaryFilterTypes.Draft: filterSql.Append($"{sqlFilterKeyword} v.VacancyStatusId = {(int)VacancyStatus.Draft}"); break; case VacanciesSummaryFilterTypes.NewApplications: filterSql.Append($@"{sqlFilterKeyword} (CASE v.ApplyOutsideNAVMS WHEN 1 THEN 0 ELSE dbo.GetNewApplicantCount(v.VacancyId) END) > 0" ); break; case VacanciesSummaryFilterTypes.Completed: filterSql.Append($"{sqlFilterKeyword} v.VacancyStatusId = {(int)VacancyStatus.Completed}"); break; case VacanciesSummaryFilterTypes.SubmittedToday: var todayFromDate = DateTime.Now.Date; var todayToDate = DateTime.Now.AddDays(1).Date; filterSql.Append($@"{sqlFilterKeyword} dbo.GetSubmittedDate(v.VacancyID) >= CAST('{todayFromDate:yyyy-MM-dd 00:00:00}' AS DATETIME) AND dbo.GetSubmittedDate(v.VacancyID) < CAST('{todayToDate:yyyy-MM-dd 00:00:00}' AS DATETIME)"); break; case VacanciesSummaryFilterTypes.SubmittedYesterday: DateTime yesterdayFromDate; var yesterdayToDate = DateTime.Now.Date; var dayOfWeek = (int)DateTime.Now.DayOfWeek; if (dayOfWeek < 2) { yesterdayFromDate = DateTime.Now.AddDays((dayOfWeek + 2) * -1); } else if (dayOfWeek == 2) { yesterdayFromDate = DateTime.Now.AddDays(-3); } else { yesterdayFromDate = DateTime.Now.AddDays(-1); } filterSql.Append($@"{sqlFilterKeyword} dbo.GetSubmittedDate(v.VacancyID) >= CAST('{yesterdayFromDate:yyyy-MM-dd 00:00:00}' AS DATETIME) AND dbo.GetSubmittedDate(v.VacancyID) < CAST('{yesterdayToDate:yyyy-MM-dd 00:00:00}' AS DATETIME)"); break; case VacanciesSummaryFilterTypes.SubmittedMoreThan48Hours: DateTime moreToDate; var moreDayOfWeek = (int)DateTime.Now.DayOfWeek; if (moreDayOfWeek == 0) { moreToDate = DateTime.Now.AddDays(-2); } else if (moreDayOfWeek == 2 || moreDayOfWeek == 1) { moreToDate = DateTime.Now.AddDays(-3); } else { moreToDate = DateTime.Now.AddDays(-1); } filterSql.Append($@"{sqlFilterKeyword} dbo.GetSubmittedDate(v.VacancyID) < CAST('{moreToDate:yyyy-MM-dd 00:00:00}' AS DATETIME)"); break; case VacanciesSummaryFilterTypes.Resubmitted: filterSql.Append($"{sqlFilterKeyword} v.SubmissionCount > 1"); break; default: throw new ArgumentException($"{filter}"); } return(filterSql.ToString()); }