public SearchResult Get(string q)
 {
     if (!(bool)HttpContext.Current.Application["Updating"])
     {
         q = HttpUtility.HtmlDecode(q);
         IIndexablePresenter <SchoolProgram> presenter = (IIndexablePresenter <SchoolProgram>)HttpContext.Current.Application["ProgramPresenter"];
         return(presenter.GetItemList(q));
     }
     return(null);
 }
Example #2
0
 public IEnumerable <SimpleCourse> Get(string q, bool raw)
 {
     if (!(bool)HttpContext.Current.Application["Updating"])
     {
         q = HttpUtility.HtmlDecode(q);
         IIndexablePresenter <Course> presenter = (IIndexablePresenter <Course>)HttpContext.Current.Application["CoursePresenter"];
         return((presenter as CourseSearchPresenter).GetRawList(q));
     }
     return(null);
 }
Example #3
0
        private bool TryGetCourseIds(string courseName, out uint[] courseId)
        {
            IIndexablePresenter <Course> presenter = (IIndexablePresenter <Course>)HttpContext.Current.Application["CoursePresenter"];

            try
            {
                courseId = presenter.GetIDMatches(courseName.Split(' ')[0], "code:", null).ToArray();
            }
            catch
            {
                courseId = new uint[] { };
                return(false);
            }
            return(true);
        }
 public SchoolProgram Get(int id)
 {
     if (!(bool)HttpContext.Current.Application["Updating"])
     {
         IIndexablePresenter <SchoolProgram> presenter = (IIndexablePresenter <SchoolProgram>)HttpContext.Current.Application["ProgramPresenter"];
         IEnumerable <SchoolProgram>         result    = presenter.GetItemsFromIDs(presenter.GetIDMatches("id:" + id, null, null));
         SchoolProgram first = result.FirstOrDefault <SchoolProgram>();
         first.Description = first.Description.Replace("|", "<br />");
         first.Description = CodeRegex.Replace(first.Description, delegate(Match match)
         {
             return("<span class='courseCode' onclick='searchCourseCode(this)'>" + match.Value + "</span>");
         });
         return(first);
     }
     return(null);
 }