62,046
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Text;
namespace WebSite.Threshold
{
public partial class ThresholdShow : System.Web.UI.Page
{
public static String StrPar;
public static String StrSwf;
public static String strCode;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
//try
//{
//if (Session["user"].ToString() == "")//判断用户是否为空
//{
// ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "AddScript", "alert('请重新登陆');window.location.href='../Login.aspx';", true);
//}
//else
//{
//测试Session
//Session["OrganCode"] = "";
strCode = "";
strCode = Session["OrganCode"].ToString();
Session["Droplist"] = "";
//测试
try
{
//string strCode = Session["OrganCode"].ToString();
strCode = Request.QueryString["Code"].ToString();
}
catch
{
strCode = Session["OrganCode"].ToString();
}
//显示地图flash
if (strCode == "0")//测试用,全国代码为0
{
StrSwf = "FlashVars.swf";
}
else
{
StrSwf = "FlashVars_" + strCode.Substring(0, 2) + ".swf";
}
//显示全国地图报警类型
if (Session["Drop"].ToString() == "0")
{
ddlType.SelectedIndex = 0;
FlashShow("Past24ProblemsCount", strCode);
}
else if (Session["Drop"].ToString() == "1")
{
ddlType.SelectedIndex = 1;
FlashShow("Past24PatchCount", strCode);
}
else if (Session["Drop"].ToString() == "2")
{
ddlType.SelectedIndex = 2;
FlashShow("Past24PolicyCount", strCode);
}
else if (Session["Drop"].ToString() == "3")
{
ddlType.SelectedIndex = 3;
FlashShow("Past24ErrorCount", strCode);
}
//}
Label1.Text = StrPar;
//}
//catch
//{
// ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "AddScript", "alert('请重新登陆');window.top.location.href='../Login.aspx';", true);
//}
}
}
#region 下拉框
/// <summary>
/// 选择变化
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void ddlType_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlType.SelectedValue == "0")
{
Session["Drop"] = "0";
//lblShow.Text = "";
//恶意软件
FlashShow("Past24ProblemsCount",strCode);
}
else if (ddlType.SelectedValue == "1")
{
Session["Drop"] = "1";
//lblShow.Text = "";
//有漏洞
FlashShow("Past24PatchCount", strCode);
}
else if (ddlType.SelectedValue == "2")
{
Session["Drop"] = "2";
//lblShow.Text = "";
//策略问题
FlashShow("Past24PolicyCount", strCode);
}
else if (ddlType.SelectedValue == "3")
{
Session["Drop"] = "3";
//lblShow.Text = "";
//报警问题
FlashShow("Past24ErrorCount", strCode);
}
}
#endregion
#region 各类型等级判断
/// <summary>
/// 各类型等级判断
/// </summary>
/// <param name="strvalue">传值</param>
private void FlashShow(string strvalue,string strCodes)
{
BLL.Threshold Thresh = new BLL.Threshold();
SqlDataReader dr = Thresh.Get_RangeExpand(strvalue,strCodes);
BLL.Threshold Thresh2 = new BLL.Threshold();
SqlDataReader dr2 = Thresh2.Get_ThresholdRange();
StringBuilder sb = new StringBuilder();
try
{
if (dr2.Read())
{
while (dr.Read())
{
if (Convert.ToInt32(dr["num"].ToString()) <= Convert.ToInt32(dr2["Lv1"].ToString()))
{
sb.Append("mc_" + dr["code"].ToString() + "=1&");
}
if (Convert.ToInt32(dr2["Lv1"].ToString()) < Convert.ToInt32(dr["num"].ToString()) && Convert.ToInt32(dr["num"].ToString()) <= Convert.ToInt32(dr2["Lv2"].ToString()))
{
sb.Append("mc_" + dr["code"].ToString() + "=2&");
}
if (Convert.ToInt32(dr2["Lv2"].ToString()) < Convert.ToInt32(dr["num"].ToString()) && Convert.ToInt32(dr["num"].ToString()) <= Convert.ToInt32(dr2["Lv3"].ToString()))
{
sb.Append("mc_" + dr["code"].ToString() + "=3&");
}
if (Convert.ToInt32(dr2["Lv3"].ToString()) < Convert.ToInt32(dr["num"].ToString()) && Convert.ToInt32(dr["num"].ToString()) <= Convert.ToInt32(dr2["Lv4"].ToString()) || Convert.ToInt32(dr2["Lv3"].ToString()) < Convert.ToInt32(dr["num"].ToString()))
{
sb.Append("mc_" + dr["code"].ToString() + "=4&");
}
}
}
string strCod = (sb.ToString()).Substring(0, (sb.ToString()).Length - 1);
StrPar = strCod;
}
catch
{
StrPar = "";
}
finally
{
dr.Close();
dr2.Close();
}
}
#endregion
#region 默认显示
/// <summary>
/// 默认显示
/// </summary>
private void DefaultShow()
{
for (int i = 0; i < ddlType.Items.Count; i++)
{
if (ddlType.SelectedValue == "0")
{
FlashShow("Past24ProblemsCount",strCode);
}
if (ddlType.SelectedValue == "1")
{
FlashShow("Past24PatchCount",strCode);
}
if (ddlType.SelectedValue == "2")
{
FlashShow("Past24PolicyCount",strCode);
}
if (ddlType.SelectedValue == "3")
{
FlashShow("Past24ErrorCount",strCode);
}
}
}
#endregion
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ThresholdShow.aspx.cs" Inherits="WebSite.Threshold.ThresholdShow" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<title></title>
<link href="../css/Style.css" type="text/css" rel="Stylesheet" />
<style type="text/css">
.style1
{
width: 100%;
height:100%;
}
</style>
<!--修正FLASH正确显示代码开始-->
<script language="javascript" type="text/javascript" src="flash.js"></script>
<!--修正FLASH正确显示代码结束-->
</head>
<body style="vertical-align:top;">
<form id="form1" runat="server" method="get">
<div>
<div>
<asp:DropDownList ID="ddlType" runat="server" Width="150px" AutoPostBack="True"
onselectedindexchanged="ddlType_SelectedIndexChanged">
<asp:ListItem Value="0">恶意软件问题</asp:ListItem>
<asp:ListItem Value="1">漏洞问题</asp:ListItem>
<asp:ListItem Value="2">策略部署问题</asp:ListItem>
<asp:ListItem Value="3">警报问题</asp:ListItem>
</asp:DropDownList>
<script type="text/javascript">
//debugger
writeflashhtml("_swf=<%=StrSwf%>", "_width=100%", "_height=90%", "_wmode=transparent", "_quality=high", "_flashvars=<%=StrPar%>");
</script>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
<div style="vertical-align:top;">
</div>
</div>
</form>
</body>
</html>