Sending Email on Row_Inserted / Row_Updated
Hi,
having migrated from ASPMaker I finding it quite difficult to transfer codes I used to use to the new format. BTW what is the code format used in the new server events? am I right in thinking VB.NET?
anyways in ASPMaker I used to use this code to send emails in the event of new row being added.
The code displayed a message to the user then sent an email based on conditions. It also retrieved the required recipients email from a table**.
Please can someone help me achieve this in asp.net. Just by helping me transfer the below code to the new format will help me learn massively as I will understand the new syntax a lot more.
' Row Inserted event
Sub Row_Inserted(rsold, rsnew)
IF visitor_log.Factory_Access.currentvalue = 1 OR visitor_log.Official_Factory_Tour.currentvalue = 1 THEN
Page.SuccessMessage = "Your Visitor(s): " & rsnew("visitor") & ", Requires Authorisation. The Authoriser has been informed."
End If
IF visitor_log.Official_Factory_Tour.currentvalue = 1 THEN
Dim Email1
Set Email1 = New cEmail
Email1.Content = "A New Visitor Has Been Requested, This Visitor Requires An Official Factory Tour. Please click the link To View The Request: hxxp://server/visitorsv1/Factory_Tour_Requestslist.asp"
Email1.Subject = "A New Visitor Requires An Official Factory Tour"
Email1.Sender = "email@email.com"
** Email1.Recipient = ew_executescalar("SELECT [Authorisers].[Official Factory Tours] FROM [Authorisers] WHERE [Authorisers].[ID] = 1;") **
Email1.Send()
End If
IF visitor_log.Official_Factory_Tour.currentvalue = 1 THEN
Dim Email9
Set Email9 = New cEmail
Email9.Content = "A New Visitor Has Been Requested, This Visitor Requires An Official Factory Tour. Please click the link To View The Request: hxxp://server/visitorsv1/Factory_Tour_Requestslist.asp"
Email9.Subject = "A New Visitor Requires An Official Factory Tour"
Email9.Sender = "email@email.com"
Email9.Recipient = ew_executescalar("SELECT [Authorisers].[Official Factory Tours] FROM [Authorisers] WHERE [Authorisers].[ID] = 2;")
Email9.Send()
End If
Any help is greatly appreciated.