Imports System.Data
Imports System.Data.SqlClient


Public Class clsDetalheProjetoConcorrente



    Private _CODIGO_DETCONC As Integer
    Public Property CODIGO_DETCONC() As Integer
        Get
            Return _CODIGO_DETCONC
        End Get
        Set(ByVal value As Integer)
            _CODIGO_DETCONC = value
        End Set
    End Property
    Private _CODIGO_PROJ As Long
    Public Property CODIGO_PROJ() As Long
        Get
            Return _CODIGO_PROJ
        End Get
        Set(ByVal value As Long)
            _CODIGO_PROJ = value
        End Set
    End Property
    Private _CODIGO_CONC As Integer
    Public Property CODIGO_CONC() As Integer
        Get
            Return _CODIGO_CONC
        End Get
        Set(ByVal value As Integer)
            _CODIGO_CONC = value
        End Set
    End Property

    Private _OBSERVACAO_DETCONC As String
    Public Property OBSERVACAO_DETCONC() As String
        Get
            Return _OBSERVACAO_DETCONC
        End Get
        Set(ByVal value As String)
            _OBSERVACAO_DETCONC = 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 SelectdetalheProjetoConcorrenteForGrid(ByVal lngCodigo As Long) As DataSet

        Dim clsbanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT "
        strsql = strsql & "D.CODIGO_DETCONC"
        strsql = strsql & ",C.NOME_CONC"
        strsql = strsql & ",D.OBSERVACAO_DETCONC"
        strsql = strsql & " FROM TBL_DETALHEPROJETOCONCORRENTE AS D INNER JOIN TBL_CONCORRENTE AS C ON D.CODIGO_CONC = C.CODIGO_CONC "
        strsql = strsql & " WHERE D.CODIGO_PROJ = " & lngCodigo

        Return clsbanco.RetornaDataSet(strsql.ToString)

    End Function

    Public Function SelectDetalheProjetoConcorrente(ByVal lngCodigo As Long) As DataSet

        Dim clsbanco As New clsBanco
        Dim strsql As String
        strsql = "SELECT * FROM  TBL_DETALHEPROJETOCONCORRENTE "
        strsql = strsql & " WHERE CODIGO_PROJ = " & lngCodigo

        Return clsbanco.RetornaDataSet(strsql.ToString)

    End Function

    Public Sub DeleteDetalheProjectoConcorrente(ByVal lngCodigo As Long)

        Dim clsbanco As New clsBanco
        Dim strsql As String
        strsql = "DELETE FROM TBL_DETALHEPROJETOCONCORRENTE WHERE CODIGO_DETCONC= " & lngCodigo
        clsbanco.ExecutaComando(strsql.ToString)

    End Sub


    Public Sub UpdateDetalheProjetoConcorrente(ByVal intCodigo As Integer)

        Dim clsbanco As New clsBanco
        Dim strsql As String


        strsql = "UPDATE TBL_DETALHEPROJETOCONCORRENTE SET "
        strsql = CStr(strsql = "CODIGO_PROJ = " & _CODIGO_PROJ)
        strsql = CStr(strsql = ",CODIGO_CONC = " & _CODIGO_CONC)
        strsql = CStr(strsql = ",OBSERVACAO_DETCONC = '" & _OBSERVACAO_DETCONC & "'")
        strsql = strsql & " WHERE CODIGO_DETCONC = " & intCodigo

        clsbanco.ExecutaComando(strsql.ToString)


    End Sub

    Public Sub InsertDetalheprojetoConcorrente()


        Dim clsbanco As New clsBanco
        Dim strsql As String

        strsql = "INSERT INTO TBL_DETALHEPROJETOCONCORRENTE("
        strsql = strsql & "CODIGO_PROJ"
        strsql = strsql & ",CODIGO_CONC"
        strsql = strsql & ",OBSERVACAO_DETCONC"
        strsql = strsql & ",ATUALIZADO"
        strsql = strsql & ",DATAATUALIZACAO"
        strsql = strsql & ")VALUES("
        strsql = strsql & _CODIGO_PROJ
        strsql = strsql & "," & _CODIGO_CONC
        strsql = strsql & ",'" & _OBSERVACAO_DETCONC & "'"
        strsql = strsql & "," & 1
        strsql = strsql & ",'" & Format(_DATAATUALIZACAO, "MM/dd/yyyy") & "'"
        strsql = strsql & ")"

        clsbanco.ExecutaComando(strsql.ToString)


    End Sub





End Class
