protected void Page_Load(object sender, EventArgs e) { DataSet ds; if (Request.QueryString.ToString() != "") { DB = new dbMailSite(Request.QueryString["mail"]); ds = DB.GetContentByID(Request.QueryString["type"], Request.QueryString["id"]); if (ds.Tables[0].Rows.Count > 0) { txtLpFrom.Text = ds.Tables[0].Rows[0]["vLpFrom"].ToString(); txtCapture.Text = ds.Tables[0].Rows[0]["dCapture"].ToString(); txtLpTo.Text = ds.Tables[0].Rows[0]["vLpTo"].ToString(); txtLpCc.Text = ds.Tables[0].Rows[0]["vLpCc"].ToString(); txtLogin.Text = ds.Tables[0].Rows[0]["vLogin"].ToString(); txtPwd.Text = ds.Tables[0].Rows[0]["vPwd"].ToString(); txtSrcMac.Text = ds.Tables[0].Rows[0]["vSrcMac"].ToString(); txtDstMac.Text = ds.Tables[0].Rows[0]["vDstMac"].ToString(); txtSrcAddr.Text = common.NumberToIP(ds.Tables[0].Rows[0]["vSrcAddr"]); txtDstAddr.Text = common.NumberToIP(ds.Tables[0].Rows[0]["vDstAddr"]); txtLpTitle.Text = ds.Tables[0].Rows[0]["vLpTitle"].ToString(); txtmapadd.Text = ds.Tables[0].Rows[0]["vLocalFile"].ToString(); txtWebFile.Text = ds.Tables[0].Rows[0]["vWebFile"].ToString(); tbBcc.Text = ds.Tables[0].Rows[0]["vLpBcc"].ToString(); if (ds.Tables[0].Rows[0]["nAttach"].ToString() == "1") { txtWebFile.Width = 200; imbWebFile.Visible = true; } else { txtWebFile.Width = 220; imbWebFile.Visible = false; } strMailAddr = ds.Tables[0].Rows[0]["vLocalFile"].ToString(); //emlFile = common.GetFileUrl(strMailAddr); emlFile2 = strMailAddr; if (!string.IsNullOrEmpty(strMailAddr))//&& System.IO.File.Exists(strMailAddr) { emlFile = "../" + strMailAddr.Substring(strMailAddr.LastIndexOf('\\') + 1); } else { emlFile = string.Empty; } DB.SetReaded(Request.QueryString["type"], Request.QueryString["id"]); } } }
//按内容搜索文件,返回搜索到的文件个数 public int searchFile(string content, int IsGarbage) { int fileCount = 0; string sDirectory = ""; string sFileName = ""; string sPath = ""; string sDate = ""; dbMailBox PopMail = new dbMailBox("Pop"); dbMailBox SmtpMail = new dbMailBox("Smtp"); dbMailSite GetMail = new dbMailSite("Get"); dbMailSite SendMail = new dbMailSite("Send"); if (content.Length > 0) { using (Connection) { Connection.Open(); using (OleDbCommand cmd = Connection.CreateCommand()) { cmd.CommandText = string.Format(@"select Filename,Directory,Path from Scope() where CONTAINS (Contents,'{0}') AND MATCHES(ShortFileName, '*.|(HTM|,EML|)')", content); using (OleDbDataAdapter da = new OleDbDataAdapter(cmd)) { using (DataTable dt = new DataTable()) { da.Fill(dt); fileCount = dt.Rows.Count; if (IsGarbage == 0)//对敏感信息关键字处理 { for (int i = 0; i < fileCount; i++) { sDirectory = dt.Rows[i]["Directory"].ToString(); sFileName = dt.Rows[i]["FileName"].ToString(); sDate = sDirectory.Substring(sDirectory.Length - 10, 8); sPath = sDirectory + "/" + sFileName; if (sDirectory.Substring(sDirectory.Length - 1) == "0") { PopMail.dpsRecByFile(sDate, sPath, IsGarbage); SmtpMail.dpsRecByFile(sDate, sPath, IsGarbage); } else { GetMail.dpsRecByFile(sDate, sPath, IsGarbage); SendMail.dpsRecByFile(sDate, sPath, IsGarbage); } } } if (IsGarbage == 1)//对垃圾邮件关键字处理 { for (int i = 0; i < fileCount; i++) { sPath = dt.Rows[i]["Path"].ToString(); File.Delete(sPath); if (sDirectory.Substring(sDirectory.Length - 1) == "0") { PopMail.dpsRecByFile(sDate, sPath, IsGarbage); SmtpMail.dpsRecByFile(sDate, sPath, IsGarbage); } else { GetMail.dpsRecByFile(sDate, sPath, IsGarbage); SendMail.dpsRecByFile(sDate, sPath, IsGarbage); } } } } } } } } return fileCount; }
/// <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; }
//导出SendWebMail数据 protected void btnSendExport_Click(object sender, EventArgs e) { DateTime dteFromDate, dteToDate; dteFromDate = Convert.ToDateTime(SendWebMailStartDate.Value.ToString()).Date; dteToDate = Convert.ToDateTime(SendWebMailEndDate.Value.ToString()).Date; dbMailSite DB = new dbMailSite("Send"); string FileName = Server.MapPath(".") + "\\temp\\" + common.GetFileName() + ".xls"; DB.ExportToExcel(dteFromDate, dteToDate, FileName); SendToClient(FileName); }
//删除SendWebMail数据 protected void btnSendDelete_Click(object sender, EventArgs e) { DateTime dteFromDate, dteToDate; dteFromDate = Convert.ToDateTime(SendWebMailStartDate.Value.ToString()).Date; dteToDate = Convert.ToDateTime(SendWebMailEndDate.Value.ToString()).Date; dbMailSite DB = new dbMailSite("Send"); 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); string strPara = Request.QueryString["nparent"]; DB = new dbMailSite(rdlMailType.SelectedItem.Value); 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=dmc_config.dbo.[f_IP2int]('" + 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) + "的Web邮件内容"; 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"; } }