dlmh_system/VRS/Handler/App.ashx.cs

118 lines
3.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace VRS.Handler
{
/// <summary>
/// App 的摘要说明
/// </summary>
public class App : BaseHandler, IHttpHandler
{
DataService.BLL.pro_app bll_app = new DataService.BLL.pro_app();
public void ProcessRequest(HttpContext context)
{
baseContext = context;
context.Response.ContentType = "text/plain";
CrossDomain();
if (null == context.Request["action"])
{
var result = GetResult(false, "缺少参数action");
context.Response.Write(result);
context.Response.End();
}
string action = context.Request["action"];
switch (action)
{
//所有线路
//case "all":
// QueryALL(context);
// break;
case "queryapp":
QueryApp(context);
break;
default:
var result = GetResult(false, "方法名不存在:" + action);
context.Response.Write(result);
break;
}
}
/// <summary>
/// 应用查询
/// </summary>
/// <param name="context"></param>
public void QueryApp(HttpContext context)
{
string name = context.Request["name"];
string str_page_size = context.Request["page_size"];
string str_page_index = context.Request["page_index"];
int page_size = 10;
int page_index = 1;
if (int.TryParse(str_page_size, out int i_page_size))
{
page_size = i_page_size;
}
if (int.TryParse(str_page_index, out int i_page_index))
{
page_index = i_page_index;
}
int start = (page_index - 1) * page_size;
int end = start + page_size;
var qry = " 1=1 ";
if (!string.IsNullOrEmpty(name))
{
qry = qry + string.Format(" and app_name like '%{0}%'", name); //月份
}
int recordCount = 0;
var list = bll_app.GetModelPageList(qry, page_index, page_size, ref recordCount);
foreach (var item in list)
{
var Authority = context.Request.Url.Authority;
if (!string.IsNullOrEmpty(item.video_url))
{
var new_url = "http://" + Authority + item.video_url.Replace("~", "");
item.video_url = new_url;
}
}
var obj = new
{
total = recordCount,
list = list
};
var result = GetResult(true, obj);
context.Response.Write(result);
context.Response.End();
}
/*
/// <summary>
/// 告警信息
/// </summary>
/// <param name="context"></param>
public void QueryAlarmInfo(HttpContext context)
{
var list = bll_alarm_info.GetModelList("");
var result = GetResult(true, list);
context.Response.Write(result);
context.Response.End();
}
*/
public bool IsReusable
{
get
{
return false;
}
}
}
}