I trying to convert this to a generic funtion where I can call this and just pass the table through
Private Sub tblOrderDetailsSet_Updating(entity As tblOrderDetails)
Dim change = entity.Id
Dim newvals = "New Values:"
Dim oldvals = "Original Values:"
For Each prop In entity.Details.Properties.All().
OfType(Of Microsoft.LightSwitch.Details.IEntityStorageProperty)()
If prop.Name <> "Id" Then
If Not Object.Equals(prop.Value, prop.OriginalValue) Then
oldvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.OriginalValue)
newvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.Value)
End If
End If
Next
Dim oldvalue As String = oldvals
Dim newvalue As String = newvals
Dim username As String
username = Getusername()
' Dim customer As String = entity.OrderId.CustomerIDQuery.CustomerDesc.tostring
Logmessage(, , entity.Id, "OrderDetails as being changes", "Order Form", entity.Id, , , "Order where changed", newvals, , , oldvals, , , entity.ProductId.ItemCode & " - " & entity.ProductId.Description, entity.OrderId.Id, , , username, , entity.OrderId.DeliveryDate)
____________________________________________________________________________________________________ ___________________
This is what I tried below
Public Sub GetOldValue(entity As IEntitySet)
Dim change = entity.Details.EntitySet.Details.DataService.Details.Properties.All
''My problem is here on the line above
Dim newvals = "New Values:"
Dim oldvals = "Original Values:"
For Each prop In entity.Details.EntitySet.Details.DataService.Details.Properties.All().
''My problem is here on the line above
OfType(Of Microsoft.LightSwitch.Details.IEntityStorageProperty)()
If prop.Name <> "Id" Then
If Not Object.Equals(prop.Value, prop.OriginalValue) Then
oldvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.OriginalValue)
newvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.Value)
End If
End If
Next
Dim oldvalue As String = oldvals
Dim newvalue As String = newvals
Dim username As String
username = Getusername()
Logmessage(, , entity.Id, "OrderDetails as being changes", "Order Form", entity.Id, , , "Order where changed", newvals, , , oldvals, , , entity.ProductId.ItemCode & " - " & entity.ProductId.Description, entity.OrderId.Id, , , username, , entity.OrderId.DeliveryDate)
End Sub
Private Sub tblOrderDetailsSet_Updating(entity As tblOrderDetails)
Dim change = entity.Id
Dim newvals = "New Values:"
Dim oldvals = "Original Values:"
For Each prop In entity.Details.Properties.All().
OfType(Of Microsoft.LightSwitch.Details.IEntityStorageProperty)()
If prop.Name <> "Id" Then
If Not Object.Equals(prop.Value, prop.OriginalValue) Then
oldvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.OriginalValue)
newvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.Value)
End If
End If
Next
Dim oldvalue As String = oldvals
Dim newvalue As String = newvals
Dim username As String
username = Getusername()
' Dim customer As String = entity.OrderId.CustomerIDQuery.CustomerDesc.tostring
Logmessage(, , entity.Id, "OrderDetails as being changes", "Order Form", entity.Id, , , "Order where changed", newvals, , , oldvals, , , entity.ProductId.ItemCode & " - " & entity.ProductId.Description, entity.OrderId.Id, , , username, , entity.OrderId.DeliveryDate)
____________________________________________________________________________________________________ ___________________
This is what I tried below
Public Sub GetOldValue(entity As IEntitySet)
Dim change = entity.Details.EntitySet.Details.DataService.Details.Properties.All
''My problem is here on the line above
Dim newvals = "New Values:"
Dim oldvals = "Original Values:"
For Each prop In entity.Details.EntitySet.Details.DataService.Details.Properties.All().
''My problem is here on the line above
OfType(Of Microsoft.LightSwitch.Details.IEntityStorageProperty)()
If prop.Name <> "Id" Then
If Not Object.Equals(prop.Value, prop.OriginalValue) Then
oldvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.OriginalValue)
newvals += String.Format("{0}{1}: {2}", vbCrLf, prop.Name, prop.Value)
End If
End If
Next
Dim oldvalue As String = oldvals
Dim newvalue As String = newvals
Dim username As String
username = Getusername()
Logmessage(, , entity.Id, "OrderDetails as being changes", "Order Form", entity.Id, , , "Order where changed", newvals, , , oldvals, , , entity.ProductId.ItemCode & " - " & entity.ProductId.Description, entity.OrderId.Id, , , username, , entity.OrderId.DeliveryDate)
End Sub