📄 register.aspx.vb
字号:
Public Class Register
Inherits System.Web.UI.Page
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button
Protected WithEvents txtFamilyName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtGivenName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtEmail As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPwd As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAdd1 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtAdd2 As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCity As System.Web.UI.WebControls.TextBox
Protected WithEvents txtState As System.Web.UI.WebControls.TextBox
Protected WithEvents txtZip As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCountry As System.Web.UI.WebControls.TextBox
Protected WithEvents Table1 As System.Web.UI.WebControls.Table
Protected WithEvents lblMsg As System.Web.UI.WebControls.Label
Protected WithEvents txtPwdConfirm As System.Web.UI.WebControls.TextBox
Protected WithEvents btnReset As System.Web.UI.HtmlControls.HtmlInputButton
Private Process As String
#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 Sub page_load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Tools.IsLoggedIn() Then
Process = "MODIFY"
Dim myPersonDetails As C2CSystem.PersonDetails = New C2CSystem.PersonDetails()
Dim obj As C2CSystem.Person = New C2CSystem.Person()
myPersonDetails = obj.GetPersonDetails(Request.Cookies("email").Value)
txtFamilyName.Text = myPersonDetails.FamilyName
txtGivenName.Text = myPersonDetails.GivenName
txtEmail.Text = Request.Cookies("email").Value
txtPwd.Text = myPersonDetails.Password
txtAdd1.Text = myPersonDetails.StreetAddress1
txtAdd2.Text = myPersonDetails.StreetAddress2
txtCity.Text = myPersonDetails.City
txtState.Text = myPersonDetails.State
txtZip.Text = myPersonDetails.PostalCode
txtCountry.Text = myPersonDetails.Country
txtEmail.Enabled = False
obj = Nothing
Else
Process = "ADD"
End If
End Sub
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
If Page.IsValid Then
Dim obj As C2CSystem.Person = New C2CSystem.Person
Dim strStatus As String
If Process = "ADD" Then
strStatus = obj.AddCustomer(txtFamilyName.Text, _
txtGivenName.Text, _
txtEmail.Text, _
txtPwd.Text, _
txtAdd1.Text, _
txtAdd2.Text, _
txtCity.Text, _
txtState.Text, _
txtZip.Text, _
txtCountry.Text)
If IsNumeric(strStatus) Then
Response.Cookies("GivenName").Value = txtGivenName.Text
Response.Cookies("email").Value = txtEmail.Text
Response.Cookies("personid").Value = strStatus
Response.Redirect("MenuForRegisteredUsers.Aspx")
ElseIf Len(strStatus) > 1 Then
lblMsg.Text = strStatus
End If
Else
' Code for Update goes here
strStatus = obj.ModifyCustomer(txtFamilyName.Text, _
txtGivenName.Text, _
txtEmail.Text, _
txtPwd.Text, _
txtAdd1.Text, _
txtAdd2.Text, _
txtCity.Text, _
txtState.Text, _
txtZip.Text, _
txtCountry.Text)
If strStatus = "1" Then
Response.Cookies("GivenName").Value = Request.Form("txtGivenName")
Response.Cookies("email").Value = txtEmail.Text
Response.Redirect("MenuForRegisteredUsers.Aspx")
ElseIf Len(strStatus) > 1 Then
lblMsg.Text = "Update Failed! " & strStatus
End If
End If
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -