//Action to fill itemtype select2 public JsonResult _FillBranch(int branchId, string description) { try { dbConfig obj = new dbConfig(); List <dbConfig> data = obj.getdbList(0, "", 0); string DbConStr = (data != null && data.Count > 0) ? data.FirstOrDefault().DbConStr : ""; string DbCommonConStr = (data != null && data.Count > 0) ? data.FirstOrDefault().DbCommonConStr : ""; string SerialNumber = (data != null && data.Count > 0) ? data.FirstOrDefault().SerialNumber : ""; string AuthCode = (data != null && data.Count > 0) ? data.FirstOrDefault().AuthCode : ""; EvolutionSDK objEvol = new EvolutionSDK(DbConStr, DbCommonConStr, SerialNumber, AuthCode); List <Branch> branchList = objEvol.branchList("cBranchCode like '%" + description + "%' OR cBranchDescription like '%" + description + "%'"); var dbResult = branchList != null ? (from row in branchList select new { id = row.ID, text = row.Code + '-' + row.Description }).ToList() : null; return(Json(dbResult, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { throw ex; } }
/// <summary> /// 导出方法 /// </summary> private void export() { database db = new dbConfig(); string xmlPath = Server.MapPath("~/src/temp/") + tableName + "_" + Page.User.Identity.Name + ".txt"; DataSet ds = db.CreateDataSet("SELECT " + this.field + " FROM " + this.tableName); if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0) // 没有数据,直接放弃 { return; } StringBuilder bul = new StringBuilder(); foreach (DataRow row in ds.Tables[0].Rows) { if (this.type == 5) { bul.Append(row["dynamicname"].ToString()); } else { bul.Append(row["vName"].ToString()); } bul.Append("\n"); } if (WriteStringToFile(bul, xmlPath)) //写入成功则发到客户端 { SendToClient(xmlPath); } }
/// <summary> /// /// </summary> /// <param name="mail"></param> public Authentication(string mail) { dbConfig dbConfig = new dbConfig(); db = dbConfig.GetDatabase(); this.mail = mail; rank = "Owner"; //this.rank = db.QuerySingle("SELECT Rank FROM Profile_Table WHERE Email = @0", mail); }
protected void imgLogin_Click(object sender, ImageClickEventArgs 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; } }
public sqlParameters getSSP(string searchKey, string searchVal, string SQLcmd, string tableName, SqlConnection db_connector) { dbConfig db = new dbConfig( ); sqlParameters ssp = new sqlParameters( ); ssp.db_connector = new SqlConnection(db.inven_SQL_admin); ssp.tableName = tableName; ssp.SQLcmd = SQLcmd; ssp.searchKey = searchKey; ssp.searchVal = searchVal; return(ssp); }
public ActionResult Admin() { try { SessLogObj = (LoginSessionDetails)HttpContext.Session["SessionInformation"]; dbConfig obj = new dbConfig(); List <dbConfig> objListdbConfig = obj.getdbList(0, "", SessLogObj.objLoginM.UserId, 1); return(View(objListdbConfig)); } catch (Exception ex) { throw ex; } }
protected void Button1_Click(object sender, EventArgs e) { string dataType = DataType; dbConfig db = new dbConfig(); DataSet ds = db.CreateDataSet("SELECT vState FROM TS_ListUpdate"); int val = 0; if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { val = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString()); } string sql = "Update TS_ListUpdate SET vState = " + issued(val); db.ExecuteScalar(sql); }
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(); } }
/// <summary> /// 验证密码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btEnter_Click(object sender, EventArgs e) { string pass = TextBox1.Text.Trim(); string name = Session["adminName"].ToString(); pass = common.md5(pass); dbConfig db = new dbConfig(); DataSet ds = db.getUsers(User.Identity.Name); bool isAdmin = false; if (ds != null && ds.Tables.Count > 0) { foreach (DataRow row in ds.Tables[0].Rows) { if ( row[2].ToString() == pass && row[1].ToString()==name ) { isAdmin = true; this.divImport.Visible = true; this.passDiv.Visible = false; break; } } } if (!isAdmin) { ltMsg.Text = "<script>alert('对不起,管理员密码不正确');</script>"; return; } Session["passd"] = common.md5(TextBox1.Text.Trim()); initForm(); //Response.Redirect("importFileForBlack.aspx?type=" + this.hdType.Value); //ltMsg.Text = "<script>javascript:window.close();</script>"; }
/// <summary> /// 更新 /// </summary> private static void update() { database db = new dbConfig(); DataSet ds = db.CreateDataSet("select * from TB_Update"); if (ds == null || ds.Tables == null || ds.Tables[0] == null || ds.Tables[0].Rows.Count <= 0) return; string path = string.Empty; string version = string.Empty; foreach (DataRow row in ds.Tables[0].Rows) { if (row["vSystemType"].ToString() == "2") //windows { path = helper.VersionUpdate.UpdateFile(2, Convert.ToInt32(row["vVersion"])); version = helper.VersionUpdate.GetVersion(2); if (!string.IsNullOrEmpty(path)) db.ExecuteScalar("update TB_Update set vVersion=" + version + ",vAppPath='" + path + "',dUpdateDate='" + DateTime.Now.ToString() + "' where vSystemType=2"); } if (row["vSystemType"].ToString() == "1") //redhat { path = helper.VersionUpdate.UpdateFile(1, Convert.ToInt32(row["vVersion"])); version = helper.VersionUpdate.GetVersion(1); if (!string.IsNullOrEmpty(path)) db.ExecuteScalar("update TB_Update set vVersion=" + version + ",vAppPath='" + path + "',dUpdateDate='" + DateTime.Now.ToString() + "' where vSystemType=1"); } if (row["vSystemType"].ToString() == "0") //fedore { path = helper.VersionUpdate.UpdateFile(0, Convert.ToInt32(row["vVersion"])); version = helper.VersionUpdate.GetVersion(0); if (!string.IsNullOrEmpty(path)) db.ExecuteScalar("update TB_Update set vVersion=" + version + ",vAppPath='" + path + "',dUpdateDate='" + DateTime.Now.ToString() + "' where vSystemType=0"); } } }
protected void Page_Load(object sender, EventArgs e) { DataSet ds; if (Request.QueryString.ToString() != "") { ds = DB.GetContentByID(Request.QueryString["type"], Request.QueryString["id"]); int ipsrcnum = ds.Tables[0].Rows[0]["vSrcAddr"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["vSrcAddr"]); int ipdstnum = ds.Tables[0].Rows[0]["vDstAddr"] == DBNull.Value ? 0 : Convert.ToInt32(ds.Tables[0].Rows[0]["vDstAddr"]); txtSrcMac.Text = ds.Tables[0].Rows[0]["vSrcMac"].ToString(); txtSrcAddr.Text = common.NumberToIP(ipsrcnum); txtDstMac.Text = ds.Tables[0].Rows[0]["vDstMac"].ToString(); txtDstAddr.Text = common.NumberToIP(ipdstnum); txtLogin.Text = ds.Tables[0].Rows[0]["vLogin"].ToString(); txtPwd.Text = ds.Tables[0].Rows[0]["vPwd"].ToString(); dbConfig df = new dbConfig(); ltArea.Text = df.GetIpArea(ipdstnum); //DB.SetReaded(Request.QueryString["type"], Request.QueryString["id"]); } }
//获取站点名称 public static string getSiteName(string nId) { dbConfig dbSite = new dbConfig(); DataSet ds = dbSite.getHostByID(nId); return ds.Tables[0].Rows[0]["vCorpName"].ToString(); }
/// <summary> /// 获取IP的具体地址信息 /// </summary> /// <param name="ipnum">大地址</param> /// <param name="ip">IP值</param> /// <returns>IP的具体地址信息</returns> public static string GetIpAreaInfo(string ipnum, string ip) { if (string.IsNullOrEmpty(ip)) { return string.Empty; } dbConfig db2 = new dbConfig(); if (string.IsNullOrEmpty(ipnum)) { return db2.GetIpArea(ip); } DataSet ds2 = db2.GetIpAddrInfo(ipnum, ip); ; if (ds2 != null && ds2.Tables.Count > 0 && ds2.Tables[0].Rows.Count > 0) { return ds2.Tables[0].Rows[0][0].ToString(); } return "尚无记录"; }
/// <summary> /// 根据用户ID返回用户能访问的所有节点,没有则返回NULL /// </summary> /// <param name="userID">用户ID</param> /// <returns>户能访问的所有节点,没有则返回NULL</returns> public static string GetHosrList(string userID) { dbConfig dbHost = new dbConfig(); DataSet ds = dbHost.getSites(userID); StringBuilder bul = new StringBuilder("'0'"); if (ds == null || ds.Tables.Count <= 0) { return null; } foreach (DataRow row in ds.Tables[0].Rows) { bul.Append(",'"); bul.Append(row["nId"].ToString()); bul.Append("'"); } return bul.ToString(); }
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"; } }
/// <summary> /// 对单位进行初始化 /// </summary> private void initSite() { dbConfig dbHost = new dbConfig(); cblHost.DataSource = dbHost.getSites(User.Identity.Name); cblHost.DataBind(); }
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); } }
protected void formInit() { sdate.MaxDate = DateTime.Today.AddDays(-1); edate.MaxDate = DateTime.Today.AddDays(-1); sdate.Value = Session["FromDate"]; edate.Value = Session["ToDate"]; dbConfig dbHost = new dbConfig(); cblHost.DataSource = dbHost.getSites(User.Identity.Name); cblHost.DataBind(); }
private void Init() { DateTime beginTime = DateTime.Now; DateTime endTime = DateTime.Now; switch (qrytypelist.SelectedItem.Value) { case "0"://自选时间段 beginTime = Convert.ToDateTime(sdate.Value.ToString()); endTime = Convert.ToDateTime(edate.Value.ToString()).AddDays(1); break; case "1"://前三天 beginTime = DateTime.Today.AddDays(-3); endTime = DateTime.Now; break; case "2"://前一周 beginTime = DateTime.Today.AddDays(-7); endTime = DateTime.Now; break; case "3"://前一月 beginTime = DateTime.Today.AddMonths(-1); endTime = DateTime.Now; break; case "5"://昨天 beginTime = DateTime.Today.AddDays(-1); endTime = DateTime.Now; 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); } sParent = sParent.Replace("'", ""); sParent = "(" + sParent + ")"; ipAddr = tbIp.Text.Trim(); dbConfig conDB = new dbConfig(); DataSet ds = conDB.ExecuteClues(ipAddr, beginTime, endTime, sParent); if (ds == null) { } else { ltDns.Text = ds.Tables[0].Rows[0]["DnsCount"].ToString(); ltHttp.Text = ds.Tables[0].Rows[0]["httpCount"].ToString(); ltMsn.Text = ds.Tables[0].Rows[0]["MsnCount"].ToString(); ltYahoo.Text = ds.Tables[0].Rows[0]["YahooCount"].ToString(); ltTrojan.Text = ds.Tables[0].Rows[0]["TrojanCount"].ToString(); ltPop.Text = ds.Tables[0].Rows[0]["Pop3MailCount"].ToString(); ltSmtp.Text = ds.Tables[0].Rows[0]["SmtpMailCount"].ToString(); ltSend.Text = ds.Tables[0].Rows[0]["SendWebMailCount"].ToString(); ltRev.Text = ds.Tables[0].Rows[0]["GetWebMailCount"].ToString(); ltWeb.Text = ds.Tables[0].Rows[0]["WebCount"].ToString(); ltFtp.Text = ds.Tables[0].Rows[0]["FtpCount"].ToString(); } }
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); } }
//public static void alert(Page page, string msg) //{ // page.RegisterStartupScript("message", "<script language='javascript' defer>alert('" + msg + "');</script>"); //} //写日志 public static void setLog(string UserID, string UserName, string IP, string Content) { // string path = HttpContext.Current.Server.MapPath("log/") + DateTime.Now.ToString("yyyyMMdd") + ".txt"; // if (!File.Exists(path)) // { // using (StreamWriter sw = File.CreateText(path)) // { // sw.WriteLine("[" + states + "] 用户名:" + User + " " + states + "时间:" + DateTime.Now.ToString() + " 用户IP:" + IP); // } // } // else // { // using (StreamWriter wr = File.AppendText(path)) // { // wr.WriteLine("[" + states + "] 用户名:" + User + " " + states + "时间:" + DateTime.Now.ToString() + " 用户IP:" + IP); // } // } dbConfig DB = new dbConfig(); DB.InsertLog(UserID, UserName, IP, Content); }
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); } }
/// <summary> /// 对窗体控件初始化 /// </summary> protected void formInit() { sdate.MaxDate = DateTime.Today.AddDays(-1); edate.MaxDate = DateTime.Today.AddDays(-1); sdate.Value = Session["FromDate"]; edate.Value = Session["ToDate"]; #region 绑定要查询的单位 dbConfig dbHost = new dbConfig(); cblHost.DataSource = dbHost.getSites(User.Identity.Name); cblHost.DataBind(); #endregion #region 绑定木马黑名单数据 this.ddlHorselist.DataSource = dbHost.GetHorseList(); this.ddlHorselist.DataTextField = "vName"; this.ddlHorselist.DataValueField = "vName"; this.ddlHorselist.DataBind(); this.ddlHorselist.Items.Insert(0, new ListItem("选择所有", "0")); #endregion }
public ActionResult Login(LoginModels objLogin) { try { if (ModelState.IsValid) { if (objLogin.BranchId > 0) { dbConfig objDb = new dbConfig(); objDb = objDb.getDatabse(0, "", 0); if (objDb != null && objDb.DbConfigId > 0) { string DbConStr = objDb != null ? objDb.DbConStr : ""; string DbCommonConStr = objDb != null ? objDb.DbCommonConStr : ""; string SerialNumber = objDb != null ? objDb.SerialNumber : ""; string AuthCode = objDb != null ? objDb.AuthCode : ""; EvolutionSDK obj = new EvolutionSDK(DbConStr, DbCommonConStr, SerialNumber, AuthCode); Agent objAgent = obj.validateAgent(objLogin.userName, objLogin.password); if (objAgent != null && objAgent.ID != 0) { int isAdmin = obj.agentGroupValidate(objAgent.ID, objDb.AdminGroup); int isReceptionist = obj.agentGroupValidate(objAgent.ID, objDb.UserReceptionistGroup); int isDoctor = obj.agentGroupValidate(objAgent.ID, objDb.UserDoctorGroup); int isCashier = obj.agentGroupValidate(objAgent.ID, objDb.UserCashierGroup); if (isAdmin > 0 || isReceptionist > 0 || isDoctor > 0 || isCashier > 0) { objDb.IsAdmin = isAdmin > 0 ? true : false; objDb.IsReceptionist = isReceptionist > 0 ? true : false; objDb.IsDoctor = isDoctor > 0 ? true : false; objDb.IsCashier = isCashier > 0 ? true : false; objDb.BranchId = objLogin.BranchId; LoginSessionDetails objLogSession = new LoginSessionDetails(); objLogSession.objDb = objDb; objLogSession.objAgent = objAgent; objLogSession.objLoginM = objLogin; Session["SessionInformation"] = objLogSession; string time = DateTime.Now.AddMinutes(1).ToString("mm.ss"); Session["ReminderTime"] = time; return(RedirectToAction("Index", "Home", new { returnUrl = (this.HttpContext.Request).Path })); } else { ModelState.AddModelError("ErrorMgr", "Invalid Agent or Password!"); } } else { ModelState.AddModelError("ErrorMgr", "Invalid Agent or Password!"); } } else { ModelState.AddModelError("ErrorMgr", "This branch is not configured with BIC App"); } } else { ModelState.AddModelError("ErrorMgr", "This branch is not configured with BIC App"); } } else { ModelState.AddModelError("ErrorMgr", "Error in login"); } } catch (Exception ex) { throw ex; } return(View(objLogin)); }
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); } }
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); } } }