-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_myclass.ashx
More file actions
50 lines (47 loc) · 1.81 KB
/
api_myclass.ashx
File metadata and controls
50 lines (47 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<%@ WebHandler Language="C#" Class="api_myclass" %>
using System;
using System.Web;
using MldOnLine.TableHelper;
using EricLib.Utility;
public class api_myclass : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
try
{
var _returnString = string.Empty;
var tblMyClass = new TblMyClass();
switch (context.Request.Params["action"])
{
case "get_all":
_returnString = tblMyClass.GetAll(context.Request.QueryString["student_id"]);
break;
case "add":
_returnString = JsonHelper.GetEasyUiJsonStr(tblMyClass.Create(context), tblMyClass.successMsg, tblMyClass.errorMsg);
break;
case "save":
_returnString = JsonHelper.GetEasyUiJsonStr(tblMyClass.Update(Convert.ToInt32(context.Request.QueryString["id"]), context), tblMyClass.successMsg, tblMyClass.errorMsg);
break;
case "delete":
_returnString = JsonHelper.GetEasyUiJsonStr(tblMyClass.Delete(Convert.ToInt32(context.Request.Params["id"])), tblMyClass.successMsg, tblMyClass.errorMsg);
break;
case "reset_id":
_returnString = TblMyClass.ResetAutoNumber();
break;
default:
_returnString = "[action] is null";
break;
}
context.Response.Write(_returnString);
}
catch (Exception ex) { context.Response.Write("錯誤訊息:" + ex.Message); }
}
public bool IsReusable
{
get
{
return false;
}
}
}