Ejemplo n.º 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string sql = "SELECT nId,IsLogin,LoginIP FROM TS_Login WHERE vLogin='******' and vPsw='{1}'";

        string pass = common.md5(this.txtPassword.Text.Trim());

        sql = String.Format(sql, txtUser.Text, pass);
        dbConfig DB = new dbConfig();
        //保存APPPath
        DB.UpdateProperty("AppPath", Server.MapPath(Request.ApplicationPath));

        string UserID = DB.ExecuteScalar(sql);
        if (UserID != "")
        {
            string useridstr = DB.CreateDataSet(sql).Tables[0].Rows[0]["nId"].ToString();
            string userislogin = DB.CreateDataSet(sql).Tables[0].Rows[0]["IsLogin"].ToString();
            string useripstr = DB.CreateDataSet(sql).Tables[0].Rows[0]["LoginIP"].ToString();
            string userip = Request.ServerVariables["Remote_Addr"].ToString();
            Session["FromDate"] = System.DateTime.Today.AddDays(-1);
            Session["ToDate"] = System.DateTime.Today.AddDays(-1);
            //将登录信息定入日志文件
            common.setLog(useridstr, DB.getUserName(UserID), userip, "登录");
            Session["adminName"] = txtUser.Text.Trim();

            /*if (userislogin == "1")
            {
                if (userip == useripstr)
                {
                    FormsAuthentication.RedirectFromLoginPage(UserID, false);

                    DB.changeuserstate(useridstr, "1", userip);
                    Response.Redirect("Main.aspx");
                }
                else
                {
                    lblMessage.Text = "该用户已经登录!";
                    lblMessage.Visible = true;
                }
            }
            else
            {*/
            FormsAuthentication.RedirectFromLoginPage(UserID, false);

            //DB.changeuserstate(useridstr, "1", userip);
            Response.Redirect("Main.aspx");
            //}
        }
        else
        {
            txtUser.Focus();
            lblMessage.Text = "用户名或密码错误,请重新输入!";
            lblMessage.Visible = true;
        }
    }
Ejemplo n.º 2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "线索分析";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);

            cblHost.DataSource = configDB.getSites(User.Identity.Name);
            cblHost.DataBind();

            FormInit();
        }
    }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _RecordCount = Convert.ToInt32(lblRecordCount.Text);
        _PageCount = _RecordCount / _PageSize;
        if (_RecordCount % _PageSize > 0) _PageCount++;
        _PageIndex = Convert.ToInt32(lblPageIndex.Text);

        string strPara = Request.QueryString["nparent"];
        string nParent;
        if (strPara.IndexOf("|") < 0)
        {
            nParent = Request.QueryString["nparent"];
            Condition += "nParent=" + nParent;
        }
        else
        {
            string[] sArray = strPara.Split('|');
            nParent = sArray[0];
            if (sArray[3] == "0")
                Condition += "vSrcMac='" + sArray[1] + "' ";
            else
                Condition += "vSrcAddr='" + sArray[2] + "' ";
        }

        if (!Page.IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "查看节点" + configDB.getSiteName(nParent) + "的BBS内容";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition = "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "' and " + Condition;
                    Condition = "vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "' and " + Condition;
                    break;
                case "1"://前三天
                    Condition = "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "' and " + Condition;
                    Condition = "vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "' and " + Condition;
                    break;
                case "2"://前一周
                    Condition = "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "' and " + Condition;
                    Condition = "vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "' and " + Condition;
                    break;
                case "3"://前一月
                    Condition = "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "' and " + Condition;
                    Condition = "vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "' and " + Condition;
                    break;
                case "5"://昨天
                    Condition = "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "' and " + Condition;
                    Condition = "vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "' and " + Condition;
                    break;
            }
            if (rdlMode.SelectedValue == "1")//敏感模式
                Condition += " and nKey > 0";
        }
    }
