Page 1 sur 1

Gestion d'un document Profil

MessagePublié: 26 Déc 2004 à 01:07
par oguruma
Code : Tout sélectionner
Pour tester cette classe, exemple d'un agent

Option Public
Use "ProfileClass"

Sub Initialize
   Dim prf As Profile
   
   Set prf=New Profile("profile")
   
   Msgbox prf.getValue("chaine")
   Msgbox prf.getValue("rt")
   Msgbox prf.getValue("date")
   Msgbox prf.getValue("liste")
   Msgbox prf.getValue("case")
   Msgbox prf.getValue("nombre")
   
   
End Sub


Public Class Profile
   Private m_session As Notessession
   Private m_db As Notesdatabase
   Private m_docProfile As NotesDocument
   Private m_profile As String
   
   Sub New(p As String)
      m_profile=p
      Call init      
   End Sub
   
   Property Get DocProfile As NotesDocument
      Set DocProfile=m_docProfile
   End Property
   
   Private Sub init
      Set m_session=New notessession
      Set m_db=m_session.Currentdatabase
      Set m_docProfile = m_db.GetProfileDocument( m_profile)
   End Sub
   
   Public Function getValue(field As String) As Variant         
      getValue=m_docProfile.GetItemValue(field)(0)      
   End Function
   
   Public Function getValues(field As String) As Variant      
      getValues=m_docProfile.GetItemValue(field)
   End Function
   
   Public Function setValue(field As String, value As Variant)
      Call m_docProfile.ReplaceItemValue( field, value )
      Call m_docProfile.Save(True,False)
   End Function
   
End Class