jxcmanage.vb
上传用户:wj57717022
上传日期:2014-12-16
资源大小:4093k
文件大小:29k
- Imports System.Data
- Imports System.Data.SqlClient
- Imports System.Data.SqlTypes
- Imports System.Xml
- Imports System.Collections
- Imports System.Diagnostics
- Imports System.Configuration
- Public Class jxcmanage
- Private cn As SqlConnection
- Private cmd As SqlCommand
- Private da As SqlDataAdapter
- Private tran As SqlTransaction
- Private cmdBuilder As SqlCommandBuilder
- Private privateModuleName As String
- Private Const privateExceptionMessage As String = "数据应用错误。错误信息可能记录在事件日志中"
- Public Function selectDb(ByVal sql As String, ByVal dataSet As DataSet) As DataSet
- privateModuleName = Me.GetType.ToString
- If dataSet Is Nothing Then
- dataSet = New DataSet
- End If
- cn = New SqlConnection(ConfigurationSettings.AppSettings.Get("constr"))
- cmd = New SqlCommand(sql, cn)
- da = New SqlDataAdapter(cmd)
- cmdBuilder = New SqlCommandBuilder(da)
- da.Fill(dataSet)
- Return dataSet
- End Function
- Public Function getinfoes(ByVal strqueryid As String) As String
- Dim strOrderId As String
- strOrderId = strqueryid
- Return strOrderId
- End Function
- Public Sub kcql(ByVal strquery As String)
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Try
- Dim localoutputserver As New DataAccess.DataObject(privateconnectionstring)
- localoutputserver.runSQL(strquery)
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Throw ExceptionObject
- End Try
- End Sub
- Public Function getdscp(ByVal strquery As String) As DataSet
- Dim localDsOut As DataSet
- Dim paramsStoredProcedure As String = "Cpquery"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@Number", strquery, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localDsOut = localoutserver.runSPDataSet(paramsStoredProcedure)
- Return localDsOut
- Catch
- Exit Function
- End Try
- End Function
- Public Function runSql(ByVal strQuery As String) As Data.DataSet
- Dim dsCustomerId As Data.DataSet
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Try
- Dim localoutputserver As New DataAccess.DataObject(privateconnectionstring)
- dsCustomerId = localoutputserver.runSQLDataSet(strQuery)
- Return dsCustomerId
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Throw ExceptionObject
- End Try
- End Function
- Public Function QueryID(ByVal strquery As String, ByVal spname As String) As Data.DataSet
- Dim dsQuery As Data.DataSet
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Try
- Dim localoutputserver As New DataAccess.DataObject(privateconnectionstring)
- localoutputserver.AddParameter("@strquery", strquery, DataAccess.DataObject.SQLDataType.SQLChar, Data.ParameterDirection.Input)
- dsQuery = localoutputserver.runSPDataSet(spname)
- Return dsQuery
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Throw ExceptionObject
- End Try
- End Function
- Public Function returncount(ByVal spname As String) As Integer
- Dim localDsOut As ArrayList
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- Try
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(spname)
- Return CInt(localDsOut.Item(0))
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Exit Function
- End Try
- End Function
- Public Function insertcp(ByVal mednumber As String, ByVal medname As String, ByVal medrule As String, ByVal medtype As String, ByVal unit As String, ByVal price As Decimal, ByVal sprice As Decimal, ByVal kl As Decimal, ByVal address As String, ByVal product As String, ByVal avaid As String, ByVal Pprice As Decimal, ByVal Lprice As Decimal, ByVal jprice As Decimal, ByVal zprice As Decimal) As Integer
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "insertcp"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@mednumber", mednumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@medname", medname, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@medrule", medrule, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@medtype", medtype, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@unit", unit, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@price", price, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@sprice", sprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@kl", kl, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@address", address, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@product", product, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@avaid", avaid, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@Pprice", Pprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@Lprice", Lprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@jprice", Pprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@zprice", Lprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- Return CInt(localDsOut.Item(0))
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Exit Function
- End Try
- End Function
- Public Function insertkh(ByVal custnumber As String, ByVal custname As String, ByVal custXz As String, ByVal custAddress As String, ByVal custtele As String, ByVal custSj As String, ByVal customer As String) As Integer
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "insertkh"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@custnumber", custnumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custname", custname, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custXz", custXz, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custAddress", custAddress, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custtele", custtele, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custSj", custSj, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@customer", customer, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- Return CInt(localDsOut.Item(0))
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Exit Function
- End Try
- End Function
- Public Function updatecp(ByVal mednumber As String, ByVal medname As String, ByVal medrule As String, ByVal medtype As String, ByVal unit As String, ByVal price As Decimal, ByVal sprice As Decimal, ByVal kl As Decimal, ByVal address As String, ByVal product As String, ByVal avaid As String, ByVal Pprice As Decimal, ByVal Lprice As Decimal, ByVal jprice As Decimal, ByVal zprice As Decimal) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "updatecp"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@mednumber", mednumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@medname", medname, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@medrule", medrule, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@medtype", medtype, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@unit", unit, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@price", price, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@sprice", sprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@kl", kl, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@address", address, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@product", product, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@avaid", avaid, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@Pprice", Pprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@Lprice", Lprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@jprice", Pprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@zprice", Lprice, DataAccess.DataObject.SQLDataType.SQLDecimal, 10, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function updatekh(ByVal custnumber As String, ByVal custname As String, ByVal custXz As String, ByVal custAddress As String, ByVal custtele As String, ByVal custSj As String, ByVal customer As String) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "updatekh"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@custnumber", custnumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custname", custname, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custXz", custXz, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custAddress", custAddress, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custtele", custtele, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@custSj", custSj, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@customer", customer, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function deletekh(ByVal custnumber As String) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "deletekh"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@custnumber", custnumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function deletecp(ByVal mednumber As String) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "deletecp"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@mednumber", mednumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- 'CInt(localDsOut.Item(0))
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function deletepscenter(ByVal mednumber As String) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "deletepscenter"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@mednumber", mednumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- 'CInt(localDsOut.Item(0))
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function deleteMdManager(ByVal mednumber As String) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "deleteMdManager"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@mednumber", mednumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- 'CInt(localDsOut.Item(0))
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function deleterk(ByVal billnumber As String, ByVal number As Int16, ByVal mednumber As String) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "deleterk"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@billnumber", billnumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@number", number, DataAccess.DataObject.SQLDataType.SQLInteger, 8, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@mednumber", mednumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- 'CInt(localDsOut.Item(0))
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function deleteck(ByVal billnumber As String, ByVal number As Int16, ByVal mednumber As String) As Boolean
- Dim localDsOut As ArrayList
- Dim paramsStoredProcedure As String = "deleteck"
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@billnumber", billnumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@number", number, DataAccess.DataObject.SQLDataType.SQLInteger, 8, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@mednumber", mednumber, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput(paramsStoredProcedure)
- 'CInt(localDsOut.Item(0))
- Return True
- Catch ExceptionObject As Exception
- LogException(ExceptionObject)
- Return False
- Exit Function
- End Try
- End Function
- Public Function returndataset(ByVal str As String, ByVal tablename As String) As DataSet
- Dim dsreturn As DataSet
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- dsreturn = localoutserver.runSQLDataSet(str, tablename)
- Return dsreturn
- End Function
- Public Function returnDataReader(ByVal str As String) As SqlDataReader
- Dim returndr As SqlDataReader
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- returndr = localoutserver.runSQLDataReader(str)
- Return returndr
- End Function
- Public Function updatedataset(ByVal str As String, ByVal tablename As String, ByVal dsupdate As DataSet, ByVal rowstate As DataRowState) As Boolean
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim doupdate As New DataAccess.DataObject(privateconnectionstring)
- If doupdate.updatedataset(str, tablename, dsupdate, rowstate) = True Then
- Return True
- Else
- Return False
- End If
- End Function
- Public Function maxNumber(ByVal strquery As String) As Integer
- Dim iMax As Integer
- Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings.Get("constr"))
- con.Open()
- Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand(strquery, con)
- Dim drd As SqlClient.SqlDataReader = cmd.ExecuteReader
- Do While drd.Read()
- If drd.IsDBNull(0) = True Then
- iMax = 0
- Else
- iMax = drd.GetValue(0)
- End If
- Loop
- Return iMax
- End Function
- Public Function maxint(ByVal strquery As String) As Integer
- Dim iMax As Integer
- Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings.Get("constr"))
- con.Open()
- Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("exec MaxInt " & strquery, con)
- Dim drd As SqlClient.SqlDataReader = cmd.ExecuteReader
- Do While drd.Read()
- If drd.IsDBNull(0) = True Then
- iMax = 0
- Else
- iMax = drd.GetValue(0)
- End If
- Loop
- Return iMax
- End Function
- Public Function menuuser(ByVal name As String, ByVal key As String, ByVal value As String) As Integer
- Dim localDsOut As ArrayList
- Try
- Dim privateconnectionstring As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim localoutserver As New DataAccess.DataObject(privateconnectionstring)
- localoutserver.AddParameter("@name", name, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@Key", key, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@value", value, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- localoutserver.AddParameter("@count", , DataAccess.DataObject.SQLDataType.SQLInteger, , ParameterDirection.Output)
- localDsOut = localoutserver.runSPOutput("insertmenu")
- Return CInt(localDsOut.Item(0))
- Catch
- Exit Function
- End Try
- End Function
- Public Function maxkhint(ByVal strquery As String) As Integer
- Dim iMax As Integer
- Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings.Get("constr"))
- con.Open()
- Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("exec MaxkhInt " & strquery, con)
- Dim drd As SqlClient.SqlDataReader = cmd.ExecuteReader
- Do While drd.Read()
- If drd.IsDBNull(0) = True Then
- iMax = 0
- Else
- iMax = drd.GetValue(0)
- End If
- Loop
- Return iMax
- End Function
- Public Function userinfo(ByVal struser As String, ByVal strpassword As String) As Integer
- Dim iMax As Integer
- Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings.Get("constr"))
- con.Open()
- Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("select count(*) from wz_mm where 操作员='" & struser & "'and 密码='" & strpassword & "'", con)
- Dim drd As SqlClient.SqlDataReader = cmd.ExecuteReader
- Do While drd.Read()
- If drd.IsDBNull(0) = True Then
- iMax = 0
- Else
- iMax = drd.GetValue(0)
- End If
- Loop
- Return iMax
- End Function
- Public Function selectcompany(ByVal strquery As String) As String
- Dim localdr As New DataAccess.DataObject(ConfigurationSettings.AppSettings.Get("constr"))
- Dim drd As System.Data.SqlClient.SqlDataReader = localdr.runSQLDataReader(strquery)
- Do While drd.Read()
- If drd.IsDBNull(0) = True Then
- Return ""
- Else
- Return drd.GetString(0)
- End If
- Loop
- End Function
- Public Function sumcount(ByVal strquery As String) As String
- Dim localdr As New DataAccess.DataObject(ConfigurationSettings.AppSettings.Get("constr"))
- Dim drd As System.Data.SqlClient.SqlDataReader = localdr.runSQLDataReader(strquery)
- Do While drd.Read()
- If drd.IsDBNull(0) = True Then
- Return ""
- Else
- Return drd.GetValue(0)
- End If
- Loop
- End Function
- Public Function selectuser(ByVal strquery As String)
- Dim localdr As New DataAccess.DataObject(ConfigurationSettings.AppSettings.Get("constr"))
- Dim drd As System.Data.SqlClient.SqlDataReader = localdr.runSQLDataReader(strquery)
- Return drd
- End Function
- Public Function selectbill(ByVal strquery As String) As String
- Dim privateConnectionString As String = ConfigurationSettings.AppSettings.Get("constr")
- Dim arrls As New DataAccess.DataObject(privateConnectionString)
- Dim arrayls As New ArrayList
- arrls.AddParameter("@Identifier", strquery, DataAccess.DataObject.SQLDataType.SQLChar, 50, Data.ParameterDirection.Input)
- arrls.AddParameter("@BillNumber", , DataAccess.DataObject.SQLDataType.SQLChar, 50, ParameterDirection.Output)
- arrayls = arrls.runSPOutput("BillNumber")
- Return CStr(arrayls.Item(0))
- End Function
- Public Sub cancelbill(ByVal strquery As String)
- Dim con As SqlClient.SqlConnection = New SqlClient.SqlConnection(ConfigurationSettings.AppSettings.Get("constr"))
- con.Open()
- Dim cmd As SqlClient.SqlCommand = New SqlClient.SqlCommand("CancelBillNumber", con)
- cmd.CommandType = CommandType.StoredProcedure
- Dim prm As SqlClient.SqlParameter = cmd.Parameters.Add("@BillNumber", SqlDbType.NChar, 20)
- prm.Value = strquery
- cmd.ExecuteNonQuery()
- End Sub
- Private Sub LogException(ByRef ExceptionObject As Exception)
- Dim EventLogMessage As String
- Try
- EventLogMessage = "An error occured in the following module: " & privateModuleName & _
- " The Source was: " & ExceptionObject.Source & vbCrLf & _
- " With the Message: " & ExceptionObject.Message & vbCrLf & _
- " Stack Tace: " & ExceptionObject.StackTrace & vbCrLf & _
- " Target Site: " & ExceptionObject.TargetSite.ToString
- Dim localEventLog As New EventLog("Application")
- localEventLog.WriteEntry(privateModuleName, EventLogMessage, EventLogEntryType.Error, 55)
- Catch EventLogException As Exception
- Throw New Exception(privateExceptionMessage & " - EventLog Error: " & EventLogException.Message, EventLogException)
- End Try
- End Sub
- Private Declare Auto Function InternetGetConnectedState Lib "wininet.dll" Alias "InternetGetConnectedState" _
- (ByRef connectionDescription As Integer, ByVal reservedValue As Integer) As Boolean
- '连机与脱机
- 'MessageBox.Show(IsConnected().ToString())
- Public Shared Function IsConnected() As Boolean
- Dim connectionDescription As Integer = 0
- Return InternetGetConnectedState(connectionDescription, 0)
- End Function
- Private Sub Dispose(ByVal disposing As Boolean)
- 'CODEGEN: 此过程是 Web 服务设计器所必需的
- '不要使用代码编辑器修改它。
- If disposing Then
- If Not (Me Is Nothing) Then
- Me.Dispose(False)
- End If
- End If
- Me.Dispose(disposing)
- End Sub
- End Class