Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Public Class clsbuttonsmsg
    Private catid As String
    Private mode As String
    Private form As String
    Private Applications As String
    Private Features As String
    Private TechSpecification As String
    Private MSDS As String
    Private SpecialInstruction As String
    Private Catalog As String
    Private Certificate As String
    Private Consumables As String
    Private GuarantyWarranty As String
    Private IncludedAccessories As String
    Private InstallationCommissioning As String
    Private OptionalAccessories As String
    Private Packaging As String
    Private SpareParts As String
    Private UserManual As String
    Private WearTear As String
    
    Public Property categoryid() As String
        Get
            Return catid
        End Get
        Set(ByVal value As String)
            catid = value
        End Set
    End Property
    Public Property ProcMode() As String
        Get
            Return mode
        End Get
        Set(ByVal value As String)
            mode = value
        End Set
    End Property
    Public Property FormName() As String
        Get
            Return form
        End Get
        Set(ByVal value As String)
            form = value
        End Set
    End Property
    Public Property MsgApplications() As String
        Get
            Return Applications
        End Get
        Set(ByVal value As String)
            Applications = value
        End Set
    End Property
    Public Property MsgFeatures() As String
        Get
            Return Features
        End Get
        Set(ByVal value As String)
            Features = value
        End Set
    End Property
    Public Property MsgTechSpecification() As String
        Get
            Return TechSpecification
        End Get
        Set(ByVal value As String)
            TechSpecification = value
        End Set
    End Property
    Public Property MsgMSDS() As String
        Get
            Return MSDS
        End Get
        Set(ByVal value As String)
            MSDS = value
        End Set
    End Property
    Public Property MsgSpecialInstruction() As String
        Get
            Return SpecialInstruction
        End Get
        Set(ByVal value As String)
            SpecialInstruction = value
        End Set
    End Property
    Public Property MsgCatalog() As String
        Get
            Return Catalog
        End Get
        Set(ByVal value As String)
            Catalog = value
        End Set
    End Property
    Public Property MsgCertificate() As String
        Get
            Return Certificate
        End Get
        Set(ByVal value As String)
            Certificate = value
        End Set
    End Property
    Public Property MsgConsumables() As String
        Get
            Return Consumables
        End Get
        Set(ByVal value As String)
            Consumables = value
        End Set
    End Property
    Public Property MsgGuarantyWarranty() As String
        Get
            Return GuarantyWarranty
        End Get
        Set(ByVal value As String)
            GuarantyWarranty = value
        End Set
    End Property
    Public Property MsgIncludedAccessories() As String
        Get
            Return IncludedAccessories
        End Get
        Set(ByVal value As String)
            IncludedAccessories = value
        End Set
    End Property
    Public Property MsgOptionalAccessories() As String
        Get
            Return OptionalAccessories
        End Get
        Set(ByVal value As String)
            OptionalAccessories = value
        End Set
    End Property
    Public Property MsgInstallationCommissioning() As String
        Get
            Return InstallationCommissioning
        End Get
        Set(ByVal value As String)
            InstallationCommissioning = value
        End Set
    End Property
    Public Property MsgPackaging() As String
        Get
            Return Packaging
        End Get
        Set(ByVal value As String)
            Packaging = value
        End Set
    End Property
    Public Property MsgSpareParts() As String
        Get
            Return SpareParts
        End Get
        Set(ByVal value As String)
            SpareParts = value
        End Set
    End Property
    Public Property MsgUserManual() As String
        Get
            Return UserManual
        End Get
        Set(ByVal value As String)
            UserManual = value
        End Set
    End Property
    Public Property MsgWearTear() As String
        Get
            Return WearTear
        End Get
        Set(ByVal value As String)
            WearTear = value
        End Set
    End Property

    Public Shared Function SelectAllCategory(ByVal btnmsg As clsbuttonsmsg) As Data.DataSet
        Dim con As New Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings("ConnectionString"))
        Dim objAdapter As SqlDataAdapter
        Dim objDS As DataSet
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        con.Open()
        Try
            objAdapter = New SqlDataAdapter("Category_Master_Proc", con)
            objAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
            objAdapter.SelectCommand.Parameters.Add("@Mode", SqlDbType.NVarChar, 50).Value = btnmsg.ProcMode
            objDS = New DataSet
            objAdapter.Fill(objDS)
            Return objDS
        Catch ex As Exception
            Throw ex
        Finally
            con.Close()
            con.Dispose()
        End Try
    End Function
    Public Shared Function SelectBtnMsg(ByVal btnmsg As clsbuttonsmsg) As Data.DataSet
        Dim con As New Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings("ConnectionString"))
        Dim objAdapter As SqlDataAdapter
        Dim objDS As DataSet
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        con.Open()
        Try
            objAdapter = New SqlDataAdapter("ButtonsMsg_proc", con)
            objAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
            objAdapter.SelectCommand.Parameters.Add("@CategoryId", SqlDbType.NVarChar, 50).Value = btnmsg.categoryid
            objAdapter.SelectCommand.Parameters.Add("@Mode", SqlDbType.NVarChar, 50).Value = btnmsg.ProcMode
            objDS = New DataSet
            objAdapter.Fill(objDS)
            Return objDS
        Catch ex As Exception
            Throw ex
        Finally
            con.Close()
            con.Dispose()
        End Try
    End Function
    Public Shared Function InsertBtnMsg(ByVal BtnMsg As clsbuttonsmsg)
        Dim con As New Data.SqlClient.SqlConnection(ConfigurationManager.AppSettings("ConnectionString"))
        Dim objAdapter As SqlDataAdapter
        If con.State = ConnectionState.Open Then
            con.Close()
        End If
        con.Open()
        Dim tran As SqlTransaction
        tran = con.BeginTransaction(IsolationLevel.Serializable)
        Try
            objAdapter = New SqlDataAdapter("ButtonsMsg_proc", con)
            objAdapter.SelectCommand.Transaction = tran
            objAdapter.SelectCommand.CommandType = CommandType.StoredProcedure
            objAdapter.SelectCommand.Parameters.Add("@CategoryId", SqlDbType.NVarChar, 10).Value = BtnMsg.categoryid
            objAdapter.SelectCommand.Parameters.Add("@Applications", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgApplications
            objAdapter.SelectCommand.Parameters.Add("@Features", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgFeatures
            objAdapter.SelectCommand.Parameters.Add("@TechSpecification", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgTechSpecification
            objAdapter.SelectCommand.Parameters.Add("@MSDS", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgMSDS
            objAdapter.SelectCommand.Parameters.Add("@SpecialInstruction", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgSpecialInstruction
            objAdapter.SelectCommand.Parameters.Add("@Catalog", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgCatalog
            objAdapter.SelectCommand.Parameters.Add("@Certificate", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgCertificate
            objAdapter.SelectCommand.Parameters.Add("@Consumables", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgConsumables
            objAdapter.SelectCommand.Parameters.Add("@GuarantyWarranty", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgGuarantyWarranty
            objAdapter.SelectCommand.Parameters.Add("@IncludedAccessories", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgIncludedAccessories
            objAdapter.SelectCommand.Parameters.Add("@InstallationCommissioning", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgInstallationCommissioning
            objAdapter.SelectCommand.Parameters.Add("@OptionalAccessories", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgOptionalAccessories
            objAdapter.SelectCommand.Parameters.Add("@Packaging", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgPackaging
            objAdapter.SelectCommand.Parameters.Add("@SpareParts", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgSpareParts
            objAdapter.SelectCommand.Parameters.Add("@UserManual", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgUserManual
            objAdapter.SelectCommand.Parameters.Add("@WearTear", SqlDbType.NVarChar, 500).Value = BtnMsg.MsgWearTear
            objAdapter.SelectCommand.Parameters.Add("@FormName", SqlDbType.NVarChar, 10).Value = BtnMsg.FormName
            objAdapter.SelectCommand.Parameters.Add("@Mode", SqlDbType.NVarChar, 10).Value = BtnMsg.ProcMode
            objAdapter.SelectCommand.ExecuteNonQuery()
            tran.Commit()
        Catch ex As Exception
            tran.Rollback()
            con.Close()
            con.Dispose()
            Throw ex
        End Try
    End Function

End Class
