Ändeurngen und funktionieren aber Error in connectionstring bei verbindung zu datenbank

This commit is contained in:
ja
2021-11-03 11:14:31 +01:00
parent 7b461cf797
commit b4006aa491
6 changed files with 270 additions and 15 deletions

View File

@@ -11,4 +11,5 @@ Public Class VERAG_VARIABLES
Shared Function geterrornumb() As String
Return "Error:" + Space(1) + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(errornumb.ToString)
End Function
End Class

View File

@@ -108,7 +108,7 @@
<asp:RegularExpressionValidator ControlToValidate="txt_LKW" runat="server" ID="regex_txt_LKW" ValidationExpression="[A-Z0-9]{4,30}\d" Display="Dynamic" ErrorMessage="Wrong Plate-Format!" SetFocusOnError="true"></asp:RegularExpressionValidator>
<asp:TextBox ID="txt_KdNrAuftrag" runat="server" PlaceHolder="Customer Order Nr" style="width:145px;margin-left:16px"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txt_KdNrAuftrag" runat="server" Display="Dynamic" ID="reqval_txt_KdNrAuftrag" Enabled="false"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ControlToValidate="txt_KdNrAuftrag" runat="server" Display="Dynamic" ValidationExpression="[0-9]{2,8}" ErrorMessage="Wrong Input!"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator ControlToValidate="txt_KdNrAuftrag" ID="regex_txt_KdNrAuftrag" Enabled="false" runat="server" Display="Dynamic" ValidationExpression="[0-9]{2,8}" ErrorMessage="Wrong Input!"></asp:RegularExpressionValidator>
</div>
<div id="rowcol2" class="row-cols-1">
<asp:TextBox ID="txt_Absender" runat="server" PlaceHolder="Sender" style="width:145px;"></asp:TextBox>
@@ -134,7 +134,7 @@
<asp:RegularExpressionValidator ControlToValidate="txt_LKW_M" runat="server" ID="regex_txt_LKW_M" ValidationExpression="[A-Z0-9]{4,30}\d" Display="Dynamic" ErrorMessage="Wrong plate format!" SetFocusOnError="true" Enabled="false"></asp:RegularExpressionValidator>
<asp:TextBox ID="txt_KdNrAuftrag_M" runat="server" PlaceHolder="Customer Order Nr" style="width:155px;margin-left:13px"></asp:TextBox>
<asp:RequiredFieldValidator ControlToValidate="txt_KdNrAuftrag_M" runat="server" Enabled="false" ID="reqval_txt_KdNrAuftrag_M"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator runat="server" ControlToValidate="txt_KdNrAuftrag_M" Display="Dynamic" ValidationExpression="[A-Z0-9]{5,30}/d" Enabled="false" ErrorMessage="No valid input found!"></asp:RegularExpressionValidator>
<asp:RegularExpressionValidator runat="server" ID="regex_txt_KdNrAuftrag_M" ControlToValidate="txt_KdNrAuftrag_M" Display="Dynamic" ValidationExpression="[A-Z0-9]{5,30}/d" Enabled="false" ErrorMessage="No valid input found!"></asp:RegularExpressionValidator>
</div>
<div id="rowcols5" class="row-cols-1" style="margin-right:/*1.52px;*/0.33480176211453744vw;">
<asp:TextBox ID="txt_Absender_M" runat="server" PlaceHolder="Sender" style="width:155px;margin-left:18px"></asp:TextBox>

View File

@@ -12,7 +12,7 @@ Partial Class Customers_Default3
Dim LKWNR As String = ""
Dim KDNAFNR As String = ""
Dim dt As List(Of VERAG_PROG_ALLGEMEIN.cRechnungsausgang)
Dim reNr As String = ""
Dim reNr As String = "-1"
Dim provider As CultureInfo = CultureInfo.InvariantCulture
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
@@ -136,6 +136,11 @@ Partial Class Customers_Default3
Protected Sub btn_b_Click(sender As Object, e As EventArgs)
dt = Nothing
Try
Kdnrtext = Session.Item("CustomerID")
Catch ex As UnauthorizedAccessException When String.IsNullOrEmpty(Session.Item("CustomerID"))
lbl_status.Text = "Dieser Bereich ist nicht gestattet! Ein Fehler ist bei der Validierung der ID aufgetreten! Bitte erneut versuchen!"
End Try
If valdaterage_1.IsValid And valdaterange_2.IsValid Then
If String.IsNullOrEmpty(Kdnrtext) = False Then
If Not String.IsNullOrEmpty(txt_Absender.Text) Then
@@ -146,18 +151,263 @@ Partial Class Customers_Default3
If regex_txt_Absender.IsValid = True Then
Absender = txt_Absender.Text
Else
VERAG_VARIABLES.seterrorcount()
lbl_status.Text = VERAG_VARIABLES.geterrornumb + ": Fehler bei der Zuweisung"
VERAG_VARIABLES.seterrorcount(1)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + ": Error with the Sender"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount()
lbl_status.Text = VERAG_VARIABLES.geterrornumb + ": "
VERAG_VARIABLES.seterrorcount(2)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + ": Error Sender Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_Empfaenger.Text) = True Then
txt_Empfaenger.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_Empfaenger.Enabled = True
regex_txt_Empfaenger.Validate()
Try
If regex_txt_Empfaenger.IsValid = True Then
Empfaenger = txt_Empfaenger.Text
Else
VERAG_VARIABLES.seterrorcount(3)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error with the Reciever"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(4)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error Reciever Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_KdNrAuftrag.Text) = True Then
txt_KdNrAuftrag.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_KdNrAuftrag.Enabled = True
regex_txt_KdNrAuftrag.Validate()
Try
If regex_txt_KdNrAuftrag.IsValid = True Then
KDNAFNR = txt_KdNrAuftrag.Text
Else
VERAG_VARIABLES.seterrorcount(5)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error with the Customer Order number validation"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(11)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error Customer Order number Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_LKW.Text) = True Then
txt_LKW.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_LKW.Enabled = True
regex_txt_LKW.Validate()
Try
If regex_txt_LKW.IsValid = True Then
LKWNR = txt_LKW.Text
Else
VERAG_VARIABLES.seterrorcount(6)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error at Validation in LKW number plate field"
End If
Catch Ex As Exception
VERAG_VARIABLES.seterrorcount(12)
lbl_status.Text = VERAG_VARIABLES.geterrornumb() + "Error LKW Number plate Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_ReNr.Text) = True Then
txt_ReNr.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_ReNr.Enabled = True
regex_txt_ReNr.Validate()
Try
If regex_txt_ReNr.IsValid = True Then
reNr = txt_ReNr.Text
Else
reNr = "-1"
VERAG_VARIABLES.seterrorcount(7)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error at the Validation in the invoice number field"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(13)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error invoice number validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_Absender_M.Text) = True Then
txt_Absender_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_Absender_M.Enabled = True
regex_txt_Absender_M.Validate()
Try
If regex_txt_Absender_M.IsValid = True Then
Absender = txt_Absender_M.Text
Else
VERAG_VARIABLES.seterrorcount(1)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + ": Error with the Sender"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(2)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + ": Error Sender Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_Empfaenger_M.Text) = True Then
txt_Empfaenger_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_Empaenger_M.Enabled = True
regex_txt_Empaenger_M.Validate()
Try
If regex_txt_Empaenger_M.IsValid = True Then
Empfaenger = txt_Empfaenger_M.Text
Else
VERAG_VARIABLES.seterrorcount(3)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error with the Reciever"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(4)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error Reciever Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_KdNrAuftrag_M.Text) = True Then
txt_KdNrAuftrag_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_KdNrAuftrag_M.Enabled = True
regex_txt_KdNrAuftrag_M.Validate()
Try
If regex_txt_KdNrAuftrag_M.IsValid = True Then
KDNAFNR = txt_KdNrAuftrag_M.Text
Else
VERAG_VARIABLES.seterrorcount(5)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error with the Customer Order number validation"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(11)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error Customer Order number Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_LKW_M.Text) Then
txt_LKW_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_LKW_M.Enabled = True
regex_txt_LKW_M.Validate()
Try
If regex_txt_LKW_M.IsValid = True Then
LKWNR = txt_LKW_M.Text
Else
VERAG_VARIABLES.seterrorcount(6)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error at Validation in LKW number plate field"
End If
Catch Ex As Exception
VERAG_VARIABLES.seterrorcount(12)
lbl_status.Text = VERAG_VARIABLES.geterrornumb() + "Error LKW Number plate Validation"
End Try
End If
If Not String.IsNullOrEmpty(txt_ReNr_M.Text) Then
txt_ReNr_M.ValidateRequestMode = UI.ValidateRequestMode.Enabled
regex_txt_ReNr_M.Enabled = True
regex_txt_ReNr_M.Validate()
Try
If regex_txt_ReNr_M.IsValid = True Then
reNr = txt_ReNr_M.Text
Else
reNr = "-1"
VERAG_VARIABLES.seterrorcount(7)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error at the Validation in the invoice number field"
End If
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(13)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error invoice number validation"
End Try
End If
If pickdate1.Text = Nothing Or pickdate2.Text = Nothing Then
Try
Dim erster = New Date(Now().Year, Now.Month, 1)
datevon = erster
datebis = Date.Parse(Now.ToShortDateString)
pickdate1.Text = datevon.ToShortDateString
pickdate2.Text = datebis.ToShortDateString
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(14)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error in date time conversions"
End Try
Else
Try
datevon = Date.Parse(pickdate1.Text)
datebis = Date.Parse(pickdate2.Text)
Catch ex As Exception
VERAG_VARIABLES.seterrorcount(14)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error in date time conversions"
End Try
End If
If String.IsNullOrEmpty(Kdnrtext) = False And String.IsNullOrEmpty(datevon.ToShortDateString) = False AndAlso String.IsNullOrEmpty(datebis.ToShortDateString) = False Then
dt = VERAG_PROG_ALLGEMEIN.cRechnungsausgang.GET_LIST_WEB(Integer.Parse(Kdnrtext), datevon, datebis, Integer.Parse(reNr), Absender, Empfaenger, LKWNR, KDNAFNR)
Else
valreq_pickdate1.Validate()
valreq_pickdate2.Validate()
If valreq_pickdate1.IsValid AndAlso valreq_pickdate2.IsValid Then
VERAG_VARIABLES.seterrorcount(15)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error in form validation. Please fill in all fields"
End If
End If
If dt IsNot Nothing AndAlso Not dt.Count = 0 Then
Dim i As Integer = 0
For Each d In dt
Dim tr As TableRow = New TableRow
Dim Cell As TableCell = New TableCell
Dim tbl_Cell_Index As TableCell = New TableCell
Dim tbl_Cell_ReNr As TableCell = New TableCell
Dim tbl_Cell_Auftragsdat As TableCell = New TableCell
Dim tbl_Cell_Absender As TableCell = New TableCell
Dim tbl_Cell_Empfaenger As TableCell = New TableCell
Dim tbl_Cell_LKWs As TableCell = New TableCell
Dim tbl_Cell_KundAuftrNr As TableCell = New TableCell
Dim tbl_Cell_Info As TableCell = New TableCell
Dim zahl = i + 1
tbl_Cell_Index.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_Index.Text = zahl.ToString
tr.Cells.Add(tbl_Cell_Index)
tbl_Cell_ReNr.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_ReNr.Text = d.RechnungsNr.ToString
tr.Cells.Add(tbl_Cell_ReNr)
tbl_Cell_LKWs.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_LKWs.Text = d.LKW_Kennzeichen.ToString
tr.Cells.Add(tbl_Cell_LKWs)
tbl_Cell_Auftragsdat.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_Auftragsdat.Text = d.RechnungsDatum.ToString
tr.Cells.Add(tbl_Cell_Auftragsdat)
tbl_Cell_KundAuftrNr.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_KundAuftrNr.Text = d.KdAuftragsNr.ToString
tr.Cells.Add(tbl_Cell_KundAuftrNr)
tbl_Cell_Absender.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_Absender.Text = d.AbsenderName_1.ToString
tr.Cells.Add(tbl_Cell_Absender)
tbl_Cell_Empfaenger.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_Empfaenger.Text = d.EmpfängerName_1.ToString
tr.Cells.Add(tbl_Cell_Empfaenger)
Dim btn As New ImageButton
btn.ViewStateMode = ViewStateMode.Enabled
btn.CssClass = "btn btn-primary"
btn.ImageUrl = "../images/pdficon.gif"
btn.Attributes.Add("href", "pdfviewer.aspx?P1=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.FilialenNr).ToString() + "&P2=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.AbfertigungsNr).ToString + "&P3=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.RK_ID).ToString)
btn.Attributes.Add("target", "_blank")
btn.PostBackUrl = "pdfviewer.aspx?P1=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.FilialenNr).ToString + "&P2=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.AbfertigungsNr).ToString + "&P3=" + VERAG_PROG_ALLGEMEIN.cCryptography3.Encrypt(d.RK_ID).ToString
tbl_Cell_Info.ValidateRequestMode = UI.ValidateRequestMode.Enabled
tbl_Cell_Info.Controls.Add(btn)
tr.Cells.Add(tbl_Cell_Info)
initcells(tr, tbl_Cell_Index, tbl_Cell_ReNr, tbl_Cell_LKWs, tbl_Cell_Auftragsdat, tbl_Cell_KundAuftrNr, tbl_Cell_Absender, tbl_Cell_Empfaenger, tbl_Cell_Info,
tbl_HeaderCellIndex, tbl_HeaderCell_ReNr, tbl_HeaderCell_LKWNr, tbl_HeaderCell_Auftragsdatum, tbl_HeaderCell_KundenAuftrNummer, tbl_HeaderCell_Absender, tbl_HeaderCell_Empfaenger, tbl_HeaderCell_Info)
normaltable.Rows.Add(tr)
i += 1
Next
Else
Dim tbl_cellNothing = New TableCell()
tbl_cellNothing.ColumnSpan = tbl_Header_row.Cells.Count
tbl_cellNothing.Style.Add("text-align", "center")
Dim tr As New TableRow
tr.Style.Add("text-align", "center")
tbl_cellNothing.Text = Server.HtmlEncode("Keine Daten gefunden!")
tr.Cells.Add(tbl_cellNothing)
normaltable.Rows.Add(tr)
End If
Else
VERAG_VARIABLES.seterrorcount(16)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "Error in getting Customer-ID from login"
End If
Else
lbl_status.Text = "The time chosen is newer then today or older than april 2001. Please correct."
Else
VERAG_VARIABLES.seterrorcount(8)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "The time chosen is newer then today or older than april 2001. Please correct"
End If
MsgBox("Test")
End Sub
@@ -188,14 +438,16 @@ Partial Class Customers_Default3
Protected Sub valdaterage_1_ServerValidate(source As Object, args As ServerValidateEventArgs)
If Date.Parse(pickdate1.Text) < Date.ParseExact("01.04.2001", "dd.MM.yyyy", provider) Then
lbl_status.Text = "Der zeitpunkt " + pickdate1.Text + "zu weit zurückliegend."
VERAG_VARIABLES.seterrorcount(9)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "The chosen time " + pickdate1.Text + " is too early"
End If
End Sub
Protected Sub valdaterange_2_ServerValidate(source As Object, args As ServerValidateEventArgs)
If Date.Parse(pickdate2.Text) > Date.ParseExact(Date.Now.ToShortDateString, "dd.MM.yyyy", provider) Then
lbl_status.Text = "Der Zeitpunkt " + pickdate2.Text + " ist zu weit in der Zukunft."
VERAG_VARIABLES.seterrorcount(10)
lbl_status.Text = VERAG_VARIABLES.geterrornumb + "The chosen time " + pickdate2.Text + " is too far in the future"
End If
End Sub
End Class

