yzh
2022-03-14 94879204c236edaf6ee80a176c2a781a352b2b93
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
 
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;
    }
}