Content


JobController.cs

Just quick introduction - this controller is used in the search facility that this website provides. It is linked to CouchDBManager and the Search page. There is no need to get into details about code here, main point is to explain what is doing what.

Methods:
  1. Search
  2. Details

Summary: Gets a list with 20* jobs per page, matching the searching criteria in /search form on the right pane. It also looks for current jobs, using dateTimeFrom > DateTime.Now in the selector expression - that could be optional in future. Only LIVE jobs will be displayed, omitting the regional and internal bank ones. If the user has chosen and verified a post code, additional feature will be triggered, which is our location search. The latitude and longitude will be retrieved from the provided postscode by making an ajax call to postcodes.io, after which that is passed along with the units and maximum distance to our method, which calls a separate one in CouchDBManager - GetNearestHospitals. Then the method ends, returning the jobs from the nearest hospitals or just all jobs. The mathematical calculations are done for us with the help of a NuGet package - NGeoKDBush (NetStandard version of the GeoKDBush JavaScript library). A JObject is returned to the JavaScript function Search() in Search.cshtml.

This method takes the following parameters:
  • job_search_specialty
  • job_search_grade
  • job_search_permanent
  • page_number
  • user_latitude
  • user_longitude
  • max_distance
  • distance_type

The types of the params are very well described just above the method, similarly to every other method. The first three parameters (starting with job_) are passing actual query strings and if there is more than one spec or grade selected, they will be separated with a comma. The page_number param is self-explanatory. User latitude and longitude provide the X and Y, max_distance is the preferred distance and distance_type can be miles by default or kilometres (foreigners 😂), if the user has chosen to fill in his post code.

Details

This method takes the following parameter:
  • jobNumber

This method looks for a job containing the given jobNumber and if it exists and the job matches certain requirements (specified in the selector expression), the Job Details page will be brought with information about that job.

Footnotes

20* Although there are shown 20 jobs per page, 21 items are queried. This is done to check if the Next page button should be disabled. There are rare circumstances where this logic breaks, but still works most of the time, just like everything else.

Documented by.. You know who I am and by you might know who I am