CODES : hcms class file

[C] : Very Simple , I hope there won't be any doubt.now u can relate the other class files with this class.

Imports System.Data
Imports System.Data.SqlClient

Public Class hcms
' try to incorporate the concept of session here as well
Public Function authenticateuser(ByVal login As String, ByVal pwd As String) _
As Boolean
Dim objconn As New SqlConnection
objconn.ConnectionString = ConfigurationManager.ConnectionStrings("hcms").ConnectionString
Try
objconn.Open()
Dim cmd As New SqlCommand("select * from member_professional where loginid=" + login, objconn)
Dim dr As SqlDataReader = cmd.ExecuteReader
If dr.Read AndAlso dr("password") = pwd Then
authenticateuser = True
Else
authenticateuser = False
End If
Catch ex As SqlException
authenticateuser = False
objconn.Dispose()
Finally
objconn.Close()

End Try

End Function

Public Function authenticateadmin(ByVal login As String, ByVal pwd As String) _
As Boolean


Dim objconn As New SqlConnection
objconn.ConnectionString = ConfigurationManager.ConnectionStrings("hcms").ConnectionString

Try
objconn.Open()
Dim cmd As New SqlCommand("select * from admin_db where loginid=" + login, objconn)
Dim dr As SqlDataReader = cmd.ExecuteReader
If dr.Read AndAlso dr("password") = pwd Then
authenticateadmin = True
Else
authenticateadmin = False
End If
Catch ex As Exception
authenticateadmin = False
objconn.Dispose()
Finally
objconn.Close()
End Try

End Function


Public Function makeentry(ByVal insertelement As String) As Boolean
Dim objconn As New SqlConnection
objconn.ConnectionString = ConfigurationManager.ConnectionStrings("hcms").ConnectionString
Try
objconn.Open()
Dim strsql As String = insertelement
Dim objcmd As New SqlCommand
objcmd.Connection = objconn
objcmd.CommandText = strsql
objcmd.ExecuteNonQuery()
makeentry = True
Catch ex As Exception
makeentry = False
objconn.Dispose()
Finally
objconn.Close()
End Try

End Function




End Class

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.