exec sp

Imports Kemet.Never.DA

Namespace Kemet.Never.BL

    Public Class Query

        Private _DBTrans As DBTransaction
        Private _errorMessage As String
        Public Sub New(ByVal DBTrans As DBTransaction)
            _DBTrans = DBTrans

        End Sub
        Public ReadOnly Property errorMessage() As String
            Get
                Return _errorMessage
            End Get
        End Property

        Public Structure Job
            Dim jobName As String
            Dim PartNumber As String
            Dim Routing As String
        End Structure

        Public Function GetJobInfo(ByVal machineName As String) As Job
            Dim jobInfo As New Job
            Try
                Dim sql As String
                Dim resultDS As DataSet
                _errorMessage = ""
                If machineName = "" Then
                    _errorMessage = "Please specify machine"
                    jobInfo.jobName = "error"
                    Return jobInfo

                End If

                sql = "select * from dbo.tbl_OracleJob where 1=1 "
                If machineName <> "" Then
                    sql &= "and jobid='" & machineName & "'"

                End If
                resultDS = _DBTrans.SQLToDataset("Job", sql)
                If resultDS.Tables.Count > 0 AndAlso resultDS.Tables(0).Rows.Count > 0 Then
                Else
                    jobInfo.jobName = "eror"
                    Return jobInfo
                End If
                With jobInfo
                    .jobName = resultDS.Tables(0).Rows(0)("jobid").ToString
                    .PartNumber = resultDS.Tables(0).Rows(0)("partnumber").ToString
                    .Routing = resultDS.Tables(0).Rows(0)("routing").ToString


                End With
                Return jobInfo

            Catch ex As Exception
                'Throw ex
                ' grant select, insert, update on apps.releasedjob to lala
                jobInfo.jobName = "eror"
                Return jobInfo
            End Try
        End Function


        Public Function GetJobInfo2(ByVal PN As String) As DataSet
            Dim strsql As String
            Dim resultDS As DataSet

            _errorMessage = ""
            Try

                If PN = "" Then

                End If

                strsql = "select jobid,partnumber,routing from apps.releasedJob where 1=1"
                If PN <> "" Then
                    strsql &= " and partnumber ='" & PN & "'"
                End If
                resultDS = _DBTrans.SQLToDataset("Job", strsql)
                Return resultDS
            Catch ex As Exception
                Throw ex
            End Try


        End Function

        Public Function UpdateJobStaus(ByVal jobname As String, ByRef TimeInterval As String) As Boolean
            Try

                Dim startTime As String = Date.Now.ToString("yyyy-MM-dd HH:mm:ss")
                Dim updateSql As String = _
                " update dbo.tbl_OracleJob " & _
                " set Status ='released' " & _
                "  where jobid = ' " & jobname & "'"
                _DBTrans.ExecuteSQL(updateSql)

                Dim endTime As String = Date.Now.ToString("yyyy-MM-dd HH:mm:ss")
                TimeInterval = "returnValue"
            Catch ex As Exception
                Return False

            End Try
            Return True
        End Function

        Public Function RemoveJob(ByVal jobid As String, ByVal partNumber As String) As Boolean
            Try
                _errorMessage = ""
                Dim sql As String
                Dim resultDS As New DataSet
                '  Dim resultString As String
                sql = " exec  maint.RemoveJob '" & jobid & "','" & partNumber & "'"
                _DBTrans.ExecuteSQL(sql)

            Catch ex As Exception

            End Try
        End Function
    End Class

End Namespace

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值