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

Public Class clsRegiao


    Private _CODIGO_REG As Integer
    Public Property CODIGO_REG() As Integer
        Get
            Return _CODIGO_REG
        End Get
        Set(ByVal value As Integer)
            _CODIGO_REG = value
        End Set
    End Property



    Private _NOME_REG As String
    Public Property NOME_REG() As String
        Get
            Return _NOME_REG
        End Get
        Set(ByVal value As String)
            _NOME_REG = value
        End Set
    End Property



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

    End Function
    Public Function SelectREGIAOForGrid() As DataSet
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT CODIGO_REG, NOME_REG FROM TBL_REGIAO"
        Return clsBanco.RetornaDataSet(strsql.ToString)

    End Function

    Public Sub DeleteREGIAO(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_REGIAO"
        strsql = strsql & " WHERE CODIGO_REG  =  " & IntCodigo
        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




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

        Dim strsql As String

        strsql = "UPDATE TBL_REGIAO  SET "
        strsql = strsql & "NOME_REG= '" & _NOME_REG & "'"
        strsql = strsql & " WHERE CODIGO_REG = " & IntCodigo

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




    Public Sub InsertREGIAO()
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "INSERT INTO TBL_REGIAO("
        strsql = strsql & "NOME_REG"
        strsql = strsql & ")VALUES("
        strsql = strsql & "'" & _NOME_REG & "'"
        strsql = strsql & ")"

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

