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

Public Class clsCorporativo

    Private _CODIGO_CORP As Integer
    Public Property CODIGO_CORP() As Integer
        Get
            Return _CODIGO_CORP
        End Get
        Set(ByVal value As Integer)
            _CODIGO_CORP = value
        End Set
    End Property
    Private _NOME_CORP As String
    Public Property NOME_CORP() As String
        Get
            Return _NOME_CORP
        End Get
        Set(ByVal value As String)
            _NOME_CORP = value
        End Set
    End Property
    Private _FANTASIA_CORP As String
    Public Property FANTASIA_CORP() As String
        Get
            Return _FANTASIA_CORP
        End Get
        Set(ByVal value As String)
            _FANTASIA_CORP = value
        End Set
    End Property
    Private _ENDERECO_CORP As String
    Public Property ENDERECO_CORP() As String
        Get
            Return _ENDERECO_CORP
        End Get
        Set(ByVal value As String)
            _ENDERECO_CORP = value
        End Set
    End Property
    Private _NUMERO_CORP As String
    Public Property NUMERO_CORP() As String
        Get
            Return _NUMERO_CORP
        End Get
        Set(ByVal value As String)
            _NUMERO_CORP = value
        End Set
    End Property
    Private _COMPLEMENTO_CORP As String
    Public Property COMPLEMENTO_CORP() As String
        Get
            Return _COMPLEMENTO_CORP
        End Get
        Set(ByVal value As String)
            _COMPLEMENTO_CORP = value
        End Set
    End Property
    Private _BAIRRO_CORP As String
    Public Property BAIRRO_CORP() As String
        Get
            Return _BAIRRO_CORP
        End Get
        Set(ByVal value As String)
            _BAIRRO_CORP = value
        End Set
    End Property
    Private _CEP_CORP As String
    Public Property CEP_CORP() As String
        Get
            Return _CEP_CORP
        End Get
        Set(ByVal value As String)
            _CEP_CORP = value
        End Set
    End Property
    Private _CIDADE_CORP As String
    Public Property CIDADE_CORP() As String
        Get
            Return _CIDADE_CORP
        End Get
        Set(ByVal value As String)
            _CIDADE_CORP = value
        End Set
    End Property
    Private _ESTADO_CORP As String
    Public Property ESTADO_CORP() As String
        Get
            Return _ESTADO_CORP
        End Get
        Set(ByVal value As String)
            _ESTADO_CORP = value
        End Set
    End Property
    Private _PAIS_CORP As String
    Public Property PAIS_CORP() As String
        Get
            Return _PAIS_CORP
        End Get
        Set(ByVal value As String)
            _PAIS_CORP = value
        End Set
    End Property
    Private _CNPJ_CORP As String
    Public Property CNPJ_CORP() As String
        Get
            Return _CNPJ_CORP
        End Get
        Set(ByVal value As String)
            _CNPJ_CORP = value
        End Set
    End Property
    Private _IE_CORP As String
    Public Property IE_CORP() As String
        Get
            Return _IE_CORP
        End Get
        Set(ByVal value As String)
            _IE_CORP = value
        End Set
    End Property
    Private _IM_CORP As String
    Public Property IM_CORP() As String
        Get
            Return _IM_CORP
        End Get
        Set(ByVal value As String)
            _IM_CORP = value
        End Set
    End Property
    Private _ATIVO As Boolean
    Public Property ATIVO() As Boolean
        Get
            Return _ATIVO
        End Get
        Set(ByVal value As Boolean)
            _ATIVO = 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 SelectCorporativoforCombo() As DataSet
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT CODIGO_CORP, NOME_CORP FROM TBL_CORPORATIVO ORDER BY NOME_CORP"
        Return clsBanco.RetornaDataSet(strsql.ToString)
    End Function
    Public Function SelectCorporativo() As DataSet
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT * FROM TBL_CORPORATIVO"
        Return clsBanco.RetornaDataSet(strsql.ToString)
    End Function
    Public Sub DeleteCorporativo(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_CORPORATIVO"
        strsql = "WHERE CODIGO_CORP  =  " & IntCodigo
        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




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

        Dim strsql As String

        strsql = "UPDATE TBL_CORPORATIVO  SET "
        strsql = strsql & "NOME_CORP= '" & _NOME_CORP & "'"
        strsql = strsql & ",FANTASIA_CORP= '" & _FANTASIA_CORP & "'"
        strsql = strsql & ",ENDERECO_CORP= '" & _ENDERECO_CORP & "'"
        strsql = strsql & ",NUMERO_CORP= '" & _NUMERO_CORP & "'"
        strsql = strsql & ",COMPLEMENTO_CORP= '" & _COMPLEMENTO_CORP & "'"
        strsql = strsql & ",BAIRRO_CORP= '" & _BAIRRO_CORP & "'"
        strsql = strsql & ",CEP_CORP= '" & _CEP_CORP & "'"
        strsql = strsql & ",CIDADE_CORP= '" & _CIDADE_CORP & "'"
        strsql = strsql & ",ESTADO_CORP= '" & _ESTADO_CORP & "'"
        strsql = strsql & ",PAIS_CORP= '" & _PAIS_CORP & "'"
        strsql = strsql & ",CNPJ_CORP= '" & _CNPJ_CORP & "'"
        strsql = strsql & ",IE_CORP= '" & _IE_CORP & "'"
        strsql = strsql & ",IM_CORP= '" & _IM_CORP & "'"
        strsql = strsql & ",ATIVO= " & 1
        strsql = strsql & ",ATUALIZADO= " & 1
        strsql = strsql & ",DATAATUALIZACAO= '" & _DATAATUALIZACAO & "'"
        strsql = strsql & " WHERE CODIGO_CORP = " & IntCodigo

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




    Public Sub InsertCORPORATIVO()
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "INSERT INTO TBL_CORPORATIVO("
        strsql = strsql & "NOME_CORP"
        strsql = strsql & "FANTASIA_CORP"
        strsql = strsql & "ENDERECO_CORP"
        strsql = strsql & "NUMERO_CORP"
        strsql = strsql & "COMPLEMENTO_CORP"
        strsql = strsql & "BAIRRO_CORP"
        strsql = strsql & "CEP_CORP"
        strsql = strsql & "CIDADE_CORP"
        strsql = strsql & "ESTADO_CORP"
        strsql = strsql & "PAIS_CORP"
        strsql = strsql & "CNPJ_CORP"
        strsql = strsql & "IE_CORP"
        strsql = strsql & "IM_CORP"
        strsql = strsql & "ATIVO"
        strsql = strsql & "ATUALIZADO"
        strsql = strsql & "DATAATUALIZACAO"
        strsql = strsql & ")VALUES("
        strsql = strsql & "'" & _NOME_CORP & "'"
        strsql = strsql & ",'" & _FANTASIA_CORP & "'"
        strsql = strsql & ",'" & _ENDERECO_CORP & "'"
        strsql = strsql & ",'" & _NUMERO_CORP & "'"
        strsql = strsql & ",'" & _COMPLEMENTO_CORP & "'"
        strsql = strsql & ",'" & _BAIRRO_CORP & "'"
        strsql = strsql & ",'" & _CEP_CORP & "'"
        strsql = strsql & ",'" & _CIDADE_CORP & "'"
        strsql = strsql & ",'" & _ESTADO_CORP & "'"
        strsql = strsql & ",'" & _PAIS_CORP & "'"
        strsql = strsql & ",'" & _CNPJ_CORP & "'"
        strsql = strsql & ",'" & _IE_CORP & "'"
        strsql = strsql & ",'" & _IM_CORP & "'"
        strsql = strsql & "," & 1
        strsql = strsql & "," & 1
        strsql = strsql & ",'" & _DATAATUALIZACAO & "'"
        strsql = strsql & ")"

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

