Fixen des Ablaufs. Alle true false werte werden nun richtig gesetzt bzw genauer überprüft.

This commit is contained in:
ja
2021-10-20 16:54:37 +02:00
parent 9321d027d5
commit ce25d42522

View File

@@ -49,64 +49,47 @@ Partial Class ForgotPW
CustomerIDrequired.Enabled = True CustomerIDrequired.Enabled = True
valid_getNumberInput.Enabled = True valid_getNumberInput.Enabled = True
valreqtxtEmail.Validate()
If valreqtxtEmail.IsValid = True Then
Boolemail_desktop_notempty = True
Boolemail_mobile_notempty = False
If Boolemail_desktop_notempty = True Then
regexval_txt_Email.Validate()
If regexval_txt_Email.IsValid = True Then
Boolemail_desktop_regexdomain = True
Boolemail_mobile_regexdomain = False
End If
regexval_txt_Email_2.Validate()
If regexval_txt_Email_2.IsValid = True Then
Boolemail_desktop_regex = True
Boolemail_mobile_regex = False
End If
If Boolemail_desktop_notempty = True AndAlso Boolemail_desktop_regexdomain = True AndAlso Boolemail_desktop_regex = True Then
email = txtEmail.Text
Else
regexval_txt_Email.IsValid = True
Boolemail_desktop_regex = True
Boolemail_mobile_regex = False
If Boolemail_desktop_regexdomain = True Then
email = txtEmail.Text
End If
End If
ElseIf valreqtxtEmail.IsValid = False Then
Boolemail_desktop_regexdomain = False
valreqtxtEmail.ErrorMessage = "Annotation: The given Domain is not the company domain."
regexval_txt_Email.Validate()
Boolemail_desktop_regex = True
If Boolemail_desktop_regex = True AndAlso Boolemail_desktop_regexdomain = False Then
regexval_txt_Email_2.IsValid = True
email = txtEmail.Text
End If
End If
End If
valreqtxtusername.Validate() valreqtxtusername.Validate()
If valreqtxtusername.IsValid = True Then If valreqtxtusername.IsValid = True Then
Booluser_desktop_notempty = True
Booluser_mobile_notempty = False
check_UserName_regex.Validate() check_UserName_regex.Validate()
If check_UserName_regex.IsValid = False Then If check_UserName_regex.IsValid = False Then
check_UserName_regex.ErrorMessage = "Annotation: The Username does not match the requirements." check_UserName_regex.ForeColor = Drawing.Color.Red
check_UserName_regex.ErrorMessage = "The Username is too long."
Else Else
Booluser_desktop_regex = True
Booluser_mobile_regex = False
check_UserName_regex.Validate()
If check_UserName_regex.IsValid = True AndAlso Boolemail_desktop_notempty = True AndAlso Booluser_desktop_regex = True And Booluser_desktop_notempty = True AndAlso Booluser_mobile_regex = False Then
username = txt_Username.Text username = txt_Username.Text
check_UserName_regex.ForeColor = Drawing.Color.Lime
check_UserName_regex.ErrorMessage = "Valid Username has been entered."
End If
Else
check_UserName_regex.ForeColor = Drawing.Color.Lime
check_UserName_regex.ErrorMessage = "A too long Username has been entered."
End If
valreqtxtEmail.Validate()
If valreqtxtEmail.IsValid = True Then
regexval_txt_Email.Validate()
If regexval_txt_Email.IsValid = False Then
regexval_txt_Email.ForeColor = Drawing.Color.OrangeRed
regexval_txt_Email.ErrorMessage = "Annotation: The Domain does not match."
regexval_txt_Email_2.Validate()
If regexval_txt_Email_2.IsValid = True Then
email = txtEmail.Text
regexval_txt_Email.ForeColor = Drawing.Color.Lime
regexval_txt_Email.ErrorMessage = "E-mail Address valid."
End If
Else
regexval_txt_Email.Validate()
If valreqtxtEmail.IsValid = True Then
valreqtxtEmail.ForeColor = Drawing.Color.Lime
valreqtxtEmail.ErrorMessage = "E-mail Address valid."
email = txtEmail.Text
End If End If
End If End If
End If End If
CustomerIDrequired.Validate() CustomerIDrequired.Validate()
If CustomerIDrequired.IsValid = True Then If CustomerIDrequired.IsValid = True Then
valid_getNumberInput.Validate() valid_getNumber_M_Input.Validate()
If valid_getNumberInput.IsValid = True Then If valid_getNumberInput.IsValid = True Then
customerID = txt_CustomerID.Text customerID = txt_CustomerID.Text
Else Else
@@ -138,16 +121,21 @@ Partial Class ForgotPW
valreqtxtEmail_M.Validate() valreqtxtEmail_M.Validate()
If valreqtxtEmail_M.IsValid = True Then If valreqtxtEmail_M.IsValid = True Then
regexval_txt_Email_M.Validate() regexval_txt_Email.Validate()
If regexval_txt_Email_M.IsValid = False Then If regexval_txt_Email.IsValid = False Then
regexval_txt_Email_M.ErrorMessage = "Annotation: The Domain does not match." regexval_txt_Email.ForeColor = Drawing.Color.OrangeRed
regexval_txt_Email.ErrorMessage = "Annotation: The Domain does not match."
regexval_txt_Email.Validate() regexval_txt_Email.Validate()
If regexval_2_txt_Email_M.IsValid = True Then If regexval_2_txt_Email_M.IsValid = True Then
email = txtEmail_M.Text email = txtEmail_M.Text
regexval_txt_Email.ForeColor = Drawing.Color.Lime
regexval_txt_Email.ErrorMessage = "E-mail Address valid."
End If End If
Else Else
regexval_txt_Email.Validate() regexval_txt_Email.Validate()
If regexval_2_txt_Email_M.IsValid = True Then If regexval_2_txt_Email_M.IsValid = True Then
regexval_txt_Email.ForeColor = Drawing.Color.Lime
regexval_txt_Email.ErrorMessage = "E-mail Address valid."
email = txtEmail_M.Text email = txtEmail_M.Text
End If End If
End If End If
@@ -157,7 +145,7 @@ Partial Class ForgotPW
If CustomerID_M_required.IsValid = True Then If CustomerID_M_required.IsValid = True Then
valid_getNumber_M_Input.Validate() valid_getNumber_M_Input.Validate()
If valid_getNumber_M_Input.IsValid = True Then If valid_getNumber_M_Input.IsValid = True Then
customerID = txt_CustomerID.Text customerID = txt_CustomerID_M.Text
Else Else
valid_getNumber_M_Input.ForeColor = Drawing.Color.Red valid_getNumber_M_Input.ForeColor = Drawing.Color.Red
valid_getNumber_M_Input.ErrorMessage = "Customer-ID is not numeric or too long." valid_getNumber_M_Input.ErrorMessage = "Customer-ID is not numeric or too long."
@@ -166,10 +154,26 @@ Partial Class ForgotPW
valid_getNumber_M_Input.ForeColor = Drawing.Color.Red valid_getNumber_M_Input.ForeColor = Drawing.Color.Red
valid_getNumber_M_Input.ErrorMessage = "Customer-ID is not given." valid_getNumber_M_Input.ErrorMessage = "Customer-ID is not given."
End If End If
valreqtxtusername_M.Validate()
If valreqtxtusername_M.IsValid = True Then
check_UserName_regex_M.Validate()
If check_UserName_regex_M.IsValid = False Then
check_UserName_regex_M.ForeColor = Drawing.Color.Red
check_UserName_regex_M.ErrorMessage = "The Username is too long."
Else
username = txt_Username_M.Text
check_UserName_regex_M.ForeColor = Drawing.Color.Lime
check_UserName_regex_M.ErrorMessage = "Valid Username has been entered."
End If
Else
check_UserName_regex_M.ForeColor = Drawing.Color.Lime
check_UserName_regex_M.ErrorMessage = "A too long Username has been entered."
End If
Else Else
'MsgBox("The form has not been filled completeley.", MsgBoxStyle.Critical, "Error08") 'MsgBox("The form has not been filled completeley.", MsgBoxStyle.Critical, "Error08")
lblMessage.ForeColor = Color.Red lblMessage.ForeColor = Color.Red
lblMessage.Text = "The form has not been filled completeley." lblMessage.Text = "Error 08. The form has not been filled completeley."
End If End If
'Erweiterte Degub Msg-Box 'Erweiterte Degub Msg-Box
@@ -187,9 +191,11 @@ Partial Class ForgotPW
End If End If
Using con As New SqlConnection(ConnectionString) Using con As New SqlConnection(ConnectionString)
' Using cmd As New SqlCommand("Validate_User") ' Using cmd As New SqlCommand("Validate_User")
Using cmd As New SqlCommand("SELECT Username,Password,Email,KundenNr FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Email=@Email") Using cmd As New SqlCommand("SELECT Username,Password,Email,KundenNr FROM [VERAG_HOMEPAGE].[dbo].[Users] WHERE Username=@Username AND Email=@Email AND KundenNr=@CUSTOMERId")
' cmd.CommandType = CommandType.StoredProcedure ' cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Username", username) cmd.Parameters.AddWithValue("@Username", username)
cmd.Parameters.AddWithValue("@Email", email)
cmd.Parameters.AddWithValue("@CUSTOMERId", customerID)
cmd.Connection = con cmd.Connection = con
con.Open() con.Open()
'userId = Convert.ToInt32(cmd.ExecuteScalar()) 'userId = Convert.ToInt32(cmd.ExecuteScalar())