Fórum Módulos em C# #13152
18/12/2009
0
Fernando Reis
Curtir tópico
+ 0Posts
18/12/2009
Fabio Mans
Class clsUser
Private _Distrito As String
Public Property Distrito() As String
Get
Return _Distrito
End Get
Set(ByVal value As String)
_Distrito = value
End Set
End Property
Private _Nome As String
Public Property Nome() As String
Get
Return _Nome
End Get
Set(ByVal value As String)
_Nome = value
End Set
End Property
Private _User As String
Public Property User() As String
Get
Return _User
End Get
Set(ByVal value As String)
_User = value
End Set
End Property
Private _CodigoRV As String
Public Property CodigoRV() As String
Get
Return _CodigoRV
End Get
Set(ByVal value As String)
_CodigoRV = value
End Set
End Property
Private _CodigoDistrito As String
Public Property CodigoDistrito() As String
Get
Return _CodigoDistrito
End Get
Set(ByVal value As String)
_CodigoDistrito = value
End Set
End Property
Private _Role As String
Public Property Role() As String
Get
Return _Role
End Get
Set(ByVal value As String)
_Role = value
End Set
End Property
Public Function ConfirmUser(ByVal strUser As String, ByVal strPwd As String) As clsUser
'instancia uma variavel string
Dim result As New clsUser()
'Instancia o clsBanco
Dim clsBanco As New clsBanco()
'Instancia o StringBuider
Dim strSql As New StringBuilder()
'Atribui os dados
strSql.Append("Select D.Distrito, F.CodigoRV,F.Nome, F.CodigoDistrito, F.Password,F.Group from tbl_Distrito as D inner join tbl_FuncDistrito as F ")
strSql.Append(" on F.CodigoDistrito = D.CodigoDistrito ")
strSql.Append((" Where Usuario ='" & strUser & "' and Password = '") + strPwd & "'")
'Instancia um oledbDatareader
Dim dr As OleDbDataReader = clsBanco.RetornaDataReader(strSql.ToString())
'Se for Read
If dr.Read() Then
result.Distrito = dr(0).ToString()
result.CodigoRV = dr(1).ToString()
result.Nome = dr(2).ToString()
result.CodigoDistrito = dr(3).ToString()
result.Role = dr(4).ToString()
End If
'retorna o result
Return result
End Function
End Class
End Namespace
Gostei + 0
19/12/2009
Fernando Reis
Não me expressei direito,
no Vb.net eu tenho a possibilidade de trabalhar com módulos, eu Utilizo estes para..................... por exemplo.......... tenho uma classe de login de usuários... entro com usuário e senha e preciso usar a regra de acesso ou o código de usuário em alguns forms...... o módulo resolve isto fácil, fácil,
como criar módulos em C#???
ou seja uma classe que armazene os dados em memória para que eu possa utilizar em qualquer form?????
Grato
Gostei + 0
21/12/2009
Fabio Mans
Gostei + 0
22/12/2009
Fernando Reis
o projeto é WindowsForm!
Gostei + 0
28/12/2009
Fabio Mans
Gostei + 0
05/01/2010
Fernando Reis
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)