This article has been dead for over three months
You
Hi all,
I have an urgent problem..Plzz can anyone help me guys..
We are into a student management system project and we want to send E-mails to students once tehy are registered with us saying taht from so and so date teh course is gonna start.
I am getting teh following error.
Actually our server is connected to a Fileserver and tehn then exchange server.
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt).ADUserID = "" And _
CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt).LDAP = "" Then
Session("Error") = "Access To Avantus Training Management System Denied!
You Need To Have A User Profile To Logon To The System.
Contact Your Administrator For More Information."
Session("Hide") = True
Session("CurUserProfile") = Nothing
Response.Redirect("../SystemAdmin/Error.aspx")
ElseIf Not (CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt).Profile_LogOnTimingFrom = "" And _
CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt).Profile_LogOnTimingTo = "") Then
If Not ((DateTime.Parse(Now.ToShortDateString & " " & CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt).Profile_LogOnTimingFrom) <= Now) And _
(DateTime.Parse(Now.ToShortDateString & " " & CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt).Profile_LogOnTimingTo) >= Now)) Then
Session("Error") = "Access To Avantus Training Management System Denied!
You Are Restricted To Log On At This Time.
Contact Your Administrator For More Information."
Session("Hide") = True
Session("CurUserProfile") = Nothing
Response.Redirect("../SystemAdmin/Error.aspx")
End If
ElseIf Not CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt). _
TrainingAdmin_myReminderConfirm_View Then
Session("Error") = "You Do Not Have Access Privileges!
Contact Your Administrator For More Information.
Back To Home"
Session("Hide") = True
Response.Redirect("../SystemAdmin/Error.aspx")
Exit Sub
End If
MenuNav1.SourceFilePath = "../../Config/NavMenu.xml"
MenuNav1.ver = Version()
MenuNav1.displayName = CType(Session("displayName"), String)
If Not Page.IsPostBack Then
LoadConfirmStudent()
End If
If Not CType(Session("CurUserProfile"), Avantus.WebModules.SystemAdmin.Business.UserMgmt). _
TrainingAdmin_myReminderConfirm_Print Then
TDReportGenHeader.Visible = False
TDReportGenSettings.Visible = False
dgStudent.Columns(7).Visible = False
End If
End Sub
Public Sub LoadConfirmStudent()
Dim myTrainingAdmin As New Avantus.WebModules.TrainingAdmin.Business.ReportGen
dgStudent.DataSource = myTrainingAdmin.GetAllConfirmStudent()
dgStudent.DataBind()
myTrainingAdmin = Nothing
End Sub
Private Sub dgStudent_SortCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridSortCommandEventArgs) Handles dgStudent.SortCommand
Dim myTrainingAdmin As New Avantus.WebModules.TrainingAdmin.Business.ReportGen
Dim myDataView As DataView = myTrainingAdmin.GetAllConfirmStudent().Tables(0).DefaultView
myDataView.Sort = e.SortExpression
dgStudent.DataSource = myDataView
dgStudent.DataBind()
myTrainingAdmin = Nothing
End Sub
Private Sub imgButGenerate_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgButGenerate.Click
Dim i As Integer = 0
Dim k As Integer = 0
Dim j As Integer = 0
Dim moreThanOne As Boolean = False
Dim sendToAddr As String = ""
Dim salesPerson As String = ""
Dim objHtml As String = ""
Dim myStudentAdmin As New Avantus.WebModules.Registration.Business.StudentAdmin
Dim myAD As New Avantus.WebModules.SystemAdmin.Business.ActiveDirectory
Dim myReportGen As New Avantus.WebModules.TrainingAdmin.Business.ReportGen
Dim regStudentID() As ArrayList
Dim regNo() As ArrayList
Dim lastRegNo As String = ""
Dim lastCourseRef As String = ""
Dim lastCourseDate As String = ""
Dim firstTimeEntered As Boolean = True
Try
For i = 0 To dgStudent.Items.Count - 1
If CType(dgStudent.Items(i).Cells(7).Controls(1), CheckBox).Checked Then
'if it is the same reg, same course, same date or 1st item
If (lastRegNo = "" And lastCourseRef = "" And lastCourseDate = "") _
Or (lastRegNo = dgStudent.Items(i).Cells(2).Text And _
lastCourseRef = dgStudent.Items(i).Cells(0).Text And _
lastCourseDate = dgStudent.Items(i).Cells(4).Text) Then
If k = 0 And firstTimeEntered Then
ReDim Preserve regStudentID(1)
ReDim Preserve regNo(1)
regStudentID(0) = New ArrayList
regNo(0) = New ArrayList
regStudentID(0).Add(Integer.Parse(Integer.Parse(dgStudent.Items(i).Cells(8).Text)))
regNo(0).Add(dgStudent.Items(i).Cells(2).Text)
firstTimeEntered = False
Else
regStudentID(k).Add(Integer.Parse(Integer.Parse(dgStudent.Items(i).Cells(8).Text)))
End If
Else
ReDim Preserve regStudentID(regStudentID.Length + 1)
ReDim Preserve regNo(regNo.Length + 1)
k += 1
regStudentID(k) = New ArrayList
regNo(k) = New ArrayList
regStudentID(k).Add(Integer.Parse(Integer.Parse(dgStudent.Items(i).Cells(8).Text)))
regNo(k).Add(dgStudent.Items(i).Cells(2).Text)
End If
lastRegNo = dgStudent.Items(i).Cells(2).Text
lastCourseRef = dgStudent.Items(i).Cells(0).Text
lastCourseDate = dgStudent.Items(i).Cells(4).Text
End If
Next
If rbFax.Checked Then
For j = 0 To k
If moreThanOne Then
objHtml = objHtml + ""
End If
objHtml = objHtml + myReportGen.GenConfirmReminder(CType(regNo(j)(0), String), _
regStudentID(j), ddlType.SelectedValue, True, rtxt.GetHTMLText)(0)
If ddlType.SelectedValue = "CONFIRM" Then
myStudentAdmin.UpdateRegStudentConfirmLetter(regStudentID(j), Now.ToUniversalTime.AddHours(8).ToString)
ElseIf ddlType.SelectedValue = "REMIND" Then
myStudentAdmin.UpdateRegStudentRemindLetter(regStudentID(j), Now.ToUniversalTime.AddHours(8).ToString)
End If
moreThanOne = True
Next
Response.Output.Write(objHtml + "