//WHLdatagrid绑定
 public void WHLDB_Gridbinding()
 {
     try
     {
         conn.Open();
         string sqlstr = "select * from whl where fwmac='" + StaticGlobal.firewallmac + "'";
         StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getWHLRule_list().Clear();
         StaticGlobal.WHLoldrules.Clear();
         MySqlCommand    cm = new MySqlCommand(sqlstr, conn);
         MySqlDataReader dr = cm.ExecuteReader();
         //绑定
         while (dr.Read())
         {
             WHLRuleDataTable datatable = new WHLRuleDataTable();
             datatable.log      = Convert.ToBoolean(dr[5]);
             datatable.dst_IP   = dr[1].ToString();
             datatable.src_IP   = dr[2].ToString();
             datatable.dst_port = dr[3].ToString();
             datatable.src_port = dr[4].ToString();
             StaticGlobal.FireWalldevices[StaticGlobal.firewallindex].getWHLRule_list().Add(datatable);
             StaticGlobal.WHLoldrules.Add(datatable);
         }
         dr.Close();
     }
     catch (Exception e)
     {
         Console.WriteLine("exceptionInfo {0}", e);
     }
     finally
     {
         conn.Close();
     }
 }
Example #2
0
 public void addWHLRule(WHLRuleDataTable fwrdt)
 {
     WHLRuleLists.Add(fwrdt);
 }