//STDdatagrid绑定 public void STDDB_Gridbinding() { try { conn.Open(); string sqlstr = "select * from std where fwmac='" + StaticGlobal.firewallmac + "'"; StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getSTDRule_list().Clear(); StaticGlobal.STDoldrules.Clear(); MySqlCommand cm = new MySqlCommand(sqlstr, conn); MySqlDataReader dr = cm.ExecuteReader(); //绑定 while (dr.Read()) { STDRuleDataTable datatable = new STDRuleDataTable(); datatable.log = Convert.ToBoolean(dr[1]); datatable.protocol = dr[2].ToString(); datatable.srcIP = dr[3].ToString(); datatable.dstIP = dr[4].ToString(); datatable.sport = dr[5].ToString(); datatable.dport = dr[6].ToString(); StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getSTDRule_list().Add(datatable); StaticGlobal.STDoldrules.Add(datatable); } dr.Close(); } catch (Exception e) { Console.WriteLine("exceptionInfo {0}", e); } finally { conn.Close(); } }
public void addSTDrule(STDRuleDataTable fwrdt) { STDRuleLists.Add(fwrdt); }