MS DateEdit
This commit is contained in:
@@ -26,6 +26,9 @@ Public Class frmSearchStart
|
||||
Private oDTAttributes As DataTable
|
||||
Private SEARCH_COUNT As Integer = 0
|
||||
Private _Environment As Environment
|
||||
Private ChangedDateControls As List(Of String)
|
||||
|
||||
|
||||
|
||||
Public Sub New(ByVal pDTSearchProfiles As DataTable, Optional ByVal pRunSearch As Boolean = False)
|
||||
' Dieser Aufruf ist für den Designer erforderlich.
|
||||
@@ -257,7 +260,7 @@ Public Class frmSearchStart
|
||||
If oAttriTYPE = "VARCHAR" Or oAttriTYPE = "BIG INTEGER" Then
|
||||
oMyControl = oControls.CreateExistingGridControl(oAttributeRow, oXPosition, oYPositionControl)
|
||||
Dim myDGV As GridControl = CType(oMyControl, GridControl)
|
||||
myDGV.ContextMenuStrip = ContextMenuStripMultiselect
|
||||
|
||||
Dim omyDTSource As DataTable = CType(myDGV.DataSource, DataTable)
|
||||
If Not IsNothing(omyDTSource) Then
|
||||
If omyDTSource.Rows.Count = 1 Then
|
||||
@@ -281,7 +284,7 @@ Public Class frmSearchStart
|
||||
oMyControl = oControls.CreateExistingDatepicker(oAttributeRow, oXPosition, oYPositionControl)
|
||||
Dim myDTP As DateEdit = CType(oMyControl, DateEdit)
|
||||
AddHandler myDTP.DisableCalendarDate, AddressOf DisableCalendarDate
|
||||
AddHandler myDTP.EditValueChanged, AddressOf CalendarChanged
|
||||
AddHandler myDTP.DateTimeChanged, AddressOf CalendarChanged 'CalendarChanged
|
||||
ElseIf oAttriTYPE = "BIT" Then
|
||||
oMyControl = oControls.CreateExistingCheckbox(oAttributeRow, oXPosition, oYPositionControl)
|
||||
Dim myCheckBox As CheckBox = CType(oMyControl, CheckBox)
|
||||
@@ -337,6 +340,12 @@ Public Class frmSearchStart
|
||||
Private Sub ClearSearchCriteria()
|
||||
Dim oSQL = $"DELETE FROM TBIDB_USER_SEARCH_CRITERIA WHERE SEARCH_PROFIL_ID = {PSEARCH_ID} AND USERID = {My.Application.User.UserId}"
|
||||
My.DatabaseIDB.ExecuteNonQuery(oSQL)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub ClearSelectedControls()
|
||||
ChangedDateControls = Nothing
|
||||
End Sub
|
||||
|
||||
Private Sub RenewSearchAttributes()
|
||||
@@ -344,7 +353,8 @@ Public Class frmSearchStart
|
||||
|
||||
For Each oControl As Control In TabSelected.Controls
|
||||
Dim octrlType = oControl.GetType.ToString
|
||||
|
||||
Dim oAttrID As Integer
|
||||
Dim oAttrTitle As String
|
||||
Select Case oControl.GetType.ToString
|
||||
Case "DevExpress.XtraGrid.GridControl"
|
||||
Dim oMyGridControl As GridControl = CType(oControl, GridControl)
|
||||
@@ -354,8 +364,8 @@ Public Class frmSearchStart
|
||||
Continue For
|
||||
End If
|
||||
|
||||
Dim oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID
|
||||
Dim oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle
|
||||
oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID
|
||||
oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle
|
||||
For Each oRowHandle As Integer In oSelectedRows
|
||||
Dim oResult = oMyGridView.GetRowCellValue(oRowHandle, oMyGridView.Columns(0).FieldName)
|
||||
Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{oResult}','{My.Application.User.UserName}'"
|
||||
@@ -363,7 +373,52 @@ Public Class frmSearchStart
|
||||
Next
|
||||
Case "DevExpress.XtraEditors.DateEdit"
|
||||
' MsgBox("Date")
|
||||
Dim myDTP As DateEdit = CType(oControl, DateEdit)
|
||||
If ChangedDateControls Is Nothing Then
|
||||
Continue For
|
||||
End If
|
||||
If ChangedDateControls.Count = 0 Then
|
||||
Continue For
|
||||
End If
|
||||
For Each oName As String In ChangedDateControls
|
||||
If myDTP.Name = oName Then
|
||||
If Not IsNothing(myDTP.EditValue) Then
|
||||
oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID
|
||||
oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle
|
||||
Dim oldValue As Date
|
||||
Dim validDate As Boolean = False
|
||||
Dim oDateValue As DateTime = myDTP.EditValue
|
||||
Try
|
||||
validDate = Date.TryParse(myDTP.OldEditValue, oldValue)
|
||||
Catch ex As Exception
|
||||
oldValue = Date.MinValue
|
||||
End Try
|
||||
|
||||
If Not validDate Then
|
||||
oldValue = Date.MinValue
|
||||
End If
|
||||
|
||||
If oldValue = myDTP.EditValue Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim dateString = oDateValue.ToString("yyyy-MM-dd") 'hh:mm:ss.fff
|
||||
Dim omydate = myDTP.EditValue.ToString
|
||||
Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{omydate}','{My.Application.User.UserName}'"
|
||||
My.DatabaseIDB.ExecuteNonQuery(oInsert)
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
Case "System.Windows.Forms.CheckBox"
|
||||
Dim myCheckBox As CheckBox = CType(oControl, CheckBox)
|
||||
If myCheckBox.CheckState <> CheckState.Indeterminate Then
|
||||
oAttrID = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrID
|
||||
oAttrTitle = DirectCast(oControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle
|
||||
Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{myCheckBox.Checked.ToString}','{My.Application.User.UserName}'"
|
||||
My.DatabaseIDB.ExecuteNonQuery(oInsert)
|
||||
End If
|
||||
Case Else
|
||||
'MsgBox(oControl.GetType.ToString)
|
||||
End Select
|
||||
Next
|
||||
End Sub
|
||||
@@ -381,22 +436,7 @@ Public Class frmSearchStart
|
||||
Dim oAttrTitle = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrTitle
|
||||
RenewSearchAttributes()
|
||||
AddSearchAttribute(oAttrID, oAttrTitle, oResult)
|
||||
'For Each oAttributeRow1 As DataRow In oDTAttributes.Rows
|
||||
' If CInt(oAttributeRow1.Item("DEPENDING_ATTRIBUTE1")) = oAttrID Then
|
||||
' Logger.Debug($"Another Attribute [{oAttrID}]is depending to this [{oAttrID}] one..")
|
||||
' Dim oSourceSQL As String = oAttributeRow1.Item("SOURCE_SQL").ToString
|
||||
' oSourceSQL = oSourceSQL.Replace("@DEPENDING_IDB_OBJECT", My.Application.User.Language)
|
||||
' oSourceSQL = oSourceSQL.Replace("@USER_LANGUAGE", My.Application.User.Language)
|
||||
' oSourceSQL = oSourceSQL.Replace("@pUSER_ID", My.Application.User.UserId)
|
||||
' oSourceSQL = oSourceSQL.Replace("@RESULT_TITLE", oAttributeRow1.Item("ATTRIBUTE_TITLE").ToString)
|
||||
' Dim oDTSource As DataTable
|
||||
' oDTSource = My.Database_IDB.GetDatatable(oSourceSQL)
|
||||
|
||||
' End If
|
||||
'Next
|
||||
|
||||
' Return oResult
|
||||
'Else : Return Nothing
|
||||
End If
|
||||
|
||||
End Sub
|
||||
@@ -406,6 +446,7 @@ Public Class frmSearchStart
|
||||
Dim oChecked = oCurrentCB.Checked
|
||||
Dim oAttrID = DirectCast(oCurrentCB.Tag, ClassControlCreator.ControlMetadata).AttrID
|
||||
Dim oAttrTitle = DirectCast(oCurrentCB.Tag, ClassControlCreator.ControlMetadata).AttrTitle
|
||||
RenewSearchAttributes()
|
||||
AddSearchAttribute(oAttrID, oAttrTitle, oChecked.ToString)
|
||||
End Sub
|
||||
Private Sub frmSearchStart_Shown(sender As Object, e As EventArgs) Handles Me.Shown
|
||||
@@ -427,13 +468,60 @@ Public Class frmSearchStart
|
||||
'End If
|
||||
End Sub
|
||||
Private Sub CalendarChanged(sender As Object, e As EventArgs)
|
||||
If DataLoaded = False Then Exit Sub
|
||||
Dim myDTP As DateEdit = CType(sender, DateEdit)
|
||||
If Not IsNothing(myDTP.EditValue) Then
|
||||
Dim omydate = myDTP.EditValue.ToString
|
||||
Dim oList As New List(Of String)
|
||||
oList.Add(myDTP.Name)
|
||||
If Not IsNothing(ChangedDateControls) Then
|
||||
Dim oFound As Boolean = False
|
||||
For Each oName As String In ChangedDateControls
|
||||
If myDTP.Name = oName Then
|
||||
oFound = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
If oFound = False Then
|
||||
ChangedDateControls.Add(myDTP.Name)
|
||||
End If
|
||||
Else
|
||||
ChangedDateControls = oList
|
||||
End If
|
||||
|
||||
RenewSearchAttributes()
|
||||
|
||||
'Dim oInsert = $"EXEC PRIDB_NEW_USER_SEARCH_CRITERIA {PSEARCH_ID.ToString},{My.Application.User.UserId.ToString},{oAttrID.ToString},'{omydate}','{My.Application.User.UserName}'"
|
||||
'My.DatabaseIDB.ExecuteNonQuery(oInsert)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub OnDateSelectedValueChanged(sender As Object, e As EventArgs)
|
||||
Try
|
||||
Dim myDTP As DateEdit = CType(sender, DateEdit)
|
||||
Dim value As DateTime = myDTP.EditValue
|
||||
|
||||
Dim oldValue As Date
|
||||
Dim validDate As Boolean = False
|
||||
|
||||
Try
|
||||
validDate = Date.TryParse(myDTP.OldEditValue, oldValue)
|
||||
Catch ex As Exception
|
||||
oldValue = Date.MinValue
|
||||
End Try
|
||||
|
||||
If Not validDate Then
|
||||
oldValue = Date.MinValue
|
||||
End If
|
||||
|
||||
If oldValue = myDTP.EditValue Then
|
||||
Exit Sub
|
||||
End If
|
||||
Dim dateString = value.ToString("yyyy-MM-dd") 'hh:mm:ss.fff
|
||||
|
||||
Catch ex As Exception
|
||||
Logger.Error(ex)
|
||||
End Try
|
||||
End Sub
|
||||
Public Function IsValidDate(pCheckDT As DataTable, pDate2Check As Date) As Boolean
|
||||
Dim oIsValid As Boolean = False
|
||||
For Each oDateRow As DataRow In pCheckDT.Rows
|
||||
@@ -462,7 +550,7 @@ Public Class frmSearchStart
|
||||
'Clear_token()
|
||||
ClearSearchCriteria()
|
||||
DTSearchTerms.Clear()
|
||||
|
||||
ClearSelectedControls()
|
||||
Catch ex As Exception
|
||||
MsgBox("Unexpected Error in Clearing Search Items: " & ex.Message, MsgBoxStyle.Critical)
|
||||
End Try
|
||||
@@ -567,7 +655,7 @@ Public Class frmSearchStart
|
||||
BarStaticItemInfo.ItemAppearance.Normal.BackColor = pColor
|
||||
End Sub
|
||||
|
||||
Private Sub MehrfachauswahlAktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MehrfachauswahlAktivierenToolStripMenuItem.Click
|
||||
Private Sub MehrfachauswahlAktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs)
|
||||
If DataLoaded = False Then Exit Sub
|
||||
Dim oCurrentControl As GridControl = DirectCast(CURR_CTRL_OBJ, GridControl)
|
||||
Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID
|
||||
@@ -581,12 +669,9 @@ Public Class frmSearchStart
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub ContextMenuStripMultiselect_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStripMultiselect.Opening
|
||||
DataLoaded = False
|
||||
CURR_CTRL_OBJ = ContextMenuStripMultiselect.SourceControl
|
||||
End Sub
|
||||
|
||||
Private Sub MehrfachauswahlInaktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MehrfachauswahlInaktivierenToolStripMenuItem.Click
|
||||
|
||||
Private Sub MehrfachauswahlInaktivierenToolStripMenuItem_Click(sender As Object, e As EventArgs)
|
||||
If DataLoaded = False Then Exit Sub
|
||||
Dim oCurrentControl As GridControl = DirectCast(CURR_CTRL_OBJ, GridControl)
|
||||
Dim oAttrID = DirectCast(oCurrentControl.Tag, ClassControlCreator.ControlMetadata).AttrID
|
||||
@@ -600,14 +685,6 @@ Public Class frmSearchStart
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Private Sub ContextMenuStripMultiselect_Closed(sender As Object, e As ToolStripDropDownClosedEventArgs) Handles ContextMenuStripMultiselect.Closed
|
||||
DataLoaded = True
|
||||
End Sub
|
||||
|
||||
Private Sub ContextMenuStripMultiselect_Closing(sender As Object, e As ToolStripDropDownClosingEventArgs) Handles ContextMenuStripMultiselect.Closing
|
||||
DataLoaded = True
|
||||
End Sub
|
||||
|
||||
Private Sub GridViewSearchTerms_RowDeleted(sender As Object, e As DevExpress.Data.RowDeletedEventArgs) Handles GridViewSearchTerms.RowDeleted
|
||||
If DataLoaded = False Then Exit Sub
|
||||
Dim oCurrentView As GridView = DirectCast(sender, GridView)
|
||||
|
||||
Reference in New Issue
Block a user