163 lines
5.6 KiB
VB.net
163 lines
5.6 KiB
VB.net
Imports VERAG_PROG_ALLGEMEIN
|
|
|
|
Public Class frmSprachen
|
|
|
|
Dim SPRACHENBind As cEasyBinding
|
|
Public table
|
|
Public BIND_DB
|
|
Public programId As Integer
|
|
Sub New(table, BIND_DB, programId)
|
|
Me.table = table
|
|
Me.BIND_DB = BIND_DB
|
|
Me.programId = programId
|
|
InitializeComponent()
|
|
End Sub
|
|
|
|
Private Sub frmSprachen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
|
|
cbxSprachen.fillWithSQL("SELECT distinct([trs_sprache]) FROM [tblTranslate] WHERE trs_progId='" & programId & "' ORDER By [trs_sprache]", False, "FMZOLL", False)
|
|
|
|
cbxSprachen.changeItem("EN")
|
|
|
|
If cbxSprachen.SelectedIndex = -1 Then
|
|
cbxSprachen.Items.Add("EN")
|
|
cbxSprachen.changeItem("EN")
|
|
End If
|
|
|
|
|
|
txtProgramm.fillWithSQL("SELECT [prog_codename] from [tblProgramme] WHERE [prog_id] ='" & programId & "'", "ADMIN")
|
|
|
|
End Sub
|
|
|
|
Private Sub cbxSprachen_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbxSprachen.SelectedIndexChanged
|
|
|
|
Dim sqlLanguage = " AND [trs_sprache] = '" & cbxSprachen.SelectedItem.ToString & "'"
|
|
|
|
loadDGV(sqlLanguage)
|
|
End Sub
|
|
|
|
Private Sub loadDGV(Optional language As String = "", Optional sqlwhere As String = "")
|
|
|
|
Try
|
|
SPRACHENBind = New cEasyBinding(BIND_DB)
|
|
|
|
Select Case language
|
|
Case <> ""
|
|
If sqlwhere = "" Then
|
|
|
|
SPRACHENBind.initBinding("SELECT * FROM " & table & " WHERE [trs_progId] = '" & programId & "'" & language, table)
|
|
|
|
Else
|
|
|
|
SPRACHENBind.initBinding("SELECT * FROM " & table & " WHERE [trs_progId] = '" & programId & "'" & language & sqlwhere, table)
|
|
End If
|
|
|
|
|
|
Case Else
|
|
|
|
If sqlwhere = "" Then
|
|
|
|
SPRACHENBind.initBinding("SELECT * FROM " & table & "WHERE [trs_progId] = '" & programId & "'", table)
|
|
Else
|
|
|
|
SPRACHENBind.initBinding("SELECT * FROM " & table & " WHERE [trs_progId] = '" & programId & "'" & sqlwhere, table)
|
|
|
|
End If
|
|
|
|
End Select
|
|
|
|
DataGridView.DataSource = SPRACHENBind.bindingdataTable
|
|
|
|
With DataGridView
|
|
|
|
If .Columns.Count > 0 Then
|
|
.Columns("trs_id").Visible = False
|
|
.Columns("trs_progId").Visible = False
|
|
.Columns("trs_progName").Visible = False
|
|
.Columns("trs_object").HeaderText = "Object"
|
|
.Columns("trs_object").Width = 152
|
|
.Columns("trs_control").HeaderText = "Control"
|
|
.Columns("trs_control").Width = 155
|
|
.Columns("trs_subControl").HeaderText = "Subcontrol"
|
|
.Columns("trs_subControl").Width = 100
|
|
.Columns("trs_sprache").HeaderText = "Spr"
|
|
.Columns("trs_sprache").Width = 40
|
|
.Columns("trs_text").HeaderText = "Übersetzung"
|
|
.Columns("trs_text").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
|
.Columns("trs_textDE").HeaderText = "DE-Text"
|
|
.Columns("trs_textDE").AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill
|
|
.Columns("trs_active").HeaderText = "aktiv"
|
|
.Columns("trs_active").Width = 40
|
|
End If
|
|
|
|
End With
|
|
|
|
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
Private Sub TextBox1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs) Handles txtObject.PreviewKeyDown, txtDE.PreviewKeyDown, txtSubcontrol.PreviewKeyDown, txtControl.PreviewKeyDown, txttranslate.PreviewKeyDown
|
|
|
|
Dim sqladdon As String = ""
|
|
|
|
If e.KeyCode = Keys.Enter Then
|
|
If txtControl.Text <> "" Then
|
|
sqladdon &= " AND [trs_control] like '%" & txtControl.Text & "%'"
|
|
End If
|
|
|
|
If txtObject.Text <> "" Then
|
|
sqladdon &= " AND [trs_object] like '%" & txtObject.Text & "%'"
|
|
End If
|
|
|
|
If txtSubcontrol.Text <> "" Then
|
|
sqladdon &= " AND [trs_subControl] like '%" & txtSubcontrol.Text & "%'"
|
|
End If
|
|
|
|
If txtDE.Text <> "" Then
|
|
sqladdon &= " AND [trs_textDE] like '%" & txtDE.Text & "%'"
|
|
End If
|
|
|
|
If txttranslate.Text <> "" Then
|
|
sqladdon &= " AND [trs_text] like '%" & txttranslate.Text & "%'"
|
|
End If
|
|
|
|
Dim sqlLanguage = " AND [trs_sprache] = '" & cbxSprachen.SelectedItem.ToString & "'"
|
|
|
|
loadDGV(sqlLanguage, sqladdon)
|
|
|
|
End If
|
|
End Sub
|
|
|
|
|
|
Private Sub DataGridView_DefaultValuesNeeded(sender As Object, e As DataGridViewRowEventArgs) Handles DataGridView.DefaultValuesNeeded
|
|
Try
|
|
|
|
|
|
e.Row.Cells("trs_progId").Value = programId
|
|
e.Row.Cells("trs_progName").Value = txtProgramm.Text
|
|
e.Row.Cells("trs_sprache").Value = cbxSprachen._value
|
|
e.Row.Cells("trs_active").Value = True
|
|
Catch ex As Exception
|
|
MsgBox(ex.Message)
|
|
End Try
|
|
End Sub
|
|
|
|
Private Sub txttranslate_TextChanged(sender As Object, e As EventArgs) Handles txttranslate.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub Label6_Click(sender As Object, e As EventArgs) Handles Label6.Click
|
|
|
|
End Sub
|
|
|
|
Private Sub txtDE_TextChanged(sender As Object, e As EventArgs) Handles txtDE.TextChanged
|
|
|
|
End Sub
|
|
|
|
Private Sub Label5_Click(sender As Object, e As EventArgs) Handles Label5.Click
|
|
|
|
End Sub
|
|
End Class |