1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
| Partial Class _Default
Inherits System.Web.UI.Page
Public Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As EventArgs)
' Determine the checkbox values.
'Dim subscribeCheckBox As CheckBox = _
' CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("SubscribeCheckBox"), CheckBox)
'Dim shareInfoCheckBox As CheckBox = _
' CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("ShareInfoCheckBox"), CheckBox)
Dim F_UserName As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("UserName"), TextBox)
Dim F_Email As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Email"), TextBox)
Dim F_Question As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Question"), TextBox)
Dim F_Answer As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Answer"), TextBox)
Dim F_Password As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Password"), TextBox)
Dim F_Name As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Name"), TextBox)
Dim F_Vorname As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Vorname"), TextBox)
Dim F_Geschlecht As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Geschlecht"), TextBox)
Dim F_Datum As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Datum"), TextBox)
Dim F_Jahrgang As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Jahrgang"), TextBox)
Dim F_Studiengang As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Studiengang"), TextBox)
Dim F_Kontingent As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Kontingent"), TextBox)
Dim IsCreated As MembershipCreateStatus
'Dim user As MembershipUser = Membership.GetUser(userNameTextBox.Text)
'User.Comment = "Subscribe=" & subscribeCheckBox.Checked.ToString() & "&" & _
' "ShareInfo=" & shareInfoCheckBox.Checked.ToString()
Membership.CreateUser(F_UserName.Text, F_Password.Text, F_Email.Text, F_Question.Text, F_Answer.Text, True, IsCreated)
Dim user As MembershipUser = Membership.GetUser(F_UserName.Text)
Membership.UpdateUser(user)
' Das Geschlecht und Kontingent in boolean konvertieren
Dim F_Geschlecht2 As Boolean
Dim F_Kontingent2 As Boolean
If F_Geschlecht.Text = "Maennlich" Then
F_Geschlecht2 = False
Else
F_Geschlecht2 = True
End If
If F_Kontingent.Text = "Metz" Then
F_Kontingent2 = False
Else
F_Kontingent2 = True
End If
' Das Schluessel vom dem neuen User nehmen
Dim key As New System.Guid
key = Membership.GetUser(F_UserName.Text).ProviderUserKey
' Dann die Tabelle aspnet_custom_Student einfuellen
Dim ds As New DataSet1TableAdapters.aspnet_custom_StudentTableAdapter
'ds.InsertStudent(key, F_Name.Text, F_Vorname.Text, F_Geschlecht2, F_Datum.Text, F_Jahrgang.Text, F_Studiengang.Text, F_Kontingent2)
' Show or hide the labels based on the checkbox values.
'Dim subscribeLabel As Label = _
' CType(CreateUserWizard1.CompleteStep.ContentTemplateContainer.FindControl("SubscribeLabel"), Label)
'Dim shareInfoLabel As Label = _
' CType(CreateUserWizard1.CompleteStep.ContentTemplateContainer.FindControl("ShareInfoLabel"), Label)
'subscribeLabel.Visible = subscribeCheckBox.Checked
'shareInfoLabel.Visible = shareInfoCheckBox.Checked
'ds.Insert(
'Membership.GetUser(True).ProviderUserKey.ToString()
End Sub
Private Function UserExists(ByVal username As String) As Boolean
If Membership.GetUser(username) IsNot Nothing Then Return True
Return False
End Function
Protected Sub CreateUserWizard1_NextButtonClick(ByVal sender As Object, ByVal e As WizardNavigationEventArgs)
'Dim TB_Login As TextBox = _
'CType(CreateUserWizardStep0.ContentTemplateContainer.FindControl("UserName"), TextBox)
'Dim SearchAccountMessage As Label = _
'CType(CreateUserWizardStep0.ContentTemplateContainer.FindControl("SearchAccountMessage"), Label)
'Fuer die Ueberpruefung der Daten
If e.CurrentStepIndex = 2 Then
'Man nimmt die gebrauchte TextBox
Dim TB_Name As TextBox = _
CType(CreateUserWizardStep0.FindControl("TB_Name"), TextBox)
Dim TB_Vorname As TextBox = _
CType(CreateUserWizardStep0.FindControl("TB_Vorname"), TextBox)
Dim CB_Geschlecht As CheckBox = _
CType(CreateUserWizardStep0.FindControl("CB_Geschlecht_M"), CheckBox)
Dim TB_Datum As TextBox = _
CType(CreateUserWizardStep0.FindControl("TB_Datum"), TextBox)
Dim TB_Jahrgang As TextBox = _
CType(CreateUserWizardStep0.FindControl("TB_Jahrgang"), TextBox)
Dim LB_Studiengang As ListBox = _
CType(CreateUserWizardStep0.FindControl("LB_Studiengang"), ListBox)
Dim CB_Kontingent As CheckBox = _
CType(CreateUserWizardStep0.FindControl("CB_Kontingent_M"), CheckBox)
Dim TB_Login As TextBox = _
CType(CreateUserWizardStep1.FindControl("TB_Login"), TextBox)
Dim TB_Email As TextBox = _
CType(CreateUserWizardStep1.FindControl("TB_Email"), TextBox)
Dim TB_Question As TextBox = _
CType(CreateUserWizardStep1.FindControl("TB_Question"), TextBox)
Dim TB_Answer As TextBox = _
CType(CreateUserWizardStep1.FindControl("TB_Answer"), TextBox)
Dim TB_Password As TextBox = _
CType(CreateUserWizardStep1.FindControl("TB_Password"), TextBox)
Dim F_UserName As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("UserName"), TextBox)
Dim F_Email As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Email"), TextBox)
Dim F_Question As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Question"), TextBox)
Dim F_Answer As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Answer"), TextBox)
Dim F_Password As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Password"), TextBox)
Dim F_Name As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Name"), TextBox)
Dim F_Vorname As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Vorname"), TextBox)
Dim F_Geschlecht As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Geschlecht"), TextBox)
Dim F_Datum As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Datum"), TextBox)
Dim F_Jahrgang As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Jahrgang"), TextBox)
Dim F_Studiengang As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Studiengang"), TextBox)
Dim F_Kontingent As TextBox = _
CType(CreateUserWizardStep3.ContentTemplateContainer.FindControl("Kontingent"), TextBox)
'Man gibt die Werte der TextBox zu den neuen TextBox
F_UserName.Text = TB_Login.Text
F_Email.Text = TB_Email.Text
F_Question.Text = TB_Question.Text
F_Answer.Text = TB_Answer.Text
F_Password.Text = TB_Password.Text
F_Name.Text = TB_Name.Text
F_Vorname.Text = TB_Vorname.Text
F_Datum.Text = TB_Datum.Text
F_Jahrgang.Text = TB_Jahrgang.Text
F_Studiengang.Text = LB_Studiengang.SelectedItem.Value
If CB_Geschlecht.Checked Then
F_Geschlecht.Text = "Maennlich"
Else
F_Geschlecht.Text = "Weiblich"
End If
If CB_Kontingent.Checked Then
F_Kontingent.Text = "Metz"
Else
F_Kontingent.Text = "Saarbruecken"
End If
End If
'If e.CurrentStepIndex = 4 Then
'CreateUserWizard1_CreatedUser(sender, e)
'End If
'If e.CurrentStepIndex = 0 Then
'If TB_Login.Text.Trim() = "" Then
'SearchAccountMessage.Text = "Ihre Login darf nicht leer sein."
'e.Cancel = True
'ElseIf UserExists(TB_Login.Text) Then
'SearchAccountMessage.Text = "Diese Login ist schon benutzt. Bitte auswählen Sie ein andere Login."
'e.Cancel = True
'Else
' Dim userName As TextBox = _
'CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName"), TextBox)
'userName.Text = TB_Login.Text
'SearchAccountMessage.Text = ""
e.Cancel = False
'End If
'End If
End Sub
End Class |
Partager