Imports System.Data Imports System.Globalization Partial Class Customers_Default3 Inherits System.Web.UI.Page Dim datevon As DateTime Dim datebis As DateTime Dim Kdnrtext As String Dim Absender As String = "" Dim Empfaenger As String = "" Dim LKWNR As String = "" Dim KDNAFNR As String = "" Dim dt As List(Of VERAG_PROG_ALLGEMEIN.cRechnungsausgang) Dim reNr As String = "" Dim provider As CultureInfo = CultureInfo.InvariantCulture Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) If Not Me.Page.User.Identity.IsAuthenticated Then FormsAuthentication.RedirectToLoginPage() Else 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 DataBind() tbl_Header_row.TableSection = TableRowSection.TableHeader If (Page.IsPostBack And normaltable.EnableViewState = False) Then Page.MaintainScrollPositionOnPostBack = True normaltable.EnableViewState = True If valreq_pickdate1.IsValid And valreq_pickdate2.IsValid Then datevon = Date.Parse(pickdate1.Text) datebis = Date.Parse(pickdate2.Text) Else Dim erster = New Date(Now().Year, Now().Month, 1) datevon = erster datebis = Date.Parse(Now.ToShortDateString) pickdate1.Text = erster.ToShortDateString() pickdate2.Text = Date.Now.ToShortDateString() End If End If End If End Sub Protected Sub initcells(tr As TableRow, t1 As TableCell, t2 As TableCell, t3 As TableCell, t4 As TableCell, t5 As TableCell, t6 As TableCell, t7 As TableCell, t8 As TableCell, th1 As TableHeaderCell, th2 As TableHeaderCell, th3 As TableHeaderCell, th4 As TableHeaderCell, th5 As TableHeaderCell, th6 As TableHeaderCell, th7 As TableHeaderCell, th8 As TableHeaderCell) Dim white As Drawing.Color = Drawing.Color.White Dim schwarz As Drawing.Color = Drawing.Color.Black Dim darkgrau As Drawing.Color = Drawing.Color.DarkGray Dim veragblue As Drawing.Color = Drawing.Color.FromArgb(4, 51, 129) tr.BackColor = white If String.IsNullOrEmpty(t1.Text) Then t1.BackColor = white t1.ForeColor = schwarz Else t1.BackColor = white t1.ForeColor = veragblue End If If String.IsNullOrEmpty(t2.Text) Then t2.BackColor = white t2.ForeColor = schwarz Else t2.BackColor = white t2.ForeColor = veragblue End If If String.IsNullOrEmpty(t3.Text) Then t3.BackColor = white t3.ForeColor = schwarz Else t3.BackColor = white t3.ForeColor = veragblue End If If String.IsNullOrEmpty(t4.Text) Then t4.BackColor = white t4.ForeColor = schwarz Else t4.BackColor = white t4.ForeColor = veragblue End If If String.IsNullOrEmpty(t5.Text) Then t5.BackColor = white t5.ForeColor = schwarz Else t5.BackColor = white t5.ForeColor = veragblue End If If String.IsNullOrEmpty(t6.Text) Then t6.BackColor = white t6.ForeColor = schwarz Else t6.BackColor = white t6.ForeColor = veragblue End If If String.IsNullOrEmpty(t7.Text) Then t7.BackColor = white t7.ForeColor = schwarz Else t7.BackColor = white t7.ForeColor = veragblue End If If String.IsNullOrEmpty(t8.Text) Then t8.BackColor = white t8.BackColor = schwarz Else t8.BackColor = white t8.ForeColor = veragblue End If th1.Font.Bold = True th2.Font.Bold = True th3.Font.Bold = True th4.Font.Bold = True th5.Font.Bold = True th6.Font.Bold = True th7.Font.Bold = True th8.Font.Bold = True th1.BackColor = veragblue th2.BackColor = veragblue th3.BackColor = veragblue th4.BackColor = veragblue th5.BackColor = veragblue th6.BackColor = veragblue th7.BackColor = veragblue th8.BackColor = veragblue th1.ForeColor = white th2.ForeColor = white th3.ForeColor = white th4.ForeColor = white th5.ForeColor = white th6.ForeColor = white th7.ForeColor = white th8.ForeColor = white End Sub Protected Sub btn_b_Click(sender As Object, e As EventArgs) dt = Nothing If valdaterage_1.IsValid And valdaterange_2.IsValid Then If String.IsNullOrEmpty(Kdnrtext) = False Then If Not String.IsNullOrEmpty(txt_Absender.Text) Then txt_Absender.ValidateRequestMode = UI.ValidateRequestMode.Enabled regex_txt_Absender.Enabled = True regex_txt_Absender.Validate() Try 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" End If Catch ex As Exception VERAG_VARIABLES.seterrorcount() lbl_status.Text = VERAG_VARIABLES.geterrornumb + ": " End Try End If End If Else lbl_status.Text = "The time chosen is newer then today or older than april 2001. Please correct." End If MsgBox("Test") End Sub Protected Sub btn_resetForm_Click(sender As Object, e As EventArgs) dt = Nothing txt_Absender.Text = String.Empty txt_Absender_M.Text = String.Empty txt_Empfaenger.Text = String.Empty txt_Empfaenger_M.Text = String.Empty txt_KdNrAuftrag.Text = String.Empty txt_KdNrAuftrag_M.Text = String.Empty txt_LKW.Text = String.Empty txt_LKW_M.Text = String.Empty txt_ReNr.Text = String.Empty txt_ReNr_M.Text = String.Empty datevon = Date.ParseExact("01." + Date.Now.Month.ToString + "." + Date.Now.Year.ToString, "dd.MM.yyyy", Nothing) datebis = Date.Now pickdate1.Text = datevon.ToString pickdate2.Text = datebis.ToString Kdnrtext = "" Absender = "" Empfaenger = "" LKWNR = "" KDNAFNR = "" reNr = "" 'MsgBox("Reset") End Sub 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." 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." End If End Sub End Class