You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.6 KiB
69 lines
1.6 KiB
using MESWebSite.CommonClass;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace MESWebSite.HttpHandlers
|
|
{
|
|
public abstract class BaseHandler : IHttpHandler
|
|
{
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public string Page
|
|
{
|
|
get
|
|
{
|
|
return GetParam("page").DefaultValue("0");
|
|
}
|
|
}
|
|
|
|
public string Rows
|
|
{
|
|
get
|
|
{
|
|
return GetParam("rows").DefaultValue("15");
|
|
}
|
|
}
|
|
|
|
public HttpRequest Request = null;
|
|
public HttpResponse Response = null;
|
|
public Dictionary<string, Action> MethodDict;
|
|
|
|
public BaseHandler()
|
|
{
|
|
MethodDict = new Dictionary<string, Action>();
|
|
RegisterAction(QueryList);
|
|
RegisterAction(SaveInfo);
|
|
RegisterAction(DelInfo);
|
|
}
|
|
|
|
protected void RegisterAction(Action action)
|
|
{
|
|
MethodDict.Add(action.Method.Name, action);
|
|
}
|
|
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
context.Response.ContentType = "text/plain";
|
|
Request = context.Request;
|
|
Response = context.Response;
|
|
string method = Request.Params["method"];
|
|
MethodDict[method]();
|
|
}
|
|
|
|
public string GetParam(string name) {
|
|
return Request.Params[name];
|
|
}
|
|
|
|
protected abstract void QueryList();
|
|
protected abstract void SaveInfo();
|
|
protected abstract void DelInfo();
|
|
}
|
|
}
|