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

Public Class clsFornecedor

    Private _CODIGO_FORN As Integer
    Public Property CODIGO_FORN() As Integer
        Get
            Return _CODIGO_FORN
        End Get
        Set(ByVal value As Integer)
            _CODIGO_FORN = value
        End Set
    End Property



    Private _NOME_FORN As String
    Public Property NOME_FORN() As String
        Get
            Return _NOME_FORN
        End Get
        Set(ByVal value As String)
            _NOME_FORN = value
        End Set
    End Property



    Private _FANTASIA_FORN As String
    Public Property FANTASIA_FORN() As String
        Get
            Return _FANTASIA_FORN
        End Get
        Set(ByVal value As String)
            _FANTASIA_FORN = value
        End Set
    End Property



    Private _ENDERECO_FORN As String
    Public Property ENDERECO_FORN() As String
        Get
            Return _ENDERECO_FORN
        End Get
        Set(ByVal value As String)
            _ENDERECO_FORN = value
        End Set
    End Property



    Private _NUMERO_FORN As String
    Public Property NUMERO_FORN() As String
        Get
            Return _NUMERO_FORN
        End Get
        Set(ByVal value As String)
            _NUMERO_FORN = value
        End Set
    End Property



    Private _COMPLEMENTO_FORN As String
    Public Property COMPLEMENTO_FORN() As String
        Get
            Return _COMPLEMENTO_FORN
        End Get
        Set(ByVal value As String)
            _COMPLEMENTO_FORN = value
        End Set
    End Property



    Private _BAIRRO_FORN As String
    Public Property BAIRRO_FORN() As String
        Get
            Return _BAIRRO_FORN
        End Get
        Set(ByVal value As String)
            _BAIRRO_FORN = value
        End Set
    End Property



    Private _CEP_FORN As String
    Public Property CEP_FORN() As String
        Get
            Return _CEP_FORN
        End Get
        Set(ByVal value As String)
            _CEP_FORN = value
        End Set
    End Property



    Private _CIDADE_FORN As String
    Public Property CIDADE_FORN() As String
        Get
            Return _CIDADE_FORN
        End Get
        Set(ByVal value As String)
            _CIDADE_FORN = value
        End Set
    End Property



    Private _ESTADO_FORN As String
    Public Property ESTADO_FORN() As String
        Get
            Return _ESTADO_FORN
        End Get
        Set(ByVal value As String)
            _ESTADO_FORN = value
        End Set
    End Property



    Private _CNPJ_FORN As String
    Public Property CNPJ_FORN() As String
        Get
            Return _CNPJ_FORN
        End Get
        Set(ByVal value As String)
            _CNPJ_FORN = value
        End Set
    End Property



    Private _IE_FORN As String
    Public Property IE_FORN() As String
        Get
            Return _IE_FORN
        End Get
        Set(ByVal value As String)
            _IE_FORN = value
        End Set
    End Property



    Private _IM_FORN As String
    Public Property IM_FORN() As String
        Get
            Return _IM_FORN
        End Get
        Set(ByVal value As String)
            _IM_FORN = value
        End Set
    End Property



    Private _CONTATO_FORN As String
    Public Property CONTATO_FORN() As String
        Get
            Return _CONTATO_FORN
        End Get
        Set(ByVal value As String)
            _CONTATO_FORN = value
        End Set
    End Property



    Private _EMAIL_FORN As String
    Public Property EMAIL_FORN() As String
        Get
            Return _EMAIL_FORN
        End Get
        Set(ByVal value As String)
            _EMAIL_FORN = value
        End Set
    End Property



    Private _TELEFONE_FORN As String
    Public Property TELEFONE_FORN() As String
        Get
            Return _TELEFONE_FORN
        End Get
        Set(ByVal value As String)
            _TELEFONE_FORN = value
        End Set
    End Property



    Private _CELULAR_FORN As String
    Public Property CELULAR_FORN() As String
        Get
            Return _CELULAR_FORN
        End Get
        Set(ByVal value As String)
            _CELULAR_FORN = 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 SelectFORNECEDOR() As DataSet
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT * FROM TBL_FORNECEDOR"
        Return clsBanco.RetornaDataSet(strsql.ToString)

    End Function


    Public Sub DeleteFORNECEDOR(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_FORNECEDOR"
        strsql = "WHERE CODIGO_FORN  =  " & IntCodigo
        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




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

        Dim strsql As String

        strsql = "UPDATE TBL_FORNECEDOR  SET "
        strsql = strsql & "NOME_FORN= '" & _NOME_FORN & "'"
        strsql = strsql & ",FANTASIA_FORN= '" & _FANTASIA_FORN & "'"
        strsql = strsql & ",ENDERECO_FORN= '" & _ENDERECO_FORN & "'"
        strsql = strsql & ",NUMERO_FORN= '" & _NUMERO_FORN & "'"
        strsql = strsql & ",COMPLEMENTO_FORN= '" & _COMPLEMENTO_FORN & "'"
        strsql = strsql & ",BAIRRO_FORN= '" & _BAIRRO_FORN & "'"
        strsql = strsql & ",CEP_FORN= '" & _CEP_FORN & "'"
        strsql = strsql & ",CIDADE_FORN= '" & _CIDADE_FORN & "'"
        strsql = strsql & ",ESTADO_FORN= '" & _ESTADO_FORN & "'"
        strsql = strsql & ",CNPJ_FORN= '" & _CNPJ_FORN & "'"
        strsql = strsql & ",IE_FORN= '" & _IE_FORN & "'"
        strsql = strsql & ",IM_FORN= '" & _IM_FORN & "'"
        strsql = strsql & ",CONTATO_FORN= '" & _CONTATO_FORN & "'"
        strsql = strsql & ",EMAIL_FORN= '" & _EMAIL_FORN & "'"
        strsql = strsql & ",TELEFONE_FORN= '" & _TELEFONE_FORN & "'"
        strsql = strsql & ",CELULAR_FORN= '" & _CELULAR_FORN & "'"
        strsql = strsql & ",ATUALIZADO= " & 1
        strsql = strsql & ",DATAATUALIZACAO= '" & _DATAATUALIZACAO & "'"
        strsql = strsql & " WHERE CODIGO_FORN = " & IntCodigo

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




    Public Sub InsertFORNECEDOR()
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "INSERT INTO TBL_FORNECEDOR("
        strsql = strsql & "NOME_FORN"
        strsql = strsql & "FANTASIA_FORN"
        strsql = strsql & "ENDERECO_FORN"
        strsql = strsql & "NUMERO_FORN"
        strsql = strsql & "COMPLEMENTO_FORN"
        strsql = strsql & "BAIRRO_FORN"
        strsql = strsql & "CEP_FORN"
        strsql = strsql & "CIDADE_FORN"
        strsql = strsql & "ESTADO_FORN"
        strsql = strsql & "CNPJ_FORN"
        strsql = strsql & "IE_FORN"
        strsql = strsql & "IM_FORN"
        strsql = strsql & "CONTATO_FORN"
        strsql = strsql & "EMAIL_FORN"
        strsql = strsql & "TELEFONE_FORN"
        strsql = strsql & "CELULAR_FORN"
        strsql = strsql & "ATUALIZADO"
        strsql = strsql & "DATAATUALIZACAO"
        strsql = strsql & ")VALUES("
        strsql = strsql & "'" & _NOME_FORN & "'"
        strsql = strsql & ",'" & _FANTASIA_FORN & "'"
        strsql = strsql & ",'" & _ENDERECO_FORN & "'"
        strsql = strsql & ",'" & _NUMERO_FORN & "'"
        strsql = strsql & ",'" & _COMPLEMENTO_FORN & "'"
        strsql = strsql & ",'" & _BAIRRO_FORN & "'"
        strsql = strsql & ",'" & _CEP_FORN & "'"
        strsql = strsql & ",'" & _CIDADE_FORN & "'"
        strsql = strsql & ",'" & _ESTADO_FORN & "'"
        strsql = strsql & ",'" & _CNPJ_FORN & "'"
        strsql = strsql & ",'" & _IE_FORN & "'"
        strsql = strsql & ",'" & _IM_FORN & "'"
        strsql = strsql & ",'" & _CONTATO_FORN & "'"
        strsql = strsql & ",'" & _EMAIL_FORN & "'"
        strsql = strsql & ",'" & _TELEFONE_FORN & "'"
        strsql = strsql & ",'" & _CELULAR_FORN & "'"
        strsql = strsql & "," & 1
        strsql = strsql & ",'" & _DATAATUALIZACAO & "'"
        strsql = strsql & ")"

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

