-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathHandler.ashx
98 lines (92 loc) · 3.96 KB
/
Handler.ashx
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
using System.IO;
using Newtonsoft.Json;
public class Handler : IHttpHandler
{
//前台传递过来的json字符对象
public struct ParaStrObj
{
public string paraStr { get; set; }
}
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string method = System.Web.HttpContext.Current.Request["method"].ToString();
string res = slOnlineAnalyse(method, context);
context.Response.Write(res);
}
public bool IsReusable
{
get
{
return false;
}
}
public string slOnlineAnalyse(string method, HttpContext context)
{
string res = null;
switch (method)
{
case "sssq": //实时水情
string sqOper = System.Web.HttpContext.Current.Request["oper"].ToString();
string sqType = System.Web.HttpContext.Current.Request["type"].ToString();
switch (sqOper)
{
case "waterInfo":
res = Sample.showWaterInfo(sqType);
break;
case "WaterHisInfo":
int siteNum = Convert.ToInt32(System.Web.HttpContext.Current.Request["siteNum"]);
res = Sample.showSiteWaterHisInfos(sqType, siteNum);
break;
}
break;
case "tflj": //台风路径
string tfOper = System.Web.HttpContext.Current.Request["oper"].ToString();
switch (tfOper)
{
case "tfInfo":
res = Sample.showWindbasicInfo();
break;
case "forcastInfo":
int tfID = Convert.ToInt32(System.Web.HttpContext.Current.Request["tfID"]);
res = Sample.showWindForcastInfo(tfID);
break;
case "detailInfo":
int tfID2 = Convert.ToInt32(System.Web.HttpContext.Current.Request["tfID"]);
res = Sample.showWindDetailInfo(tfID2);
break;
}
break;
case "jydzx": //降雨等值线
var PostedJsonData = HttpUtility.UrlDecode(new StreamReader(context.Request.InputStream).ReadToEnd());
ParaStrObj paraStrObj = JavaScriptConvert.DeserializeObject<ParaStrObj>(PostedJsonData);
string paraStr = paraStrObj.paraStr;
res = Sample.AnalyseRun(paraStr);
break;
case "ssyq": //实时雨情
string yqOper = System.Web.HttpContext.Current.Request["oper"].ToString();
switch (yqOper)
{
case "rainNum":
string StarTime = System.Web.HttpContext.Current.Request["s"].ToString();
string EndTime = System.Web.HttpContext.Current.Request["e"].ToString();
double MixNum = Convert.ToDouble(System.Web.HttpContext.Current.Request["minRain"]);
double MaxNum = Convert.ToDouble(System.Web.HttpContext.Current.Request["maxRain"]);
res = Sample.GetRainNums(StarTime, EndTime, MixNum, MaxNum);
break;
case "rainInfo":
string StarTime1 = System.Web.HttpContext.Current.Request["s"].ToString();
string EndTime1 = System.Web.HttpContext.Current.Request["e"].ToString();
int SiteNum = Convert.ToInt32(System.Web.HttpContext.Current.Request["siteNum"]);
res = Sample.GetSiteRainInfo(StarTime1, EndTime1, SiteNum);
break;
}
break;
default: break;
}
return res;
}
}