Public Class estudent
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsNothing(Session("strCustomerID")) Then
Response.Redirect("index.aspx")
Response.End()
End If
Dim cls As New clsGetCustomer.getCustomer
Dim myArr As Array = cls.resultCustomer(Session("strCustomerID"))
If myArr.Length > 0 Then
Me.lblCustomerID.Text = DataBinder.Eval(myArr(0), "username").ToString()
Session("department") = Me.lblCustomerID.Text
End If
Dim iIndex As Integer
Dim strJobCode() As String
Dim sb As StringBuilder = New StringBuilder
Dim strGet As String = Request.QueryString("stid")
If strGet <> Nothing Then
strJobCode = strGet.Split(",")
For iIndex = 0 To strJobCode.Length - 1
sb.Append(strJobCode(iIndex) & "<br>")
Session("stid") = sb.ToString
Next
'Response.Write(sb.ToString)
End If
Dim cls2 As New clsStid.getCustomer
Dim myArr2 As Array = cls2.resultStid(Session("stid"))
If myArr2.Length > 0 Then
Me.lblStid.Text = DataBinder.Eval(myArr2(0), "stid").ToString()
Me.txtNaid.Text = DataBinder.Eval(myArr2(0), "stidp").ToString()
Me.txtName.Text = DataBinder.Eval(myArr2(0), "stname").ToString()
Me.txtSur.Text = DataBinder.Eval(myArr2(0), "stsurname").ToString()
Me.lblDep.Text = DataBinder.Eval(myArr2(0), "stdep").ToString()
Me.txtAdd.Text = DataBinder.Eval(myArr2(0), "stadd").ToString()
Me.txtTel.Text = DataBinder.Eval(myArr2(0), "sttel").ToString()
Me.txtMail.Text = DataBinder.Eval(myArr2(0), "stmail").ToString()
Me.txtTa.Text = DataBinder.Eval(myArr2(0), "stta").ToString()
End If
End Sub
Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnSave.Click
Dim cls As New clsUpst.UpdateCustomer()
Dim myArr As Array = cls.saveUpdateStudent(Session("stid"), _
Me.txtNaid.Text, _
Me.txtName.Text, _
Me.txtSur.Text, _
Me.lblDep.Text, _
Me.txtAdd.Text, _
Me.txtTel.Text, _
Me.txtMail.Text, _
Me.txtTa.Text)
If CStr(myArr(0)) = "1" Then
Me.ClientScript.RegisterStartupScript(Me.GetType(), "myalert", "alert('Update Successfully ');window.location='student.aspx';", True)
Else
Me.ClientScript.RegisterStartupScript(Me.GetType(), "myalert", "alert('Update Failed error..." & Replace(myArr(1), "'", "\'") & "');", True)
End If
End Sub
End Class