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.

98 lines
3.5 KiB

Imports System
Imports System.Data
Imports System.Data.SqlTypes
Imports System.Data.SqlClient
Public Class clsWindowHandling
Dim m_width As Integer
Property Width As Integer
Get
Return m_width
End Get
Set(value As Integer)
m_width = value
End Set
End Property
Dim m_height As Integer
Property height As Integer
Get
Return m_height
End Get
Set(value As Integer)
m_height = value
End Set
End Property
Public Function get_windowsize(windowsnr As Integer)
Dim selectcommand As New SqlCommand
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("", connection)
Dim ds As New DataSet
selectcommand.CommandText = "sp_getset_Windowsize"
selectcommand.Parameters.Add("@WindowsNr", SqlDbType.VarChar, 255)
selectcommand.Parameters.Add("@Mitarbeiternr", SqlDbType.Int, 4)
selectcommand.Parameters.Add("@fnkt", SqlDbType.Int, 4)
selectcommand.Parameters.Add("@width", SqlDbType.Int, 4)
selectcommand.Parameters.Add("@height", SqlDbType.Int, 4)
selectcommand.Parameters(0).Value = windowsnr
selectcommand.Parameters(1).Value = Globals.clsmitarbeiter.iMitarbeiternr.Value
selectcommand.Parameters(2).Value = 1
selectcommand.Parameters(3).Value = 0
selectcommand.Parameters(4).Value = 0
selectcommand.CommandType = CommandType.StoredProcedure
selectcommand.Connection = connection
Try
connection.ConnectionString = Globals.sConnectionString
connection.Open()
da.SelectCommand = selectcommand
da.Fill(ds)
Me.Width = ds.Tables(0).Rows(0).Item("Width")
Me.height = ds.Tables(0).Rows(0).Item("Height")
Catch ex As Exception
Me.Width = 0
Me.height = 0
Finally
connection.Close()
da.Dispose()
ds.Dispose()
selectcommand.Dispose()
End Try
End Function
Public Function set_Windowsize(windownr As Integer, width As Integer, height As Integer)
Dim selectcommand As New SqlCommand
Dim connection As New SqlConnection()
Dim da As New SqlDataAdapter("", connection)
Dim ds As New DataSet
selectcommand.CommandText = "sp_getset_Windowsize"
selectcommand.Parameters.Add("@WindowsNr", SqlDbType.VarChar, 255)
selectcommand.Parameters.Add("@Mitarbeiternr", SqlDbType.Int, 4)
selectcommand.Parameters.Add("@fnkt", SqlDbType.Int, 4)
selectcommand.Parameters.Add("@width", SqlDbType.Int, 4)
selectcommand.Parameters.Add("@height", SqlDbType.Int, 4)
selectcommand.Parameters(0).Value = windownr
selectcommand.Parameters(1).Value = Globals.clsmitarbeiter.iMitarbeiternr.Value
selectcommand.Parameters(2).Value = 2
selectcommand.Parameters(3).Value = width
selectcommand.Parameters(4).Value = height
selectcommand.CommandType = CommandType.StoredProcedure
selectcommand.Connection = connection
Try
connection.ConnectionString = Globals.sConnectionString
connection.Open()
da.SelectCommand = selectcommand
da.Fill(ds)
Catch ex As Exception
MsgBox(ex.Message)
Finally
connection.Close()
da.Dispose()
ds.Dispose()
selectcommand.Dispose()
End Try
End Function
End Class