Imports System.Collections.Generic
Imports System.Text
Imports System.Data.SqlClient
Imports System.Data

Public Class clsTipo
    Private _CODIGO_TIPO As Integer
    Public Property CODIGO_TIPO() As Integer
        Get
            Return _CODIGO_TIPO
        End Get
        Set(ByVal value As Integer)
            _CODIGO_TIPO = value
        End Set
    End Property
    Private _NOME_TIPO As String
    Public Property NOME_TIPO() As String
        Get
            Return _NOME_TIPO
        End Get
        Set(ByVal value As String)
            _NOME_TIPO = value
        End Set
    End Property
    Public Function SelectTipo() As DataSet
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT * FROM TBL_TIPO"
        Return clsBanco.RetornaDataSet(strsql.ToString)

    End Function
    Public Sub DeleteTipo(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_TIPO"
        strsql = "WHERE CODIGO_TIPO  =  " & IntCodigo
        clsBanco.ExecutaComando(strsql.ToString)
    End Sub
    Public Sub UpdateTipo(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "UPDATE TBL_TIPO  SET "
        strsql = strsql & "NOME_TIPO= '" & _NOME_TIPO & "'"
        strsql = strsql & " WHERE CODIGO_TIPO = " & IntCodigo

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub
    Public Sub InsertTipo()
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "INSERT INTO TBL_TIPO("
        strsql = strsql & "NOME_TIPO"
        strsql = strsql & ")VALUES("
        strsql = strsql & "'" & _NOME_TIPO & "'"
        strsql = strsql & ")"

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub
End Class

