JJ_13_11_NEW CONSTRUCTOR

This commit is contained in:
JenneJ
2015-11-13 15:50:44 +01:00
parent 9f80eb5a3d
commit a212483e19
5 changed files with 251 additions and 334 deletions

View File

@@ -649,181 +649,4 @@ Public Class ClassControlCommandsUI
If LogErrorsOnly = False Then ClassLogger.Add(">> ConnectRecord SQL: " & SQL, False)
Return ClassDatabase.Execute_non_Query(SQL)
End Function
'Function SaveRecord_OLD(RecordID As Integer, FormID As Integer, Optional foreignRecordID As Integer = 0) As String
' Try
' Dim SQL As String
' Dim RECORD_ID As Integer
' Dim ADDED_WHO As String = Environment.UserName
' Dim CHANGED_WHO As String = Environment.UserName
' If IsInsert = True Then
' If LogErrorsOnly = False Then ClassLogger.Add(">> (SaveRecord) Insert", False)
' ' Create the record first
' SQL = "INSERT INTO TBPMO_RECORD(ADDED_WHO, FORM_ID) VALUES ('" & ADDED_WHO & "', " & FormID & ")"
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' IsInsert = False
' Return "ERROR - INSERT RECORD NOT SUCCESSFUL"
' End If
' ' Get last RecordID
' SQL = "SELECT (MAX(GUID)) FROM TBPMO_RECORD where ADDED_WHO = '" & ADDED_WHO & "'"
' RECORD_ID = ClassDatabase.Execute_Scalar(SQL)
' 'Den Record Connecten
' If foreignRecordID > 0 Then
' If LogErrorsOnly = False Then ClassLogger.Add(">> foreignRecordID: " & foreignRecordID & "; Record-ID: " & RECORD_ID, False)
' SQL = "INSERT INTO TBPMO_RECORD_CONNECT(RECORD1_ID,RECORD2_ID,ADDED_WHO) VALUES (" & foreignRecordID & "," & RECORD_ID & ",'" & ADDED_WHO & "')"
' If LogErrorsOnly = False Then ClassLogger.Add(">> SQL: " & SQL, False)
' ClassDatabase.Execute_non_Query(SQL)
' End If
' 'ThisRecordID = RECORD_ID
' 'MsgBox(formid)
' 'Save Each Value from Controls into CONTROL_VALUE
' 'For Each ctrl As Control In pnl.Controls
' Dim VALUE
' For Each ctrl As Control In _CtrlBuilder.AllControls
' Dim CONTROL_ID As Integer = GetControlID_for_Name(ctrl.Name, FormID)
' If CONTROL_ID <> -1 And TypeOf ctrl Is TextBox Or TypeOf ctrl Is ComboBox Then
' VALUE = ctrl.Text
' 'If TypeOf ctrl Is ComboBox Then
' ' Dim cmb = DirectCast(ctrl, ComboBox)
' ' If cmb.DataSource Is Nothing = False Then
' ' Dim bs As BindingSource = DirectCast(cmb.DataSource, BindingSource)
' ' Dim dt As DataTable = DirectCast(bs.DataSource, DataTable)
' ' BindingSource_Check_Content_Insert(bs, cmb.DisplayMember.ToString, cmb.Text)
' ' ' MsgBox(dt.TableName.ToString & vbNewLine & cmb.DisplayMember.ToString)
' ' End If
' 'End If
' ElseIf CONTROL_ID <> -1 And TypeOf ctrl Is CheckBox Then
' 'If CONTROL_ID = -1 Then
' Dim chk As CheckBox
' chk = DirectCast(ctrl, CheckBox)
' VALUE = chk.Checked
' CONTROL_ID = GetControlID_for_Name(ctrl.Name, FormID)
' 'End If
' ElseIf CONTROL_ID <> -1 And TypeOf ctrl Is RadioButton Then
' Dim radio As RadioButton
' radio = DirectCast(ctrl, RadioButton)
' VALUE = radio.Checked
' CONTROL_ID = GetControlID_for_Name(ctrl.Name, FormID)
' End If
' 'Jetzt der Insert
' SQL = "INSERT INTO TBPMO_CONTROL_VALUE(CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES (" & CONTROL_ID & ", " & RECORD_ID & ", '" & VALUE & "', '" & ADDED_WHO & "')"
' ClassDatabase.Execute_non_Query(SQL)
' Next
' ' Reset insert after INSERT
' IsInsert = False
' 'tsstatus_Detail_show(True, "Neuer Datensatz eingefügt - " & Now)
' NEW_RECORD_ID = RECORD_ID
' CURRENT_RECORD_ID = RECORD_ID
' Return "Neuer Datensatz eingefügt - " & Now
' Else
' If LogErrorsOnly = False Then ClassLogger.Add(">> (SaveRecord) Update RecordID: " & RECORD_ID, False)
' For Each ctrl As Control In _CtrlBuilder.AllControls
' Dim CONTROL_ID = GetControlID_for_RecordID(ctrl.Name, RecordID)
' Dim value_akt = ClassDatabase.Execute_Scalar("SELECT VALUE FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID)
' Console.WriteLine(CONTROL_ID.ToString & " - " & ctrl.Name)
' If CONTROL_ID = -1 And (TypeOf ctrl Is TextBox Or TypeOf ctrl Is ComboBox) Then
' ' Trying to save a value for a new value
' Dim VALUE = ctrl.Text
' CONTROL_ID = GetControlID_for_Name(ctrl.Name, FormID)
' SQL = "INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES (" & CONTROL_ID & ", " & RecordID & ", '" & VALUE & "', '" & ADDED_WHO & "')"
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while inserting new value for Control " & ctrl.Name & "!")
' End If
' ElseIf TypeOf ctrl Is TextBox Or TypeOf ctrl Is ComboBox Then
' Dim VALUE = ctrl.Text
' If value_akt <> VALUE Then
' 'If TypeOf ctrl Is ComboBox Then
' ' Dim cmb = DirectCast(ctrl, ComboBox)
' ' If cmb.DataSource Is Nothing = False Then
' ' Dim bs As BindingSource = DirectCast(cmb.DataSource, BindingSource)
' ' BindingSource_Check_Content_Insert(bs, cmb.DisplayMember.ToString, cmb.Text)
' ' End If
' 'End If
' SQL = "UPDATE TBPMO_CONTROL_VALUE SET VALUE = '" & VALUE & "', CHANGED_WHO = '" & CHANGED_WHO & "' WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while updating the value for Control " & ctrl.Name & "!")
' End If
' End If
' ElseIf CONTROL_ID = -1 And (TypeOf ctrl Is DevExpress.XtraEditors.DateEdit) Then
' Dim date_ctrl As DevExpress.XtraEditors.DateEdit = DirectCast(ctrl, DevExpress.XtraEditors.DateEdit)
' Dim VALUE As String = date_ctrl.DateTime.ToString("yyyy-MM-dd")
' CONTROL_ID = GetControlID_for_Name(date_ctrl.Name, FormID)
' SQL = "INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES (" & CONTROL_ID & ", " & RecordID & ", '" & VALUE & "', '" & ADDED_WHO & "')"
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while inserting new value for Control " & ctrl.Name & "!")
' End If
' ElseIf TypeOf ctrl Is DevExpress.XtraEditors.DateEdit Then
' Dim date_ctrl As DevExpress.XtraEditors.DateEdit = DirectCast(ctrl, DevExpress.XtraEditors.DateEdit)
' Dim VALUE As String = date_ctrl.DateTime.ToString("yyyy-MM-dd")
' If value_akt <> VALUE Then
' SQL = "UPDATE TBPMO_CONTROL_VALUE SET VALUE = '" & VALUE & "', CHANGED_WHO = '" & CHANGED_WHO & "' WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while updating the value for Control " & ctrl.Name & "!")
' End If
' End If
' ElseIf TypeOf ctrl Is CheckBox Then
' If CONTROL_ID = -1 Then
' Dim chk As CheckBox
' chk = DirectCast(ctrl, CheckBox)
' Dim VALUE = chk.Checked
' CONTROL_ID = GetControlID_for_Name(ctrl.Name, FormID)
' SQL = "INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES (" & CONTROL_ID & ", " & RecordID & ", '" & VALUE & "', '" & ADDED_WHO & "')"
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while inserting new value for Control " & ctrl.Name & "!")
' End If
' Else
' Dim chk As CheckBox
' chk = DirectCast(ctrl, CheckBox)
' Dim VALUE = chk.Checked
' SQL = "UPDATE TBPMO_CONTROL_VALUE SET VALUE = '" & VALUE & "', CHANGED_WHO = '" & CHANGED_WHO & "' WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while update new value for Control " & ctrl.Name & "!")
' End If
' End If
' ElseIf TypeOf ctrl Is RadioButton Then
' If CONTROL_ID = -1 Then
' Dim radio As RadioButton = DirectCast(ctrl, RadioButton)
' Dim VALUE As String = radio.Checked
' CONTROL_ID = GetControlID_for_Name(ctrl.Name, FormID)
' SQL = "INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES (" & CONTROL_ID & ", " & RecordID & ", " & VALUE & ", " & ADDED_WHO & ")"
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while inserting new value for Control " & ctrl.Name & "!")
' End If
' Else
' Dim radio As RadioButton = DirectCast(ctrl, RadioButton)
' Dim value As String = radio.Checked
' CONTROL_ID = GetControlID_for_Name(ctrl.Name, FormID)
' SQL = "UPDATE TBPMO_CONTROL_VALUE SET VALUE = '" & value & "', CHANGED_WHO = '" & CHANGED_WHO & "' WHERE CONTROL_ID = " & CONTROL_ID & " AND RECORD_ID = " & RecordID
' If ClassDatabase.Execute_non_Query(SQL) = False Then
' Throw New Exception("Error while update new value for Control " & ctrl.Name & "!")
' End If
' End If
' End If
' Next
' 'tsstatus_Detail_show(True, "Datensatz aktualisiert - " & Now)
' Return "Datensatz aktualisiert - " & Now
' End If
' Catch ex As Exception
' MsgBox("Error in SaveRecord:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
' IsInsert = False
' Return "Error in SaveRecord"
' End Try
'End Function
End Class