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

Public Class clsPedido

    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 _DATA_PED As DateTime
    Public Property DATA_PED() As DateTime
        Get
            Return _DATA_PED
        End Get
        Set(ByVal value As DateTime)
            _DATA_PED = value
        End Set
    End Property



    Private _CODIGO_COT As Integer
    Public Property CODIGO_COT() As Integer
        Get
            Return _CODIGO_COT
        End Get
        Set(ByVal value As Integer)
            _CODIGO_COT = value
        End Set
    End Property



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

    End Function


    Public Sub DeletePEDIDO(ByVal IntCodigo As Integer)
        Dim clsBanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_PEDIDO"
        strsql = "WHERE CODIGO_PED  =  " & IntCodigo
        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




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

        Dim strsql As String

        strsql = "UPDATE TBL_PEDIDO  SET "
        strsql = strsql & "DATA_PED= '" & _DATA_PED & "'"
        strsql = strsql & ",CODIGO_COT = " & _CODIGO_COT
        strsql = strsql & " WHERE CODIGO_PED = " & IntCodigo

        clsBanco.ExecutaComando(strsql.ToString)
    End Sub




    Public Sub InsertPEDIDO()
        Dim clsBanco As New clsBanco

        Dim strsql As String

        strsql = "INSERT INTO TBL_PEDIDO("
        strsql = strsql & "DATA_PED"
        strsql = strsql & "CODIGO_COT"
        strsql = strsql & ")VALUES("
        strsql = strsql & "'" & _DATA_PED & "'"
        strsql = strsql & "," & _CODIGO_COT
        strsql = strsql & ")"

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

