Exemple #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     dbInfoAll DB = new dbInfoAll(Request.QueryString["infotype"].ToString());
     DataSet ds;
     if (Request.QueryString["type"] != null)
     {
         ds = DB.GetContentByID(Request.QueryString["type"], Request.QueryString["id"]);
         txtSrcMac.Text = ds.Tables[0].Rows[0]["vSrcMac"].ToString();
         txtSrcAddr.Text = common.NumberToIP(ds.Tables[0].Rows[0]["vSrcAddr"]);
         txtDstMac.Text = ds.Tables[0].Rows[0]["vDstMac"].ToString();
         txtDstAddr.Text = common.NumberToIP( ds.Tables[0].Rows[0]["vDstAddr"]);
         txtLogin.Text = ds.Tables[0].Rows[0]["vLogin"].ToString();
         txtPwd.Text = ds.Tables[0].Rows[0]["vPwd"].ToString();
         //DB.SetReaded(Request.QueryString["type"], Request.QueryString["id"]);
         if (Request.QueryString["infotype"].ToString() == "web")
         {
             trSite.Visible = true;
             txtSiteName.Text = ds.Tables[0].Rows[0]["vsitename"].ToString();
         }
     }
 }
 /// <summary>
 /// 根据选择的模块生成不同的类型
 /// </summary>
 /// <param name="type"></param>
 /// <returns></returns>
 private database CreateDataBase(string type)
 {
     database d = null;
     switch (type)
     {
         case "1":
             d = new dbHttpAll();
             break;
         case "2":
             d = new dbMsgAll("Msn");
             break;
         case "3":
             d = new dbMsgAll("Yahoo");
             break;
         case "4":
             d = new dbMailBox("Pop");
             break;
         case "5":
             d = new dbMailBox("Smtp");
             break;
         case "6":
             d = new dbMailSite("Get");
             break;
         case "7":
             d = new dbMailSite("Send");
             break;
         case "8":
             d = new dbInfoAll("Web");
             break;
         case "9":
             d = new dbDns();
             break;
         case "10":
             d = new dbHorse();
             break;
         case "11":
             d = new dbInfoAll("Ftp");
             break;
     }
     return d;
 }
 //导出BBS数据
 protected void btnBBSExport_Click(object sender, EventArgs e)
 {
     DateTime dteFromDate, dteToDate;
     dteFromDate = Convert.ToDateTime(BBSStartDate.Value.ToString()).Date;
     dteToDate = Convert.ToDateTime(BBSEndDate.Value.ToString()).Date;
     dbInfoAll DB = new dbInfoAll("BBS");
     string FileName = Server.MapPath(".") + "\\temp\\" + common.GetFileName() + ".xls";
     DB.ExportToExcel(dteFromDate, dteToDate, FileName);
     SendToClient(FileName);
 }
 //删除BBS数据
 protected void btnBBSDelete_Click(object sender, EventArgs e)
 {
     DateTime dteFromDate, dteToDate;
     dteFromDate = Convert.ToDateTime(BBSStartDate.Value.ToString()).Date;
     dteToDate = Convert.ToDateTime(BBSEndDate.Value.ToString()).Date;
     dbInfoAll DB = new dbInfoAll("BBS");
     DB.DelTables(dteFromDate, dteToDate);
 }
    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);
        }
    }