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

Public Class clsDetalhePedido

    Private _CODIGO_DETPED As Integer
    Public Property CODIGO_DETPED() As Integer
        Get
            Return _CODIGO_DETPED
        End Get
        Set(ByVal value As Integer)
            _CODIGO_DETPED = value
        End Set
    End Property
    Private _CODIGO_PED As Integer
    Public Property CODIGO_PED() As Integer
        Get
            Return _CODIGO_PED
        End Get
        Set(ByVal value As Integer)
            _CODIGO_PED = value
        End Set
    End Property

    Private _CODIGO_PROD As Integer
    Public Property CODIGO_PROD() As Integer
        Get
            Return _CODIGO_PROD
        End Get
        Set(ByVal value As Integer)
            _CODIGO_PROD = value
        End Set
    End Property



    Private _QTDE_DETPED As Integer
    Public Property QTDE_DETPED() As Integer
        Get
            Return _QTDE_DETPED
        End Get
        Set(ByVal value As Integer)
            _QTDE_DETPED = value
        End Set
    End Property



    Private _VLUNITARIO_DETPED As Integer
    Public Property VLUNITARIO_DETPED() As Integer
        Get
            Return _VLUNITARIO_DETPED
        End Get
        Set(ByVal value As Integer)
            _VLUNITARIO_DETPED = value
        End Set
    End Property



    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 _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 SelectDETALHEPEDIDO() As DataSet
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT * FROM TBL_DETALHEPEDIDO"
        Return clsBanco.RetornaDataSet(strsql.ToString)

    End Function


    Public Sub DeleteDETALHEPEDIDO(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_DETALHEPEDIDO"
        strsql = "WHERE CODIGO_DETPED  =  " & IntCodigo
        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




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

        Dim strsql As String

        strsql = "UPDATE TBL_DETALHEPEDIDO  SET "
        strsql = strsql & "CODIGO_PED = " & _CODIGO_PED
        strsql = strsql & ",CODIGO_PROD = " & _CODIGO_PROD
        strsql = strsql & ",QTDE_DETPED = " & _QTDE_DETPED
        strsql = strsql & ",VLUNITARIO_DETPED = " & _VLUNITARIO_DETPED
        strsql = strsql & ",CODIGO_UNID = " & _CODIGO_UNID
        strsql = strsql & ",ATUALIZADO= " & 1
        strsql = strsql & ",DATAATUALIZACAO= '" & _DATAATUALIZACAO & "'"
        strsql = strsql & " WHERE CODIGO_DETPED = " & IntCodigo

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




    Public Sub InsertDETALHEPEDIDO()
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "INSERT INTO TBL_DETALHEPEDIDO("
        strsql = strsql & "CODIGO_PED"
        strsql = strsql & "CODIGO_PROD"
        strsql = strsql & "QTDE_DETPED"
        strsql = strsql & "VLUNITARIO_DETPED"
        strsql = strsql & "CODIGO_UNID"
        strsql = strsql & "ATUALIZADO"
        strsql = strsql & "DATAATUALIZACAO"
        strsql = strsql & ")VALUES("
        strsql = strsql & " & _CODIGO_PED"
        strsql = strsql & "," & _CODIGO_PROD
        strsql = strsql & "," & _QTDE_DETPED
        strsql = strsql & "," & _VLUNITARIO_DETPED
        strsql = strsql & "," & _CODIGO_UNID
        strsql = strsql & "," & 1
        strsql = strsql & ",'" & _DATAATUALIZACAO & "'"
        strsql = strsql & ")"

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

