Imports System.Data.SqlClient Public Class cFirewallEntry Property fwr_ID As String = "" Property fwr_hostip As String = "" Property fwr_in As String = "" Property fwr_out As String = "" Property fwr_portsin As String = "" Property fwr_portsout As String = "" Property fwr_dienste As String = "" Property fwr_FQDN As String = "" Property fwr_info As String = "" Property fwr_direct As Boolean = False Function getparameterlist() As List(Of SQLVariable) Dim list As New List(Of SQLVariable) list.Add(New SQLVariable("fwr_ID", fwr_ID)) list.Add(New SQLVariable("fwr_hostip", fwr_hostip)) list.Add(New SQLVariable("fwr_in", fwr_in)) list.Add(New SQLVariable("fwr_out", fwr_out)) list.Add(New SQLVariable("fwr_portsin", fwr_portsin)) list.Add(New SQLVariable("fwr_portsout", fwr_portsout)) list.Add(New SQLVariable("fwr_dienste", fwr_dienste)) list.Add(New SQLVariable("fwr_FQDN", fwr_FQDN)) list.Add(New SQLVariable("fwr_info", fwr_info)) list.Add(New SQLVariable("fwr_direct", fwr_direct)) Return list End Function Public Shared Function getFirewallEntrys(ByRef ds As DataSet, ByVal HostIP As String) Dim selector As String = "Select [fwr_ID] ,[fwr_in] ,[fwr_out] ,[fwr_portsin] ,[fwr_portsout] ,[fwr_dienste] ,[fwr_FQDN] ,[fwr_info] , case when [fwr_direct] is null then '0' else [fwr_direct] end as [fwr_direct] From [Doku].[dbo].[TbL_FirewallRules] where [fwr_hostip] = '" & HostIP & "' ORDER BY [fwr_in]" cSQL.SQL2DS(selector, ds) End Function Public Function getUpdateCmd(ByRef update As String, ByRef where As String) Dim list As List(Of SQLVariable) = getparameterlist() 'Dim str As String For Each i In list If Not i.SQLText = "fwr_ID" Then update &= "[" & i.SQLText & "]='" & i.SQLValue & "'," Else where &= "fwr_ID = '" & i.SQLValue & "'" End If Next update = update.Substring(0, update.Length - 1) 'wg. ',' ' Return str End Function Public Function getInsertCmd(ByRef insert As String) Dim list As List(Of SQLVariable) = getparameterlist() Dim text, value As String For Each i In list text &= i.SQLText & ", " value &= "'" & i.SQLValue & "', " Next text = text.Substring(0, text.Length - 2) value = value.Substring(0, value.Length - 2) insert = "(" & text & ") VALUES (" & value & ")" End Function Public Function insertFirewallEntry(ByRef entry As cFirewallEntry) Dim insert As String getInsertCmd(insert) cSQL.InsertSQL("TbL_FirewallRules", insert) End Function Public Function updateFirewallEntry(ByRef entry As cFirewallEntry) Dim update, where As String getUpdateCmd(update, where) cSQL.UpdateSQL("TbL_FirewallRules", update, where) 'MsgBox(update & where) End Function End Class