Ejemplo n.º 4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _RecordCount = Convert.ToInt32(lblRecordCount.Text);
        _PageCount = _RecordCount / _PageSize;
        if (_RecordCount % _PageSize > 0) _PageCount++;
        _PageIndex = Convert.ToInt32(lblPageIndex.Text);
        int selectedCount = 0;

        string sParent = "'0'";
        DB = new dbMsgAll(rdlCategory.SelectedItem.Value);

        if (!IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "聊天查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }
            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    sParent += "," + li.Value + "";
                    selectedCount++;
                }
            }
            if (selectedCount < cblHost.Items.Count)
                Condition += " and nParent in (" + sParent + ")";
            if (txtSrcAddr.Text.ToString() != "")
                Condition += " and vSrcAddr = dmc_config.dbo.[f_IP2int]('" + txtSrcAddr.Text.ToString() + "')";
            if (txtSrcMac.Text.ToString() != "")
                Condition += " and vSrcMac = '" + txtSrcMac.Text.ToString() + "'";
            if (txtDstAddr.Text.ToString() != "")
                Condition += " and vDstAddr = dmc_config.dbo.[f_IP2int]('" + txtDstAddr.Text.ToString() + "')";

            string msntype = chkTalkMode.SelectedItem.Value;
            if (txtMailFrom.Text.ToString() != "")
            {
                if (msntype == "0")//发送方
                {
                    if (fromeq.Checked)
                    {

                        Condition += " and vMailFrom = '" + txtMailFrom.Text.ToString() + "'";
                    }
                    else
                    {

                        Condition += " and vMailFrom like '%" + txtMailFrom.Text.ToString().Trim() + "%'";
                    }

                }
                else if (msntype == "1")//接收方
                {
                    if (fromeq.Checked)
                    {

                        Condition += " and vMailTo = '" + txtMailFrom.Text.ToString() + "'";
                    }
                    else
                    {

                        Condition += " and vMailTo like '%" + txtMailFrom.Text.ToString().Trim() + "%'";
                    }

                }
                else//对话模式
                {
                    if (fromeq.Checked)
                    {

                        Condition += " and (vMailFrom = '" + txtMailFrom.Text.ToString() + "' or vMailTo = '" + txtMailFrom.Text.ToString() + "')";
                    }
                    else
                    {

                        Condition += " and (vMailFrom like '%" + txtMailFrom.Text.ToString().Trim() + "%' or vMailTo like '%" + txtMailFrom.Text.ToString() + "%')";
                    }
                }
            }

            if (txtMessage.Text.ToString() != "")
                Condition += " and vMessage like '%" + txtMessage.Text.ToString() + "%'";
            if (rdlMode.SelectedValue == "1")//敏感模式
                Condition += " and nKey > 0";

            int senstive = common.GetSenstiveCheck(this.CheckBoxList2);

            if (senstive > 0)
                Condition += " and ( (nKey & " + senstive + ")>0 ) ";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
                Condition = Condition.Substring(5);
        }
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _RecordCount = Convert.ToInt32(lblRecordCount.Text);
        _PageCount = _RecordCount / _PageSize;
        if (_RecordCount % _PageSize > 0) _PageCount++;
        _PageIndex = Convert.ToInt32(lblPageIndex.Text);
        int selectedCount = 0;

        string sParent = "'0'";
        DB = CreateDataBase(this.DropDownList1.SelectedValue.Trim());

        if (!IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "网站查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }

            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    sParent += "," + li.Value + "";
                    selectedCount++;
                }
            }

            //tedi3231 added 2010.02.01 没有选中任何站点时显示用户能看到的所有站点
            if (sParent.Length <= 3)
            {
                sParent = common.GetHosrList(User.Identity.Name);
            }

            if (selectedCount < cblHost.Items.Count)
                Condition += " and nParent in (" + sParent + ")";
            if (txtSrcAddr.Text.ToString() != "")
                Condition += " and vSrcAddr = dmc_config.dbo.[f_IP2int]('" + txtSrcAddr.Text.ToString() + "')";
            if (txtSrcMac.Text.ToString() != "")
                Condition += " and vSrcMac = '" + txtSrcMac.Text.ToString() + "'";

            int senstive = GetSenstiveCheck();

            if( senstive> 0 )
                Condition += " and ( (nKey & " + senstive+ ")>0 ) ";
            //if (txtWeburl.Text.ToString() != "")
            //{
            //    if (weburleq.Checked)
            //        Condition += " and vURL = '" + txtWeburl.Text.ToString() + "'";
            //    else
            //        Condition += " and vURL like '%" + txtWeburl.Text.ToString().Trim() + "%'";
            //}
            //if (txtWebIP.Text.ToString() != "")
            //    Condition += " and vDstAddr = dmc_config.dbo.[f_IP2int]('" + txtWebIP.Text.ToString() + "')";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
                Condition = Condition.Substring(5);
        }
    }
Ejemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (ddlDnsTypelist.SelectedValue.Trim().Equals("6"))
        {
            DB = new dbDns("dns");
        }
        else
        {
            DB = new dbDns("dnsalarm");
        }

        if (!IsPostBack)
        {
            initDnsTypeList();
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "木马查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }

            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    if (selectedCount == 0)  //防止只选一个站点时,出现在,1的情况 查询报错
                    {
                        sParent = li.Value;
                    }
                    else
                    {
                        sParent += "," + li.Value + "";
                    }

                    selectedCount++;
                }
            }

            if (selectedCount <= 0)//tedi3231 added 2010.02.01 没有选中任何站点时显示用户能看到的所有站点
            {
                sParent = common.GetHosrList(User.Identity.Name);
            }

            Condition += " and nParent in (" + sParent + ")";

            if (txtvDstIp.Text.ToString() != "")//数据库中为numeric 类型,因而需要先将值转化为数字类型
                Condition += " and vDstIp = dmc_config.dbo.f_IP2Int('" + txtvDstIp.Text.ToString() + "')";

            if (txtvDstMac.Text.ToString() != "")
                Condition += " and vDstMac ='" + txtvDstMac.Text.ToString() + "' ";

            if (txtvAddr.Text.ToString() != "")//数据库中为numeric 类型,因而需要先将值转化为数字类型
                Condition += " and vAddr = dmc_config.dbo.f_IP2Int('" + txtvAddr.Text.ToString() + "') ";

            if (txtvName.Text.ToString() != "")
            {
                if (fromeq.Checked)
                    Condition += " and vName = '" + txtvName.Text.ToString() + "'";
                else
                    Condition += " and vName like '%" + txtvName.Text.ToString() + "%'";
            }

            //用户IP
            if (!string.IsNullOrEmpty(tbUserIp.Text))
            {
                Condition += " and vSrcIp = dmc_config.dbo.f_IP2Int('" + tbUserIp.Text.ToString() + "') ";
            }

            //用户MAC
            if (!string.IsNullOrEmpty(tbUserMac.Text))
            {
                Condition += " and vSrcMac= '" + tbUserMac.Text.ToString() + "' ";
            }

            // 是否静默
            if (this.ddlStateFlag.SelectedValue.Trim() == "0")
            {
                Condition += " and vStateFlag = 0 ";
            }
            else if (this.ddlStateFlag.SelectedValue.Trim() == "1")
            {
                 Condition += " and vStateFlag = 1 ";
            }

            //域名类型
            string typeval = ddlDnsTypelist.SelectedValue.Trim();

            if (!string.IsNullOrEmpty(typeval) && typeval != "-1")
            {
                if (typeval == "0") // 如果为所有黑名单,则显示黑名单的三种类别
                {
                    Condition += " and (vType=7 or vType=8 or vType=9 ) ";
                }
                else if (typeval == "10")
                {
                    Condition += " and (vType=3 or vType=4 or vType=5 ) ";
                }
                else if (typeval == "11") //其他域名 可疑域名 所有异常域名
                {
                    Condition += " and (vType=2 or vType=3 or vType=4 or vType=5 ) ";
                }
                else
                {
                    Condition += " and vType = " + typeval + " ";
                }
            }

            //ip归属地查询
            if (ddlIpList.SelectedValue.Trim() != "-1")
            {
                Condition += " and ipnum = " + ddlIpList.SelectedValue.Trim();
            }

            int senstive = common.GetSenstiveCheck(this.CheckBoxList2);

            if (senstive > 0)
                Condition += " and ( (nKey & " + senstive + ")>0 ) ";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
                Condition = Condition.Substring(5);
        }
    }
Ejemplo n.º 7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "木马查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }

            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    if (selectedCount == 0)  //防止只选一个站点时,出现在,1的情况 查询报错
                    {
                        sParent = li.Value;
                    }
                    else
                    {
                        sParent += "," + li.Value + "";
                    }

                    selectedCount++;
                }
            }

            if (selectedCount <= 0)//tedi3231 added 2010.02.01 没有选中任何站点时显示用户能看到的所有站点
            {
                sParent = common.GetHosrList(User.Identity.Name);
            }

            Condition += " and nParent in (" + sParent + ")";

            if (txtvDstAddr.Text.ToString() != "")
                Condition += " and vDstAddr = dmc_config.dbo.[f_IP2int]('" + txtvDstAddr.Text.ToString() + "')";

            if (txtvDstMac.Text.ToString() != "")
                Condition += " and vDstMac = '" + txtvDstMac.Text.ToString() + "'";

            if (txtvSrcPort.Text.ToString() != "")
                Condition += " and vSrcPort = '" + txtvSrcPort.Text.ToString() + "'";

            if (txtvDstPort.Text.ToString() != "")
                Condition += " and vDstPort = '" + txtvDstPort.Text.ToString() + "'";

            if (!string.IsNullOrEmpty(tbUserIp.Text))
                Condition += " and vSrcAddr = dmc_config.dbo.[f_IP2int]('" + tbUserIp.Text.Trim() + "')";

            if (!string.IsNullOrEmpty(tbUserMac.Text))
                Condition += " and vSrcMac = '" + tbUserMac.Text.Trim() + "'";

            if (txtvSiteName.Text.ToString() != "")
            {
                if (fromeq.Checked)
                    Condition += " and vSiteName = '" + txtvSiteName.Text.ToString() + "'";
                else
                    Condition += " and vSiteName like '%" + txtvSiteName.Text.ToString() + "%'";
            }

            if (!string.IsNullOrEmpty(ddlHorselist.SelectedValue) && (ddlHorselist.SelectedValue.Trim() != "0"))
            {
                Condition += " and vSiteName = '" + ddlHorselist.SelectedValue + "'";
            }

            //ip归属地查询
            if (ddlIpList.SelectedValue.Trim() != "-1")
            {
                Condition += " and ipnum = " + ddlIpList.SelectedValue.Trim();
            }

            int senstive = common.GetSenstiveCheck(this.CheckBoxList2);

            if (senstive > 0)
                Condition += " and ( (nKey & " + senstive + ")>0 ) ";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
            {
                Condition = Condition.Substring(5);
            }
        }
    }
