home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / DeleteEmailList.asp < prev    next >
Text File  |  2006-11-29  |  3KB  |  60 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.11
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page deletes an email list, and then redirects the
  7. '                     user back to the user's list of email lists.
  8. '
  9. '   COPYRIGHT NOTICE                                
  10. '
  11. '   See attached Software License Agreement
  12. '
  13. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  14. '***********************************************************************
  15. %>
  16. <!--#Include File="Include/Config_inc.asp"-->
  17. <!--#Include File="Include/Utility_inc.asp"-->
  18. <!--#Include File="Include/adovbs_inc.asp"-->
  19. <!--#Include File="Include/CurrentUser_inc.asp"-->
  20. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  21. <!--#Include File="Include/Constants_inc.asp"-->
  22. <%
  23.     'If the user does not have "Create" or "Admin" permission, redirect to the access denied page.
  24.     If lngUserSecurityLevel <> SUR_SECURITY_LEVEL_CREATE And lngUserSecurityLevel <> SUR_SECURITY_LEVEL_ADMIN Then
  25.         Response.Redirect "AccessDenied.asp?Reason=" & SUR_ACCESS_DENIED_NOT_ADMIN_SECURITY_LEVEL
  26.     End If
  27.  
  28.     Dim strSQL
  29.     Dim conDelete
  30.     Dim lngEmailListID
  31.  
  32.     'Initialization
  33.     Set conDelete = Server.CreateObject("ADODB.Connection")
  34.     conDelete.Open SURVEY_APP_CONNECTION
  35.     lngEmailListID = Request.QueryString("EmailListID")
  36.  
  37.     'Delete all the entries from the email sent history table (SUR_EMAIL_SENT_HISTORY)
  38.     strSQL = "DELETE FROM sur_email_sent_history WHERE email_address_id IN (" & _
  39.              ConvertSQLInClause("SELECT email_address_id FROM sur_email_address WHERE email_list_id = " & lngEmailListID, "email_address_id") & ")"
  40.     conDelete.Execute ConvertSQL(strSQL), , adCmdText
  41.  
  42.     'Delete all the entries from the address table (SUR_EMAIL_ADDRESS)
  43.     strSQL = "DELETE FROM sur_email_address WHERE email_list_id = " & lngEmailListID
  44.     conDelete.Execute ConvertSQL(strSQL), , adCmdText
  45.  
  46.     'Delete the message history the message history table (SUR_EMAIL_MESSAGE)
  47.     strSQL = "DELETE FROM sur_email_message WHERE email_list_id = " & lngEmailListID
  48.     conDelete.Execute ConvertSQL(strSQL), , adCmdText
  49.  
  50.     'Delete the email list from the email list table (SUR_EMAIL_LIST)
  51.     strSQL = "DELETE FROM sur_email_list WHERE email_list_id = " & lngEmailListID
  52.     conDelete.Execute ConvertSQL(strSQL), , adCmdText
  53.  
  54.     'Clean up
  55.     conDelete.Close
  56.     Set conDelete = Nothing
  57.  
  58.     'Redirect to the main list of email lists for the current user
  59.     Response.Redirect "EmailListList.asp"
  60. %>