Binary file not shown.

View File

@@ -30,7 +30,7 @@
void Session_Start(object sender, EventArgs e)
{
// Code, der ausgeführt wird, wenn eine neue Sitzung gestartet wird
VERAG_VARIABLES.initerrorcount()
VERAG_VARIABLES.initerrorcount();
}
void Session_End(object sender, EventArgs e)
@@ -39,7 +39,7 @@
// Hinweis: Das Ereignis "Session_End" wird nur ausgelöst, wenn der Modus "sessionstate"
// in der Datei "Web.config" auf "InProc" festgelegt ist. Wenn der Sitzungsmodus auf "StateServer"
// oder "SQLServer" festgelegt ist, wird das Ereignis nicht ausgelöst.
Session.Remove("TokenforEmail");

View File

@@ -162,12 +162,14 @@ Partial Class login_FLEX
If tb2.Text = dr("Username") Then
UserNaMe = dr("Username").ToString
Else
Login1.FailureText = "Username is not in the database!"
VERAG_VARIABLES.seterrorcount(8)
Login1.FailureText = VERAG_VARIABLES.geterrornumb + "Username is not in the database!"
End If
If tb3.Text = dr("Password") Then
passw = VERAG_PROG_ALLGEMEIN.cCryptography.Encrypt(dr("Password").ToString)
Else
Login1.FailureText = "Password is not in the database!"
VERAG_VARIABLES.seterrorcount(9)
Login1.FailureText = VERAG_VARIABLES.geterrornumb + "Password is not in the database!"
End If
MsgBox("Erfolgreich validiert.")