Ejemplo n.º 8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        _RecordCount = Convert.ToInt32(lblRecordCount.Text);
        _PageCount = _RecordCount / _PageSize;
        if (_RecordCount % _PageSize > 0) _PageCount++;
        _PageIndex = Convert.ToInt32(lblPageIndex.Text);
        int selectedCount = 0;

        InfoTypeList.Attributes.Add("onchange", "DoTypeChange()");
        string sParent = "'0'";
        DB = new dbInfoAll(InfoTypeList.SelectedValue.ToString());
        frameurl.Text = "<iframe src='' id='frmContent' name='frmContent' scrolling='no' frameborder='0' width='100%' height='120px'></iframe>";
        if (!IsPostBack)
        {
            dbConfig configDB = new dbConfig();
            string gUserName = configDB.getUserName(User.Identity.Name);
            string gIP = Request.ServerVariables["Remote_Addr"];
            string gContent = "其他查询";
            common.setLog(User.Identity.Name, gUserName, gIP, gContent);
            formInit();
        }
        else
        {
            switch (qrytypelist.SelectedItem.Value)
            {
                case "0"://自选时间段
                    Condition += "vTime > '" + Convert.ToDateTime(sdate.Value.ToString()).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + Convert.ToDateTime(edate.Value.ToString()).AddDays(1).ToString("yyyy-MM-dd") + "'";
                    break;
                case "1"://前三天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-3).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "2"://前一周
                    Condition += "vTime > '" + DateTime.Today.AddDays(-7).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "3"://前一月
                    Condition += "vTime > '" + DateTime.Today.AddMonths(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
                case "5"://昨天
                    Condition += "vTime > '" + DateTime.Today.AddDays(-1).ToString("yyyy-MM-dd") + "'";
                    Condition += " and vTime < '" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                    break;
            }

            //获取选中的服务器
            foreach (ListItem li in cblHost.Items)
            {
                if (li.Selected)
                {
                    sParent += "," + li.Value + "";
                    selectedCount++;
                }
            }

            if (selectedCount <= 0)//tedi3231 added 2010.02.01 没有选中任何站点时显示用户能看到的所有站点
            {
                sParent = common.GetHosrList(User.Identity.Name);
            }

            Condition += " and nParent in (" + sParent + ")";

            if (txtSrcAddr.Text.ToString() != "")
                Condition += " and vSrcAddr = dmc_config.dbo.[f_IP2int]('" + txtSrcAddr.Text.ToString() + "')";

            if (txtSrcMac.Text.ToString() != "")
                Condition += " and vSrcMac = '" + txtSrcMac.Text.ToString() + "'";

            if (txtDstAddr.Text.ToString() != "")
                Condition += " and vDstAddr = dmc_config.dbo.[f_IP2int]('" + txtDstAddr.Text.ToString() + "')";

            if (txtDstMac.Text.ToString() != "")
                Condition += " and vDstMac = '" + txtDstMac.Text.ToString() + "'";

            if (txtLogin.Text.ToString() != "")
                Condition += " and vLogin like '%" + txtLogin.Text.ToString() + "%'";

            if (InfoTypeList.SelectedValue.ToString() == "web")//Web帐号
            {
                if (txtSiteName.Text.ToString() != "")
                    Condition += " and vSiteName like '%" + txtSiteName.Text.ToString() + "%'";
            }
            else
            {
                if (tbSiteName.Text.ToString() != "")
                    Condition += " and vSiteName like '%" + txtSiteName.Text.ToString() + "%'";
            }

            if (cbkEmpty.Checked) //用户名和密码非空
            {
                Condition += " and (vLogin is not null) and (vPwd is not null)";
            }

            int senstive = common.GetSenstiveCheck(this.CheckBoxList2);

            if (senstive > 0)
                Condition += " and ( (nKey & " + senstive + ")>0 ) ";

            // 条件传给存储过程的时候,最前面不需要跟上and
            if (!string.IsNullOrEmpty(Condition) && Condition.Length > 4 && Condition.Substring(0, 5) == " and ")
                Condition = Condition.Substring(5);
        }
    }