1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
Private Function LotPropertyDateManager(ByVal CmdType As String) As SqlCommand
'Dim CommandName As String = "LotPropertyDate" + CmdType
Dim SQLCMD As New SqlClient.SqlCommand("PTLots.LotPropertyDate" + CmdType, DB.Connection)
SQLCMD.CommandType = CommandType.StoredProcedure
Dim IDPropertyDate As New SqlClient.SqlParameter("@IDPropertyDate", SqlDbType.Int, 10)
Dim GUIDPropertyDate As New SqlClient.SqlParameter("@GUIDPropertyDate", SqlDbType.UniqueIdentifier, 0)
Dim IDLot As New SqlClient.SqlParameter("@IDLot", SqlDbType.Int, 10)
Dim PropertyTypeDate As New SqlClient.SqlParameter("@PropertyTypeDate", SqlDbType.NVarChar, 50)
Dim PropertyValueDate As New SqlClient.SqlParameter("@PropertyValueDate", SqlDbType.DateTime2, 0)
Dim ATUser As New SqlClient.SqlParameter("@ATUser", SqlDbType.NVarChar, 50)
Dim ATHostName As New SqlClient.SqlParameter("@ATHostName", SqlDbType.NVarChar, 128)
Dim ATAppName As New SqlClient.SqlParameter("@ATAppName", SqlDbType.NVarChar, 128)
Dim ATMessage As New SqlClient.SqlParameter("@ATMessage", SqlDbType.NVarChar, 50)
' Equivalent de CmdType In (""select", "insert")
If New String() {"select", "insert"}.Contains(CmdType) Then
IDLot.Direction = ParameterDirection.Input
IDLot.Value = _IdLot
SQLCMD.Parameters.Add(IDLot)
End If
If New String() {"delete"}.Contains(CmdType) Then
IDLot.Direction = ParameterDirection.Input
IDLot.SourceVersion = DataRowVersion.Current
IDLot.SourceColumn = "IDLot"
SQLCMD.Parameters.Add(IDLot)
End If
If CmdType = "update" Then
IDPropertyDate.Direction = ParameterDirection.Input
IDPropertyDate.SourceVersion = DataRowVersion.Current
IDPropertyDate.SourceColumn = "IDPropertyDate"
SQLCMD.Parameters.Add(IDPropertyDate)
End If
If New String() {"insert", "update"}.Contains(CmdType) Then
PropertyTypeDate.Direction = ParameterDirection.Input
PropertyTypeDate.SourceVersion = DataRowVersion.Current
PropertyTypeDate.SourceColumn = "PropertyTypeDate"
PropertyValueDate.Direction = ParameterDirection.Input
PropertyValueDate.SourceVersion = DataRowVersion.Current
PropertyValueDate.SourceColumn = "PropertyValueDate"
ATUser.Direction = ParameterDirection.Input
ATHostName.Direction = ParameterDirection.Input
ATAppName.Direction = ParameterDirection.Input
ATMessage.Direction = ParameterDirection.Input
ATUser.Value = _ATUser
ATHostName.Value = _ATHostName
ATAppName.Value = _ATAppName
ATMessage.Value = _ATMessage
SQLCMD.Parameters.Add(PropertyTypeDate)
SQLCMD.Parameters.Add(PropertyValueDate)
SQLCMD.Parameters.Add(ATUser)
SQLCMD.Parameters.Add(ATHostName)
SQLCMD.Parameters.Add(ATAppName)
SQLCMD.Parameters.Add(ATMessage)
End If
LotPropertyDateManager = SQLCMD
End Function |
Partager