Option Explicit On 
Option Strict On

Imports System.Data
Imports System.Data.SqlClient
Imports System.DateTime

Public MustInherit Class AlumniView
	Inherits System.Web.UI.UserControl
	Protected WithEvents lblError As System.Web.UI.WebControls.Label
	Protected WithEvents pnlViewCensus As System.Web.UI.WebControls.Panel
	Protected WithEvents lblLName As System.Web.UI.WebControls.Label
	Protected WithEvents lblMaidenName As System.Web.UI.WebControls.Label
	Protected WithEvents lblYrGraduate As System.Web.UI.WebControls.Label
	Protected WithEvents lblComments As System.Web.UI.WebControls.Label
	Protected WithEvents lblFName As System.Web.UI.WebControls.Label
	Protected WithEvents lblPhone As System.Web.UI.WebControls.Label
	Protected WithEvents lblEmail As System.Web.UI.WebControls.Label
	Protected WithEvents lblPAddress1 As System.Web.UI.WebControls.Label
	Protected WithEvents lblPCity As System.Web.UI.WebControls.Label
	Protected WithEvents lblPState As System.Web.UI.WebControls.Label
	Protected WithEvents lblPCountry As System.Web.UI.WebControls.Label
	Protected WithEvents lblPAddress2 As System.Web.UI.WebControls.Label
	Protected WithEvents lblCCity As System.Web.UI.WebControls.Label
	Protected WithEvents lblCState As System.Web.UI.WebControls.Label
	Protected WithEvents lblCCountry As System.Web.UI.WebControls.Label
	Protected WithEvents lblCAddress1 As System.Web.UI.WebControls.Label
	Protected WithEvents lblCAddress2 As System.Web.UI.WebControls.Label
	Protected WithEvents lblPZipcode As System.Web.UI.WebControls.Label
	Protected WithEvents lblCZipcode As System.Web.UI.WebControls.Label
	Dim _AlumniID As Integer

#Region " Web Form Designer Generated Code "

	'This call is required by the Web Form Designer.
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

	End Sub

	Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
		'CODEGEN: This method call is required by the Web Form Designer
		'Do not modify it using the code editor.
		InitializeComponent()
	End Sub

#End Region

	Public Property AlumniID() As Integer
		Get
			Return _AlumniID
		End Get
		Set(ByVal Value As Integer)
			_AlumniID = Value
		End Set
	End Property


	Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
		On Error Resume Next
		If _AlumniID <> 0 Then
			Dim cmd As New SqlCommand()
			Dim dr As SqlDataReader
			Dim conn As New SqlConnection(ConfigurationSettings.AppSettings("sConnection"))
			With cmd
				.CommandText = "Select * from as_AlumniForm where ID=" & _AlumniID
				.Connection = conn
				.CommandType = CommandType.Text
				If conn.State = ConnectionState.Closed Then conn.Open()
				'Response.Write(.CommandText & vbCrLf)
				dr = .ExecuteReader()

				If Not dr.Read Then
					lblError.Text = "<BR><p align=center><span class=maintitle2><b>No alumni record data found !</b></span></p><BR>"
					lblError.Visible = True
					pnlViewCensus.Visible = False
					Exit Sub
				Else
					lblLName.Text = CStr(dr.Item("LastName"))
					lblFName.Text = CStr(dr.Item("FirstName"))
					lblMaidenName.Text = CStr(dr.Item("MaidenName"))
					lblYrGraduate.Text = CStr(dr.Item("YearGraduated"))

					lblPAddress1.Text = CStr(dr.Item("PermAddress1"))
					lblPAddress2.Text = CStr(dr.Item("PermAddress2"))
					lblPCity.Text = CStr(dr.Item("PermCity"))
					lblPState.Text = CStr(dr.Item("PermState"))
					lblPZipcode.Text = CStr(dr.Item("PermZipcode"))
					lblPCountry.Text = CStr(dr.Item("PermCountry"))

					lblCAddress1.Text = CStr(dr.Item("CurrentAddress1"))
					lblCAddress2.Text = CStr(dr.Item("CurrentAddress2"))
					lblCCity.Text = CStr(dr.Item("CurrentCity"))
					lblCState.Text = CStr(dr.Item("CurrentState"))
					lblCZipcode.Text = CStr(dr.Item("CurrentZipcode"))
					lblCCountry.Text = CStr(dr.Item("CurrentCountry"))

					lblPhone.Text = "(" & CStr(dr.Item("PhoneExt")) & ") " & CStr(dr.Item("PhoneNo"))
					lblEmail.Text = CStr(dr.Item("Email"))
					lblComments.Text = CStr(dr.Item("Comments"))
				End If
			End With
		End If
	End Sub
End Class
