<%@ WebHandler Language="C#" Class="User_AjaxOption" %>

using System;
using System.Web;
using Jayrock.Json;
using EB_BLL;
using System.Data;
public class User_AjaxOption : IHttpHandler {

    public void ProcessRequest (HttpContext context)
    {
 
        HttpRequest Request = context.Request;
        HttpResponse Response = context.Response;

        String query = Request["query"].ToString();

        JsonObject result = new JsonObject();
        JsonArray suggestions = new JsonArray();

        N25175_User_BLL goods = new N25175_User_BLL();

        DataTable data = goods.GetAutoComplete(query);

        foreach (DataRow row in data.Rows)
        {
            JsonObject item = new JsonObject();
            item.Accumulate("value", row["u_user"].ToString());
            item.Accumulate("data", row["u_id"].ToString());
            item.Accumulate("c_name", row["u_name"].ToString());
            suggestions.Add(item);
        }

        result.Accumulate("suggestions", suggestions);
        Response.Write(result);
        Response.End();
    }

    public bool IsReusable {
        get {
            return false;
        }
    }

}
