|
using Common;
|
using Dao;
|
using Model;
|
using Newtonsoft.Json;
|
using Newtonsoft.Json.Linq;
|
using System;
|
using System.Collections.Generic;
|
using System.Web;
|
using System.Web.Profile;
|
using System.Web.SessionState;
|
|
public partial class _GwAp : PageBase<SysUser>, IRequiresSessionState
|
{
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
this.CheckRight("201", FailedOperation.ErrorMsgOnly);
|
if (this.IsPostBack)
|
return;
|
this.ViewState["list"] = (object)this.getList();
|
}
|
|
public string getList()
|
{
|
using (GwApDao gwApDao = new GwApDao())
|
{
|
List<GwAp> list = gwApDao.LoadInfoList();
|
string str = "";
|
if (list != null && list.Count > 0)
|
{
|
foreach (GwAp i in list)
|
{
|
str += "<tr >";
|
str = str + "<td>" + i.ApID + "</td><td>" + i.ApName + "</td><td>" + i.ApPort + "</td>";
|
str = str + "<td>" + i.AccessCode + "</td>";
|
str = str + "<td> <div class=\"text-muted\">" + this.GetAlarmExpressionText(i) + "</div></td>";
|
str += "<td>";
|
str += string.Format(" <a href=\"javascript:;\" data-id=\"{0}\" class=\"action-modal-edit btn btn-primary btn-xs\"><i class=\"fa fa-edit\"></i> 编辑</a> ", (object)i.ApID);
|
str += "</td>";
|
str += "</tr>";
|
}
|
}
|
else
|
str += "<tr><td colspan=\"8\" style=\"padding-left:5px;\">暂无信息</td></tr>";
|
return str;
|
}
|
}
|
|
private string GetAlarmExpressionText(GwAp i)
|
{
|
string str = "未启用告警";
|
if (string.IsNullOrEmpty(i.AlarmData))
|
return str;
|
JToken jtoken = JsonConvert.DeserializeObject<JToken>(i.AlarmData);
|
if (jtoken != null && (jtoken.Value<int>((object)"apInThreshold") > 0 || jtoken.Value<int>((object)"apPendingThreshold") > 0))
|
str = string.Empty;
|
if (jtoken.Value<int>((object)"apInThreshold") > 0)
|
str = str + "当入口流量小于 <span class='label label-success'>" + jtoken.Value<string>((object)"apInThreshold") + "条/5分钟</span> 时告警;";
|
if (jtoken.Value<int>((object)"apPendingThreshold") > 0)
|
str = str + "当入口流量阻塞大于<span class='label label-success'>" + jtoken.Value<string>((object)"apPendingThreshold") + "条</span> 时告警";
|
return str;
|
}
|
}
|