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.

270 lines
12 KiB

Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Imports System.ComponentModel
Public Class frmValueSelector
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 C1TrueDBGrid1 As C1.Win.C1TrueDBGrid.C1TrueDBGrid
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmValueSelector))
Dim GridLines1 As C1.Win.C1TrueDBGrid.Util.GridLines = New C1.Win.C1TrueDBGrid.Util.GridLines()
Me.C1TrueDBGrid1 = New C1.Win.C1TrueDBGrid.C1TrueDBGrid()
Me.Button1 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'C1TrueDBGrid1
'
Me.C1TrueDBGrid1.AllowFilter = True
Me.C1TrueDBGrid1.AllowRowSizing = C1.Win.C1TrueDBGrid.RowSizingEnum.AllRows
Me.C1TrueDBGrid1.AllowSort = True
Me.C1TrueDBGrid1.CaptionHeight = 17
Me.C1TrueDBGrid1.CollapseColor = System.Drawing.Color.Black
Me.C1TrueDBGrid1.DataChanged = False
Me.C1TrueDBGrid1.DeadAreaBackColor = System.Drawing.Color.Empty
Me.C1TrueDBGrid1.ExpandColor = System.Drawing.Color.Black
Me.C1TrueDBGrid1.FetchRowStyles = 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(8, 8)
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 = False
Me.C1TrueDBGrid1.Size = New System.Drawing.Size(408, 264)
Me.C1TrueDBGrid1.TabIndex = 0
Me.C1TrueDBGrid1.Text = "C1TrueDBGrid1"
Me.C1TrueDBGrid1.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:Aqua;}Selected{" & _
"ForeColor:HighlightText;BackColor:Highlight;}Style3{}Inactive{ForeColor:Inactive" & _
"CaptionText;BackColor:InactiveCaption;}FilterBar{BackColor:255, 255, 192;}Footer" & _
"{}Caption{AlignHorz:Center;}Normal{}HighlightRow{ForeColor:HighlightText;BackCol" & _
"or:Highlight;}Style9{}OddRow{BackColor:224, 224, 224;}RecordSelector{AlignImage:" & _
"Center;}Heading{Wrap:True;AlignVert:Center;Border:Raised,,1, 1, 1, 1;ForeColor:C" & _
"ontrolText;BackColor:Control;}Style8{}Style10{AlignHorz:Near;}Style11{}Style12{}" & _
"Style13{}Style1{}</Data></Styles><Splits><C1.Win.C1TrueDBGrid.MergeView Name="""" " & _
"CaptionHeight=""17"" ColumnCaptionHeight=""17"" ColumnFooterHeight=""17"" FetchRowStyl" & _
"es=""True"" MarqueeStyle=""DottedCellBorder"" RecordSelectorWidth=""16"" DefRecSelWidt" & _
"h=""16"" VerticalScrollGroup=""1"" HorizontalScrollGroup=""1""><ClientRect>0, 0, 404, " & _
"260</ClientRect><BorderSide>0</BorderSide><CaptionStyle parent=""Style2"" me=""Styl" & _
"e10"" /><EditorStyle parent=""Editor"" me=""Style5"" /><EvenRowStyle parent=""EvenRow""" & _
" me=""Style8"" /><FilterBarStyle parent=""FilterBar"" me=""Style13"" /><FooterStyle pa" & _
"rent=""Footer"" me=""Style3"" /><GroupStyle parent=""Group"" me=""Style12"" /><HeadingSt" & _
"yle parent=""Heading"" me=""Style2"" /><HighLightRowStyle parent=""HighlightRow"" me=""" & _
"Style7"" /><InactiveStyle parent=""Inactive"" me=""Style4"" /><OddRowStyle parent=""Od" & _
"dRow"" me=""Style9"" /><RecordSelectorStyle parent=""RecordSelector"" me=""Style11"" />" & _
"<SelectedStyle parent=""Selected"" me=""Style6"" /><Style parent=""Normal"" me=""Style1" & _
""" /></C1.Win.C1TrueDBGrid.MergeView></Splits><NamedStyles><Style parent="""" me=""N" & _
"ormal"" /><Style parent=""Normal"" me=""Heading"" /><Style parent=""Heading"" me=""Foote" & _
"r"" /><Style parent=""Heading"" me=""Caption"" /><Style parent=""Heading"" me=""Inactive" & _
""" /><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=""RecordSelector" & _
""" /><Style parent=""Normal"" me=""FilterBar"" /><Style parent=""Caption"" me=""Group"" /" & _
"></NamedStyles><vertSplits>1</vertSplits><horzSplits>1</horzSplits><Layout>None<" & _
"/Layout><DefaultRecSelWidth>16</DefaultRecSelWidth><ClientArea>0, 0, 404, 260</C" & _
"lientArea></Blob>"
'
'Button1
'
Me.Button1.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Button1.Location = New System.Drawing.Point(8, 280)
Me.Button1.Name = "Button1"
Me.Button1.TabIndex = 1
Me.Button1.Text = "&Abbruch"
'
'Button2
'
Me.Button2.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Button2.Location = New System.Drawing.Point(344, 280)
Me.Button2.Name = "Button2"
Me.Button2.TabIndex = 2
Me.Button2.Text = "&OK"
'
'frmValueSelector
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(424, 309)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button2, Me.Button1, Me.C1TrueDBGrid1})
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.Name = "frmValueSelector"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Selektion "
CType(Me.C1TrueDBGrid1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
End Sub
#End Region
Dim m_datenherkunft As String
Dim m_value As String
Dim m_partnernr As String
Dim m_datenvorhanden As Boolean
Property Datenherkunft() As String
Get
Return m_datenherkunft
End Get
Set(ByVal Value As String)
m_datenherkunft = Value
End Set
End Property
Property SelWert() As String
Get
Return m_value
End Get
Set(ByVal Value As String)
m_value = Value
End Set
End Property
Property Partnernr() As String
Get
Return m_partnernr
End Get
Set(ByVal Value As String)
m_partnernr = Value
End Set
End Property
Property Datenvorhanden() As Boolean
Get
Return m_datenvorhanden
End Get
Set(ByVal Value As Boolean)
m_datenvorhanden = Value
End Set
End Property
Public Sub LoadData()
m_datenvorhanden = True
Dim d As DataTable
d = Generic_Select(1)
Me.C1TrueDBGrid1.DataSource = d
If Me.C1TrueDBGrid1.Splits(0).Rows.Count = 0 Then
MyMsg.show_standardmessage(19, MsgBoxStyle.Information)
m_datenvorhanden = False
End If
Dim i As Integer
For i = 0 To Me.C1TrueDBGrid1.Columns.Count - 1
If Me.C1TrueDBGrid1.Columns(i).Caption = "SAREC00" Then
Me.C1TrueDBGrid1.Splits(0).DisplayColumns(i).Visible = False
End If
Next
End Sub
Private Function Generic_Select(ByVal typ As Integer) As DataTable
Dim scmCmdToExecute As SqlCommand = New SqlCommand()
Select Case typ
Case 1
scmCmdToExecute.CommandText = "dbo.SP_Dokumentbearbeitung_DokWertList"
Case Else
End Select
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("@nrpar00", SqlDbType.Int, 4, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Partnernr))
scmCmdToExecute.Parameters.Add(New SqlParameter("@regel", SqlDbType.VarChar, 255, ParameterDirection.Input, True, 10, 0, "", DataRowVersion.Proposed, Me.Datenherkunft))
Case Else
End Select
If typ = 1 Then
End If
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 Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Me.SelWert = Me.C1TrueDBGrid1.Columns(0).Value
Catch
End Try
Me.Close()
End Sub
Private Sub C1TrueDBGrid1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles C1TrueDBGrid1.DoubleClick
Me.SelWert = Me.C1TrueDBGrid1.Columns(0).Value
Me.DialogResult = DialogResult.OK
Me.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.SelWert = Me.C1TrueDBGrid1.Columns(0).Value
Me.Close()
End Sub
Private Sub frmValueSelector_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub C1TrueDBGrid1_FetchRowStyle(ByVal sender As Object, ByVal e As C1.Win.C1TrueDBGrid.FetchRowStyleEventArgs) Handles C1TrueDBGrid1.FetchRowStyle
Try
If Me.C1TrueDBGrid1.Columns("sarec00").CellValue(e.Row) <> 2 Then
Dim FNT As Font = e.CellStyle.Font
e.CellStyle.Font = New Font(FNT, FontStyle.Strikeout)
End If
Catch
End Try
End Sub
End Class