This commit is contained in:
SchreiberM
2016-06-03 12:14:55 +02:00
parent 9d03e60f4c
commit 71fdef8192
5 changed files with 187 additions and 165 deletions

View File

@@ -10,7 +10,11 @@
lblCount.Text = msg & MASS_RECORD_CHANGE.Count
cmbColumn.Items.Clear()
For Each Str As String In MASS_COLUMN_LIST
cmbColumn.Items.Add(Str)
If Str.ToLower = "addedwho" Or Str.ToLower = "changedwho" Or Str.ToLower = "addedwhen" Or Str.ToLower = "changedwhen" Then
Continue For
Else
cmbColumn.Items.Add(Str)
End If
Next
Catch ex As Exception
MsgBox("Unexpected Error in load form:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
@@ -18,7 +22,6 @@
End Sub
Private Sub btncancel_Click(sender As Object, e As EventArgs) Handles btncancel.Click
SUCCESSFULL = False
Me.Close()
End Sub
@@ -29,15 +32,27 @@
If USER_LANGUAGE <> "de-DE" Then
msg = "Are You sure You want to execute this mass change?"
End If
Cursor = Cursors.WaitCursor
Dim result As MsgBoxResult
result = MessageBox.Show(msg, "Confirmation:", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = MsgBoxResult.Yes Then
Dim val = txtNewValue.Text
Dim SQL = String.Format("SELECT GUID FROM TBPMO_CONTROL WHERE COL_NAME = '{0}' AND FORM_ID = {1}", cmbColumn.Text, CURRENT_FORM_ID)
Dim control_Id = ClassDatabase.Execute_Scalar(SQL)
If Not IsNothing(control_Id) Then
If control_Id > 0 Then
SQL = String.Format("SELECT CONTROL_TYPE_ID FROM TBPMO_CONTROL WHERE GUID = {0}", control_Id)
Dim control_type_ID = ClassDatabase.Execute_Scalar(SQL)
If control_type_ID = 4 Then
Try
val = CDate(val)
Catch ex As Exception
MsgBox("Error in Converting value '" & val & "' to date", MsgBoxStyle.Critical)
Cursor = Cursors.Default
Exit Sub
End Try
End If
If control_type_ID = 7 Or control_type_ID = 12 Or control_type_ID = 14 Then
msg = "Achtung: für diese Spalte existieren mehrere Werte. Diese Werte werden gelöscht." & vbNewLine & "Wollen Sie dennoch fortfahren?"
If USER_LANGUAGE <> "de-DE" Then
@@ -56,21 +71,25 @@
End If
End If
Try
Dim err As Boolean = False
For Each Record As String In MASS_RECORD_CHANGE
SQL = String.Format("SELECT GUID FROM TBPMO_CONTROL_VALUE WHERE CONTROL_ID = {0} AND RECORD_ID = {1}", control_Id, CInt(Record))
Dim ex_GUID = ClassDatabase.Execute_Scalar(SQL)
If Not IsNothing(ex_GUID) Then
SQL = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}',CHANGED_WHO = '{1}' WHERE GUID = {2}", txtNewValue.Text, Environment.UserName, ex_GUID)
SQL = String.Format("UPDATE TBPMO_CONTROL_VALUE SET VALUE = '{0}',CHANGED_WHO = '{1}' WHERE GUID = {2}", val, Environment.UserName, ex_GUID)
If ClassDatabase.Execute_non_Query(SQL) = False Then
MsgBox("Error in updating the value for Record: " & Record & vbNewLine & "Please check the logfile.", MsgBoxStyle.Exclamation)
End If
Else
SQL = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", control_Id, CInt(Record), txtNewValue.Text, Environment.UserName)
SQL = String.Format("INSERT INTO TBPMO_CONTROL_VALUE (CONTROL_ID, RECORD_ID, VALUE, ADDED_WHO) VALUES ({0},{1},'{2}','{3}')", control_Id, CInt(Record), val, Environment.UserName)
If ClassDatabase.Execute_non_Query(SQL) = False Then
MsgBox("Error in inserting the value for Record: " & Record & vbNewLine & "Please check the logfile.", MsgBoxStyle.Exclamation)
End If
End If
Next
SUCCESSFULL = True
msg = "Alle Änderungen wurden ausgeführt!"
If USER_LANGUAGE <> "de-DE" Then
msg = "All changes were executed!"
@@ -79,8 +98,11 @@
Catch ex As Exception
MsgBox("Unexpected Error in Getting record to be changed:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
Else
MsgBox("No defined column found! (1)", MsgBoxStyle.Information)
End If
Else
MsgBox("No defined column found! (2)", MsgBoxStyle.Information)
End If
End If
End If
@@ -88,5 +110,6 @@
Catch ex As Exception
MsgBox("Unexpected Error in Execute mass change:" & vbNewLine & ex.Message, MsgBoxStyle.Critical)
End Try
Cursor = Cursors.Default
End Sub
End Class