public void ProcessRequest(HttpContext context)
        {
            string    keyword  = string.Empty;
            DataTable courseDT = new DataTable();

            context.Response.ContentType = "text/plain";
            context.Response.Expires     = -1;
            IList <CourseDTO> tasksList = new List <CourseDTO>();
            CourseBCService   _bc       = new CourseBCService();

            if (context.Request.QueryString.Count >= 1)
            {
                keyword  = context.Request.QueryString["Keyword"];
                courseDT = _bc.getCoursesByFreetext(keyword);
            }
            else
            {
                courseDT = _bc.getAllCourses();
            }
            CastDataTable2TaskList(courseDT, tasksList, _bc);

            System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
                new System.Web.Script.Serialization.JavaScriptSerializer();
            string sJSON = oSerializer.Serialize(tasksList);

            context.Response.Write(sJSON);
        }
示例#2
0
        protected void btnFreetextSearch_Click(object sender, EventArgs e)
        {
            string searchKey = this.searchKey.Text;

            if (!String.IsNullOrEmpty(searchKey) && !String.IsNullOrEmpty(searchKey.Trim()))
            {
                string decodeKey = HttpUtility.HtmlDecode(searchKey);

                DataTable dt = _bc.getCoursesByFreetext(decodeKey) as DataTable;

                this.gvwDash.DataSource = dt;
                this.gvwDash.DataBind();
            }
        }