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

Public Class clsUnidadeMedida

    Private _CODIGO_UNID As Integer
    Public Property CODIGO_UNID() As Integer
        Get
            Return _CODIGO_UNID
        End Get
        Set(ByVal value As Integer)
            _CODIGO_UNID = value
        End Set
    End Property



    Private _NOME_UNID As String
    Public Property NOME_UNID() As String
        Get
            Return _NOME_UNID
        End Get
        Set(ByVal value As String)
            _NOME_UNID = value
        End Set
    End Property



    Private _ATUALIZADO As Boolean
    Public Property ATUALIZADO() As Boolean
        Get
            Return _ATUALIZADO
        End Get
        Set(ByVal value As Boolean)
            _ATUALIZADO = value
        End Set
    End Property



    Private _DATAATUALIZACAO As DateTime
    Public Property DATAATUALIZACAO() As DateTime
        Get
            Return _DATAATUALIZACAO
        End Get
        Set(ByVal value As DateTime)
            _DATAATUALIZACAO = value
        End Set
    End Property



    Public Function SelectUNIDADEMEDIDA() As DataSet
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT * FROM TBL_UNIDADEMEDIDA"
        Return clsBanco.RetornaDataSet(strsql.ToString)

    End Function


    Public Sub DeleteUNIDADEMEDIDA(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_UNIDADEMEDIDA"
        strsql = "WHERE CODIGO_UNID  =  " & IntCodigo
        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




    Public Sub UpdateUNIDADEMEDIDA(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "UPDATE TBL_UNIDADEMEDIDA  SET "
        strsql = strsql & "NOME_UNID= '" & _NOME_UNID & "'"
        strsql = strsql & ",ATUALIZADO= " & 1
        strsql = strsql & ",DATAATUALIZACAO= '" & _DATAATUALIZACAO & "'"
        strsql = strsql & " WHERE CODIGO_UNID = " & IntCodigo

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




    Public Sub InsertUNIDADEMEDIDA()
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "INSERT INTO TBL_UNIDADEMEDIDA("
        strsql = strsql & "NOME_UNID"
        strsql = strsql & "ATUALIZADO"
        strsql = strsql & "DATAATUALIZACAO"
        strsql = strsql & ")VALUES("
        strsql = strsql & "'" & _NOME_UNID & "'"
        strsql = strsql & "," & 1
        strsql = strsql & ",'" & _DATAATUALIZACAO & "'"
        strsql = strsql & ")"

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

