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.

247 lines
12 KiB

Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.ComponentModel
Imports UtilityLibrary.Win32
Public Class frmLog
Inherits System.Windows.Forms.Form
#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 ImageList1 As System.Windows.Forms.ImageList
Friend WithEvents ToolBar1 As System.Windows.Forms.ToolBar
Friend WithEvents ToolBarButton1 As System.Windows.Forms.ToolBarButton
Friend WithEvents ToolBarButton2 As System.Windows.Forms.ToolBarButton
Friend WithEvents C1TrueDBGrid1 As C1.Win.C1TrueDBGrid.C1TrueDBGrid
Friend WithEvents ToolBarButton3 As System.Windows.Forms.ToolBarButton
Friend WithEvents ToolBarButton4 As System.Windows.Forms.ToolBarButton
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmLog))
Dim GridLines1 As C1.Win.C1TrueDBGrid.Util.GridLines = New C1.Win.C1TrueDBGrid.Util.GridLines()
Me.ImageList1 = New System.Windows.Forms.ImageList(Me.components)
Me.ToolBar1 = New System.Windows.Forms.ToolBar()
Me.ToolBarButton1 = New System.Windows.Forms.ToolBarButton()
Me.ToolBarButton2 = New System.Windows.Forms.ToolBarButton()
Me.ToolBarButton3 = New System.Windows.Forms.ToolBarButton()
Me.ToolBarButton4 = New System.Windows.Forms.ToolBarButton()
Me.C1TrueDBGrid1 = New C1.Win.C1TrueDBGrid.C1TrueDBGrid()
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'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.ToolBarButton1, Me.ToolBarButton2, Me.ToolBarButton3, Me.ToolBarButton4})
Me.ToolBar1.DropDownArrows = True
Me.ToolBar1.ImageList = Me.ImageList1
Me.ToolBar1.Name = "ToolBar1"
Me.ToolBar1.ShowToolTips = True
Me.ToolBar1.Size = New System.Drawing.Size(616, 25)
Me.ToolBar1.TabIndex = 0
'
'ToolBarButton1
'
Me.ToolBarButton1.ImageIndex = 0
'
'ToolBarButton2
'
Me.ToolBarButton2.ImageIndex = 1
'
'ToolBarButton3
'
Me.ToolBarButton3.ImageIndex = 2
'
'ToolBarButton4
'
Me.ToolBarButton4.ImageIndex = 3
'
'C1TrueDBGrid1
'
Me.C1TrueDBGrid1.AllowFilter = True
Me.C1TrueDBGrid1.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows
Me.C1TrueDBGrid1.AllowSort = True
Me.C1TrueDBGrid1.AllowUpdate = False
Me.C1TrueDBGrid1.AllowUpdateOnBlur = False
Me.C1TrueDBGrid1.AlternatingRows = True
Me.C1TrueDBGrid1.CaptionHeight = 17
Me.C1TrueDBGrid1.CollapseColor = System.Drawing.Color.Black
Me.C1TrueDBGrid1.Cursor = System.Windows.Forms.Cursors.Default
Me.C1TrueDBGrid1.DataChanged = False
Me.C1TrueDBGrid1.DeadAreaBackColor = System.Drawing.Color.Empty
Me.C1TrueDBGrid1.Dock = System.Windows.Forms.DockStyle.Fill
Me.C1TrueDBGrid1.ExpandColor = System.Drawing.Color.Black
Me.C1TrueDBGrid1.FetchRowStyles = True
Me.C1TrueDBGrid1.FilterBar = True
Me.C1TrueDBGrid1.GroupByCaption = "Drag a column header here to group by that column"
Me.C1TrueDBGrid1.Images.Add(CType(resources.GetObject("resource.Images"), System.Drawing.Bitmap))
Me.C1TrueDBGrid1.Location = New System.Drawing.Point(0, 25)
Me.C1TrueDBGrid1.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder
Me.C1TrueDBGrid1.Name = "C1TrueDBGrid1"
Me.C1TrueDBGrid1.PreviewInfo.Location = New System.Drawing.Point(0, 0)
Me.C1TrueDBGrid1.PreviewInfo.Size = New System.Drawing.Size(0, 0)
Me.C1TrueDBGrid1.PreviewInfo.ZoomFactor = 75
Me.C1TrueDBGrid1.PrintInfo.ShowOptionsDialog = False
Me.C1TrueDBGrid1.RecordSelectorWidth = 16
GridLines1.Color = System.Drawing.Color.DarkGray
GridLines1.Style = C1.Win.C1TrueDBGrid.LineStyleEnum.Single
Me.C1TrueDBGrid1.RowDivider = GridLines1
Me.C1TrueDBGrid1.RowHeight = 15
Me.C1TrueDBGrid1.RowSubDividerColor = System.Drawing.Color.DarkGray
Me.C1TrueDBGrid1.ScrollTips = True
Me.C1TrueDBGrid1.Size = New System.Drawing.Size(616, 340)
Me.C1TrueDBGrid1.TabIndex = 26
Me.C1TrueDBGrid1.Text = "C1TrueDBGrid1"
Me.C1TrueDBGrid1.PropBag = "<?xml version=""1.0""?><Blob><Styles type=""C1.Win.C1TrueDBGrid.Design.ContextWrappe" & _
"r""><Data>Style11{}Style12{}Style13{}Style5{}Style4{}Style7{}Style6{}EvenRow{Back" & _
"Color:White;}Selected{ForeColor:HighlightText;BackColor:Highlight;}Heading{Wrap:" & _
"True;BackColor:Control;Border:Raised,,1, 1, 1, 1;ForeColor:ControlText;AlignVert" & _
":Center;}Inactive{ForeColor:InactiveCaptionText;BackColor:InactiveCaption;}Filte" & _
"rBar{BackColor:255, 255, 192;}Footer{}Caption{AlignHorz:Center;}Editor{}Normal{B" & _
"ackColor:Control;}Style27{}Style26{}HighlightRow{ForeColor:HighlightText;BackCol" & _
"or:Highlight;}Style1{}OddRow{BackColor:224, 224, 224;}RecordSelector{AlignImage:" & _
"Center;}Style9{}Style8{}Style3{}Style2{}Group{AlignVert:Center;Border:None,,0, 0" & _
", 0, 0;BackColor:ControlDark;}Style10{AlignHorz:Near;}</Data></Styles><Splits><C" & _
"1.Win.C1TrueDBGrid.MergeView Name="""" AlternatingRowStyle=""True"" CaptionHeight=""1" & _
"7"" ColumnCaptionHeight=""17"" ColumnFooterHeight=""17"" FetchRowStyles=""True"" Filter" & _
"Bar=""True"" MarqueeStyle=""DottedCellBorder"" RecordSelectorWidth=""16"" DefRecSelWid" & _
"th=""16"" VerticalScrollGroup=""1"" HorizontalScrollGroup=""1""><ClientRect>0, 0, 612," & _
" 336</ClientRect><BorderSide>0</BorderSide><CaptionStyle parent=""Heading"" me=""St" & _
"yle10"" /><EditorStyle parent=""Editor"" me=""Style2"" /><EvenRowStyle parent=""EvenRo" & _
"w"" me=""Style8"" /><FilterBarStyle parent=""FilterBar"" me=""Style27"" /><FooterStyle " & _
"parent=""Footer"" me=""Style4"" /><GroupStyle parent=""Group"" me=""Style12"" /><Heading" & _
"Style parent=""Heading"" me=""Style3"" /><HighLightRowStyle parent=""HighlightRow"" me" & _
"=""Style7"" /><InactiveStyle parent=""Inactive"" me=""Style6"" /><OddRowStyle parent=""" & _
"OddRow"" me=""Style9"" /><RecordSelectorStyle parent=""RecordSelector"" me=""Style11"" " & _
"/><SelectedStyle parent=""Selected"" me=""Style5"" /><Style parent=""Normal"" me=""Styl" & _
"e1"" /></C1.Win.C1TrueDBGrid.MergeView></Splits><NamedStyles><Style parent="""" me=" & _
"""Normal"" /><Style parent=""Normal"" me=""Heading"" /><Style parent=""Heading"" me=""Foo" & _
"ter"" /><Style parent=""Heading"" me=""Caption"" /><Style parent=""Heading"" me=""Inacti" & _
"ve"" /><Style parent=""Normal"" me=""Selected"" /><Style parent=""Normal"" me=""Editor"" " & _
"/><Style parent=""Normal"" me=""HighlightRow"" /><Style parent=""Normal"" me=""EvenRow""" & _
" /><Style parent=""Normal"" me=""OddRow"" /><Style parent=""Heading"" me=""RecordSelect" & _
"or"" /><Style parent=""Normal"" me=""FilterBar"" /><Style parent=""Caption"" me=""Group""" & _
" /></NamedStyles><vertSplits>1</vertSplits><horzSplits>1</horzSplits><Layout>Mod" & _
"ified</Layout><DefaultRecSelWidth>16</DefaultRecSelWidth><ClientArea>0, 0, 612, " & _
"336</ClientArea></Blob>"
'
'frmLog
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(616, 365)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.C1TrueDBGrid1, Me.ToolBar1})
Me.Name = "frmLog"
Me.Text = "Journal"
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim dt As DataTable
Private Sub frmLog_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dt = Generic_Select(1)
Me.C1TrueDBGrid1.DataSource = dt
Me.C1TrueDBGrid1.DataMember = dt.TableName
Dim i As Integer
For i = 0 To Me.C1TrueDBGrid1.Splits(0).DisplayColumns.Count - 1
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(i).AutoSize()
Next
End Sub
Private Function Generic_Select(ByVal typ As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
scmCmdToExecute.CommandText = "dbo.sp_performancelog"
scmCmdToExecute.CommandType = CommandType.StoredProcedure
Dim dtToReturn As DataTable = New DataTable()
Dim sdaAdapter As SqlDataAdapter = New SqlDataAdapter(scmCmdToExecute)
scmCmdToExecute.Connection = conn.scoDBConnection
Try
Select Case typ
Case 1
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 1))
Case 2
scmCmdToExecute.Parameters.Add(New SqlParameter("@fnkt", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, 2))
Case Else
End Select
sdaAdapter.Fill(dtToReturn)
Return dtToReturn
Catch ex As Exception
' // some error occured. Bubble it to caller and encapsulate Exception object
Throw New Exception("Dokumenterstellung::Generic_Select::" & scmCmdToExecute.CommandText & "::Error occured." & ex.Message, ex)
Finally
scmCmdToExecute.Dispose()
sdaAdapter.Dispose()
End Try
End Function
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
Me.Close()
Case 1 'Speichern
dt = Generic_Select(2)
frmLog_Load(sender, e)
Case 2 'Speichern
frmLog_Load(sender, e)
Case 3 'Speichern
copydata()
Case Else
End Select
End Sub
Private Sub copydata()
Dim strTemp As String 'string to be copied to the clipboard
Dim row As Long
Dim col As C1.Win.C1TrueDBGrid.C1DataColumn
Dim cols As Integer, rows As Long
If Me.C1TrueDBGrid1.SelectedRows.Count > 0 Then
For Each row In Me.C1TrueDBGrid1.SelectedRows
For Each col In Me.C1TrueDBGrid1.Columns
strTemp = strTemp & col.CellText(row) & vbTab
Next
strTemp = strTemp & vbCrLf
Next
System.Windows.Forms.Clipboard.SetDataObject(strTemp, False)
Else
End If
End Sub
End Class