//CNCdatagrid绑定 public void CNCDB_Gridbinding() { try { conn.Open(); string sqlstr = "select * from cnc where fwmac='" + StaticGlobal.firewallmac + "'"; StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getCNCRule_list().Clear(); StaticGlobal.CNColdrules.Clear(); MySqlCommand cm = new MySqlCommand(sqlstr, conn); MySqlDataReader dr = cm.ExecuteReader(); //绑定 while (dr.Read()) { CNCRuleDataTable datatable = new CNCRuleDataTable(); datatable.log = Convert.ToBoolean(dr[1]); datatable.connlimit = Convert.ToInt16(dr[2]); datatable.srcIP = dr[3].ToString(); datatable.dstIP = dr[4].ToString(); datatable.sport = dr[5].ToString(); datatable.dport = dr[6].ToString(); StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getCNCRule_list().Add(datatable); StaticGlobal.CNColdrules.Add(datatable); } dr.Close(); } catch (Exception e) { Console.WriteLine("exceptionInfo {0}", e); } finally { conn.Close(); } }
public void addCNCRule(CNCRuleDataTable fwrdt) { CNCRuleLists.Add(fwrdt); }