Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Application that lets network know it is still present
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00342254
Message ID:
00410948
Vues:
26
>Hi Bret! I found that you had a similar problem as I am currently having and was hoping you'd get me started in the right direction.
>
>We have a client server application in which we need to update one of the fields with a TimeStamp value. For consistency this timestamp should be from the server machine. Whats the best way to accomplish this?
>
>Thank you for you time!

My application can be run locally against our network files or it can be run independent of our network and the user will have all the data files on their machine. So when I determine that the user is running against my network resources then I call a method in the oNetwork object called log_in. This method will add a timer to the _screen object that will fire off every 10 minutes:
* Was the user logged in OK, if so then we will start the timer that will update
* the log file every 10 minutes with their datetime
IF lllog_flag
  * Before we add our timer we need to save what current class library is set
  * just in case 
  LOCAL lcSaveClassLib
  lcSaveClassLib = SET('CLASSLIB')
  SET CLASSLIB TO "c40Utilities"
  * Lets add our timer to the active screen form
  _screen.addobject("oUpdateLogUserTimer","c40UpdateLogUserTimer",m_procid,m_userid)
  * Reset our library
  SET CLASSLIB TO &lcSaveClassLib
ENDIF
The code that fires off in the timer every 10 minutes is:
IF USED("log_user")
  SELECT log_user
  SET ORDER TO TAG "proc_id"
ELSE
  SELECT 0
  USE log_user.DBF AGAIN ALIAS log_user ORDER TAG "proc_id"
ENDIF

* First lets get a synq date time from the novell sever
* as the users computer may have there clock off
lcMyServerFile = oData.Code40SysDir+"\TEMP\"+SUBSTR(sys(2015),3,8)+'.CLK'
handle=fcreate(lcMyServerFile)
=fclose(handle)
lcDate = fdate(lcMyServerFile)
lcTime = ftime(lcMyServerFile)
erase (lcMyServerFile)

SELECT log_user
LOCATE

*
* Locate for the user's record with the properties of this class that were set up in the
* init of the class
LOCATE FOR (log_user.user_id = THIS.cUserId AND log_user.proc_id = THIS.cProcessID) AND NOT DELETED()
*
IF NOT EOF()
  * We will use the time from the server
  REPLACE log_user.activetime WITH CTOT(DTOC(lcDate)+' '+lcTime)
  lllog_flag = .T.
ELSE
  * We have not decieded what to do here yet, if the users record is not found
  lllog_flag = .T.
ENDIF
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform