You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

488 lines
21 KiB

Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports System.Drawing
Imports System.Drawing.Color
Imports System.ComponentModel
Public Class frmDomainEditor
Inherits System.Windows.Forms.Form
Dim m_TableName As String
Dim m_Eintragnr As Long
Dim m_Inaktive As Boolean
Dim m_Eintrag As String
Dim selectedrow As Integer
Dim m_TransferKey As Long
Dim m_ToSelect As Boolean
Dim Ttip As New ToolTip()
Dim wp As New WindowPositions()
#Region "Properties"
Property Eintragnr() As Long
Get
Return m_Eintragnr
End Get
Set(ByVal Value As Long)
m_Eintragnr = Value
End Set
End Property
Property TableName() As String
Get
Return m_TableName
End Get
Set(ByVal Value As String)
m_TableName = Value
End Set
End Property
Property Inaktive() As Boolean
Get
Return m_Inaktive
End Get
Set(ByVal Value As Boolean)
m_Inaktive = Value
End Set
End Property
Property Eintrag() As String
Get
Return m_Eintrag
End Get
Set(ByVal Value As String)
m_Eintrag = Value
End Set
End Property
Property TransferKey() As Long
Get
Return m_TransferKey
End Get
Set(ByVal Value As Long)
m_TransferKey = Value
End Set
End Property
Property ToSelect() As Boolean
Get
Return m_ToSelect
End Get
Set(ByVal Value As Boolean)
m_ToSelect = Value
End Set
End Property
Dim m_Maximize As Boolean = True
Property FormMaximize() As Boolean
Get
Return m_Maximize
End Get
Set(ByVal Value As Boolean)
m_Maximize = Value
End Set
End Property
#End Region
#Region " Vom Windows Form Designer generierter Code "
Public Sub New()
MyBase.New()
' Dieser Aufruf ist für den Windows Form-Designer erforderlich.
InitializeComponent()
' Initialisierungen nach dem Aufruf InitializeComponent() hinzufügen
End Sub
' Die Form überschreibt den Löschvorgang der Basisklasse, um Komponenten zu bereinigen.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
' Für Windows Form-Designer erforderlich
Private components As System.ComponentModel.IContainer
'HINWEIS: Die folgende Prozedur ist für den Windows Form-Designer erforderlich
'Sie kann mit dem Windows Form-Designer modifiziert werden.
'Verwenden Sie nicht den Code-Editor zur Bearbeitung.
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
Friend WithEvents ToolBtnExit As System.Windows.Forms.ToolBarButton
Friend WithEvents ToolBtnSave As System.Windows.Forms.ToolBarButton
Friend WithEvents DomainList As C1.Win.C1TrueDBGrid.C1TrueDBGrid
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmDomainEditor))
Dim GridLines1 As C1.Win.C1TrueDBGrid.Util.GridLines = New C1.Win.C1TrueDBGrid.Util.GridLines()
Me.MainMenu1 = New System.Windows.Forms.MainMenu()
Me.MenuItem1 = New System.Windows.Forms.MenuItem()
Me.MenuItem2 = New System.Windows.Forms.MenuItem()
Me.MenuItem3 = New System.Windows.Forms.MenuItem()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.ToolBar1 = New System.Windows.Forms.ToolBar()
Me.ToolBtnExit = New System.Windows.Forms.ToolBarButton()
Me.ToolBtnSave = New System.Windows.Forms.ToolBarButton()
Me.DomainList = New C1.Win.C1TrueDBGrid.C1TrueDBGrid()
CType(Me.DomainList, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2, Me.MenuItem3})
Me.MenuItem1.MergeOrder = 1
Me.MenuItem1.MergeType = System.Windows.Forms.MenuMerge.Replace
Me.MenuItem1.Text = "&Datei"
'
'MenuItem2
'
Me.MenuItem2.Index = 0
Me.MenuItem2.MergeOrder = 1
Me.MenuItem2.Shortcut = System.Windows.Forms.Shortcut.AltF4
Me.MenuItem2.Text = "&Schliessen"
'
'MenuItem3
'
Me.MenuItem3.Index = 1
Me.MenuItem3.Shortcut = System.Windows.Forms.Shortcut.CtrlF5
Me.MenuItem3.Text = "&Daten sichern"
'
'ImageList1
'
Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
Me.ImageList1.ImageSize = New System.Drawing.Size(16, 16)
Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
'
'ToolBar1
'
Me.ToolBar1.Buttons.AddRange(New System.Windows.Forms.ToolBarButton() {Me.ToolBtnExit, Me.ToolBtnSave})
Me.ToolBar1.DropDownArrows = True
Me.ToolBar1.ImageList = Me.ImageList1
Me.ToolBar1.Name = "ToolBar1"
Me.ToolBar1.ShowToolTips = True
Me.ToolBar1.Size = New System.Drawing.Size(592, 25)
Me.ToolBar1.TabIndex = 2
'
'ToolBtnExit
'
Me.ToolBtnExit.ImageIndex = 0
'
'ToolBtnSave
'
Me.ToolBtnSave.ImageIndex = 1
'
'DomainList
'
Me.DomainList.AllowAddNew = True
Me.DomainList.AllowFilter = True
Me.DomainList.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows
Me.DomainList.AllowSort = True
Me.DomainList.AlternatingRows = True
Me.DomainList.CaptionHeight = 17
Me.DomainList.CellTips = C1.Win.C1TrueDBGrid.CellTipEnum.Anchored
Me.DomainList.CollapseColor = System.Drawing.Color.Black
Me.DomainList.DataChanged = False
Me.DomainList.DeadAreaBackColor = System.Drawing.Color.Gray
Me.DomainList.Dock = System.Windows.Forms.DockStyle.Fill
Me.DomainList.ExpandColor = System.Drawing.Color.Black
Me.DomainList.FilterBar = True
Me.DomainList.GroupByCaption = "Drag a column header here to group by that column"
Me.DomainList.Images.Add(CType(resources.GetObject("resource.Images"), System.Drawing.Bitmap))
Me.DomainList.Location = New System.Drawing.Point(0, 25)
Me.DomainList.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.SolidCellBorder
Me.DomainList.Name = "DomainList"
Me.DomainList.PreviewInfo.Location = New System.Drawing.Point(0, 0)
Me.DomainList.PreviewInfo.Size = New System.Drawing.Size(0, 0)
Me.DomainList.PreviewInfo.ZoomFactor = 75
Me.DomainList.PrintInfo.ShowOptionsDialog = False
Me.DomainList.RecordSelectorWidth = 16
GridLines1.Color = System.Drawing.Color.DarkGray
GridLines1.Style = C1.Win.C1TrueDBGrid.LineStyleEnum.Single
Me.DomainList.RowDivider = GridLines1
Me.DomainList.RowHeight = 15
Me.DomainList.RowSubDividerColor = System.Drawing.Color.DarkGray
Me.DomainList.ScrollTips = False
Me.DomainList.Size = New System.Drawing.Size(592, 336)
Me.DomainList.TabAction = C1.Win.C1TrueDBGrid.TabActionEnum.ColumnNavigation
Me.DomainList.TabIndex = 7
Me.DomainList.Text = "C1TrueDBGrid1"
Me.DomainList.PropBag = "<?xml version=""1.0""?><Blob><Styles type=""C1.Win.C1TrueDBGrid.Design.ContextWrappe" & _
"r""><Data>Group{BackColor:ControlDark;Border:None,,0, 0, 0, 0;AlignVert:Center;}E" & _
"ditor{}Style2{}Style5{}Style4{}Style7{}Style6{}EvenRow{BackColor:White;}Selected" & _
"{ForeColor:HighlightText;BackColor:Highlight;}Style3{}Inactive{ForeColor:Inactiv" & _
"eCaptionText;BackColor:InactiveCaption;}FilterBar{Wrap:True;BackColor:255, 255, " & _
"192;}Footer{}Caption{AlignHorz:Center;}Normal{}HighlightRow{ForeColor:HighlightT" & _
"ext;BackColor:Highlight;}Style9{}OddRow{BackColor:224, 224, 224;}RecordSelector{" & _
"AlignImage:Center;}Heading{Wrap:True;AlignVert:Center;Border:Raised,,1, 1, 1, 1;" & _
"ForeColor:ControlText;BackColor:Control;}Style8{}Style10{AlignHorz:Near;}Style11" & _
"{}Style12{}Style13{}Style1{}</Data></Styles><Splits><C1.Win.C1TrueDBGrid.MergeVi" & _
"ew Name="""" AlternatingRowStyle=""True"" CaptionHeight=""17"" ColumnCaptionHeight=""17" & _
""" ColumnFooterHeight=""17"" FilterBar=""True"" MarqueeStyle=""SolidCellBorder"" Record" & _
"SelectorWidth=""16"" DefRecSelWidth=""16"" VerticalScrollGroup=""1"" HorizontalScrollG" & _
"roup=""1""><ClientRect>0, 0, 588, 332</ClientRect><BorderSide>0</BorderSide><Capti" & _
"onStyle parent=""Style2"" me=""Style10"" /><EditorStyle parent=""Editor"" me=""Style5"" " & _
"/><EvenRowStyle parent=""EvenRow"" me=""Style8"" /><FilterBarStyle parent=""FilterBar" & _
""" me=""Style13"" /><FooterStyle parent=""Footer"" me=""Style3"" /><GroupStyle parent=""" & _
"Group"" me=""Style12"" /><HeadingStyle parent=""Heading"" me=""Style2"" /><HighLightRow" & _
"Style parent=""HighlightRow"" me=""Style7"" /><InactiveStyle parent=""Inactive"" me=""S" & _
"tyle4"" /><OddRowStyle parent=""OddRow"" me=""Style9"" /><RecordSelectorStyle parent=" & _
"""RecordSelector"" me=""Style11"" /><SelectedStyle parent=""Selected"" me=""Style6"" /><" & _
"Style parent=""Normal"" me=""Style1"" /></C1.Win.C1TrueDBGrid.MergeView></Splits><Na" & _
"medStyles><Style parent="""" me=""Normal"" /><Style parent=""Normal"" me=""Heading"" /><" & _
"Style parent=""Heading"" me=""Footer"" /><Style parent=""Heading"" me=""Caption"" /><Sty" & _
"le parent=""Heading"" me=""Inactive"" /><Style parent=""Normal"" me=""Selected"" /><Styl" & _
"e parent=""Normal"" me=""Editor"" /><Style parent=""Normal"" me=""HighlightRow"" /><Styl" & _
"e parent=""Normal"" me=""EvenRow"" /><Style parent=""Normal"" me=""OddRow"" /><Style par" & _
"ent=""Heading"" me=""RecordSelector"" /><Style parent=""Normal"" me=""FilterBar"" /><Sty" & _
"le parent=""Caption"" me=""Group"" /></NamedStyles><vertSplits>1</vertSplits><horzSp" & _
"lits>1</horzSplits><Layout>Modified</Layout><DefaultRecSelWidth>16</DefaultRecSe" & _
"lWidth><ClientArea>0, 0, 588, 332</ClientArea></Blob>"
'
'frmDomainEditor
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(592, 361)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.DomainList, Me.ToolBar1})
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Menu = Me.MainMenu1
Me.Name = "frmDomainEditor"
Me.ShowInTaskbar = False
Me.Text = "frmDomainEdidor"
CType(Me.DomainList, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Public Sub FormSize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If g_bRun Then
Me.SuspendLayout()
Dim ds As New edokadb.clsSysadminfunktion()
Try
ds.cpMainConnectionProvider = conn
ds.iSysadminfnktnr = New SqlInt32(CType(m_Eintragnr, Int32))
ds.SelectOne()
If ds.iFleft.Value <> 0 Then Me.Left = ds.iFleft.Value
If ds.iFtop.Value <> 0 Then Me.Top = ds.iFtop.Value
If ds.iFwidth.Value <> 0 Then Me.Width = ds.iFwidth.Value
If ds.iFheight.Value <> 0 Then Me.Height = ds.iFheight.Value
Me.MenuItem1.Text = Me.Eintrag
Catch
'MsgBox("Error Resizing Form")
Finally
End Try
ds.Dispose()
Me.ResumeLayout()
End If
End Sub
Public Sub SpaltenTitel_Aktualisieren(ByVal ds As DataSet)
'Spaltentitel setzen
If g_bRun Then
Dim titel As New EDOKA.MySpaltenTitel()
Dim anzcols As Integer
Dim cols(Me.DomainList.Splits(0).DisplayColumns.Count) As C1.Win.C1TrueDBGrid.C1DisplayColumn
Dim ts As New EDOKA.Tabellenspalte()
Dim i As Integer
Dim t As New DataTable()
Dim dc As C1.Win.C1TrueDBGrid.C1DisplayColumn
Dim s As String
anzcols = Me.DomainList.Splits(0).DisplayColumns.Count
t = ds.Tables(0)
ts.Tabelle = Me.TableName
For i = 0 To Me.DomainList.Columns.Count - 1
s = Me.DomainList.Columns(i).DataField
ts.Feld = s
ts.getspalte()
Me.DomainList.Columns(i).Caption = ts.spaltenname
If ts.ColWith = 0 Then
Me.DomainList.Splits(0).DisplayColumns(i).Width = 0
Me.DomainList.Splits(0).DisplayColumns(i).Visible = False
Else
Me.DomainList.Splits(0).DisplayColumns(i).Width = ts.ColWith
End If
' If Me.DomainList.Columns(i).Caption = "" Then
' Me.DomainList.Splits(0).DisplayColumns(i).Width = 0
' Else
' Me.DomainList.Splits(0).DisplayColumns(i).Width = ts.ColWith
' End If
' If Me.DomainList.Columns(i).Caption = "" Then Me.DomainList.Splits(0).DisplayColumns(i).Width = 0
If ts.locked Then
Me.DomainList.Splits(0).DisplayColumns(i).Locked = True
End If
If ts.AlsHacken Then
Me.DomainList.Columns(i).ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox
End If
'Präsentation von aktiv
If Me.DomainList.Columns(i).DataField = "aktiv" Then
Me.DomainList.Columns(i).ValueItems.Presentation = C1.Win.C1TrueDBGrid.PresentationEnum.CheckBox
Me.DomainList.Columns(i).ValueItems.DefaultItem = True
Me.DomainList.Columns(i).DefaultValue = True
Me.DomainList.Columns(i).FilterText = True
End If
If Me.DomainList.Columns(i).DataField = "erstellt_am" Then
Me.DomainList.Columns(i).DefaultValue = Now
End If
'Me.DomainList.Splits(0).DisplayColumns.Insert(ts.Order, Me.DomainList.Splits(0).DisplayColumns(i))
'me.DomainList.Splits(0).DisplayColumns.RemoveAt(i)
' cols(ts.Order) = Me.DomainList.Splits(0).DisplayColumns(i)
Next
' For i = 0 To Me.DomainList.Splits(0).DisplayColumns.Count - 1
' Me.DomainList.Splits(0).DisplayColumns.RemoveAt(0)
' Next
' For i = anzcols To 0 Step -1
' Me.DomainList.Splits(0).DisplayColumns.Insert(0, cols(i))
' Next
' cols = Nothing
'
Form_As_SelectForm()
End If
End Sub
Private Sub C1TrueDBGrid1_FetchCellTips(ByVal sender As System.Object, ByVal e As C1.Win.C1TrueDBGrid.FetchCellTipsEventArgs) Handles DomainList.FetchCellTips
If g_bRun Then
Dim ts As New EDOKA.Tabellenspalte()
ts.Tabelle = Me.TableName
Try
ts.Feld = Me.DomainList.Columns(e.ColIndex).DataField
ts.getspalte()
e.CellTip = ts.TipText
Catch
End Try
ts = Nothing
End If
End Sub
Private Sub DomainList_AfterInsert(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DomainList.AfterInsert
Dim i As Integer
'Defaulwerte erstellt_am, mutiert_am, mutierer und aktiv setzen
Try
For i = 0 To DomainList.Columns.Count - 1
If Me.DomainList.Columns(i).DataField = "aktiv" Then
Me.DomainList.Columns(i).Value = 1
End If
If Me.DomainList.Columns(i).DataField = "erstellt_am" Then
Me.DomainList.Columns(i).Value = Now
End If
If Me.DomainList.Columns(i).DataField = "mutiert_am" Then
Me.DomainList.Columns(i).Value = Now
End If
If Me.DomainList.Columns(i).DataField = "mutierer" Then
Me.DomainList.Columns(i).Value = Globals.MitarbeiterNr
End If
Next
Catch
End Try
End Sub
Private Sub domainlist_aftercellupdate(ByVal sender As System.Object, ByVal e As C1.Win.C1TrueDBGrid.ColEventArgs) Handles DomainList.AfterColUpdate
'Aktualisieren von Mutierer und Mutiert_am
Dim i As Integer
Try
For i = 0 To Me.DomainList.Columns.Count - 1
If Me.DomainList.Columns(i).DataField = "mutiert_am" Then Me.DomainList.Columns(i).Value = Now
If Me.DomainList.Columns(i).DataField = "mutierer" Then Me.DomainList.Columns(i).Value = Globals.MitarbeiterNr
Next
'neuer DB-Key auslösen, sofern kein Key vorhanden ist
If Me.DomainList.Columns(0).Value Is DBNull.Value Then
Dim dbkey As New edokadb.clsMyKey_Tabelle()
Dim key As Long
dbkey.cpMainConnectionProvider = conn
key = dbkey.get_dbkey(TableName)
Me.DomainList.Columns(0).Value = key
For i = 0 To Me.DomainList.Columns.Count - 1
If Me.DomainList.Columns(i).DataField = "mandantnr" Then
Me.DomainList.Columns(i).Value = Globals.MandantNr
End If
Next
dbkey.Dispose()
End If
Catch
End Try
End Sub
Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles ToolBar1.ButtonClick
Select Case ToolBar1.Buttons.IndexOf(e.Button)
Case 0 'close button
Case 1 'Speichern
Me.ActiveControl = Me.ToolBar1
Me.ActiveControl = Me.DomainList
Case Else
End Select
End Sub
Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MenuItem2.Click
Close()
End Sub
Private Sub frmDomainEditor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If g_bRun Then
Me.Text = Me.Eintrag
Try
If Me.FormMaximize = True Then Globals.WinPos.Get_Position(Me)
Catch
End Try
Me.DomainList.ScrollTips = True
'Me.WindowState = FormWindowState.Maximized
'EDEX_Dokumentpakete 2005-01-13
If Me.FormMaximize Then Me.WindowState = FormWindowState.Maximized
End If
End Sub
Private Sub Doklist_FetchScrollTips(ByVal sender As System.Object, ByVal e As C1.Win.C1TrueDBGrid.FetchScrollTipsEventArgs) Handles DomainList.FetchScrollTips
Select Case e.ScrollBar
Case C1.Win.C1TrueDBGrid.ScrollBarEnum.Vertical
e.ScrollTip = CStr(e.Row + 1) & " / " & CStr(Me.DomainList.Splits(0).Rows.Count)
End Select
e.TipStyle.ForeColor = Color.Blue
End Sub
Private Sub frmDomainEditor_Close(ByVal sender As System.Object, ByVal e As CancelEventArgs) Handles MyBase.Closing
Try
Globals.WinPos.Set_Position(Me)
Catch
End Try
End Sub
Private Sub DomainList_Dblklick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DomainList.DoubleClick
If ToSelect Then
Me.TransferKey = Me.DomainList.Columns(0).Value
Me.Close()
End If
End Sub
Private Sub Form_As_SelectForm()
If ToSelect Then
Me.DomainList.AllowAddNew = False
Me.DomainList.AllowUpdate = False
Me.ToolBar1.Buttons(1).Visible = False
Me.MenuItem3.Visible = False
End If
End Sub
End Class