project QadFinancials > class BBaseDaemonProcessor > method UpdateSessionTimeStamps


Parameters


iiSessionIDinputinteger
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method BBaseDaemonProcessor.LoopForWork


program code (program/bbasedaemonprocessor.p)

<ANCESTOR-CODE>

if iiSessionID = 0 or iiSessionID = ?
then return.

<M-58 run StartPersistence
   (output vhPL (ohPersistence), 
    output viFcReturnSuper (oiReturnStatus)) in BBaseDaemonProcessor>        
if viFcReturnSuper <> 0
then oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then return.

/* =========================================================== */
/* Get the GlobalSessionID of the session                      */
/* =========================================================== */
assign vcSessionID           = string (iiSessionID)
       vcThisGlobalSessionID = ''.

<Q-84 run FcSessionByAll (all) (Read) (NoCache)
   (input iiSessionID, (SessionInstanceId)
    input ?, (GlobalSessionNeedsUpdate)
    output dataset tqFcSessionByAll) in BFcSession>
for each tqFcSessionByAll :
    assign vcThisGlobalSessionID = tqFcSessionByAll.tcGlobalSessionId.
end.

if vcThisGlobalSessionID <> ''
then do:
    if com.qad.qra.config.QraConfig:IsEnabled
    then do:
        <I-15 {bFcStartAndOpenInstance
             &ADD-TO-TRANSACTION   = "False"
             &CLASS                = "PAuthenticationQRA"}>
             
        <M-13 run KeepAlive
           (input  vcThisGlobalSessionId (icGlobalSessionId), 
            input  yes (ilUpdateSession), 
            output vlIsAlive (olIsActive), 
            output viFcReturnSuper (oiReturnStatus)) in PAuthenticationQRA>

        <I-63 {bFcCloseAndStopInstance
             &CLASS           = "PAuthenticationQRA"}>
    end.
    else do:
        /* =========================================================== */
        /* Update the TimeStamps in sess_mstr                          */
        /* =========================================================== */
        session:timezone = 0.
        vcQuery = "for each sess_mstr where sess_mstr.sess_mfguser = '":U + vcThisGlobalSessionID + "'":U.
        vhFcComponent = vhPL.
        <M-51 run WriteDirect
           (input  'sess_mstr':U (icTableName), 
            input  vcQuery (icPrepare), 
            input  'sess_date,sess_time' (icFieldList), 
            input  't,i' (icFieldListDataTypes), 
            input  string (today) + chr (2) + string(Time) (icAbsolute), 
            input  '' (icIncremental), 
            input  {&TARGETPROCEDURE} (ihClass), 
            input  vcUserLogin (icUserLogin), 
            output viFcReturnSuper (oiReturnStatus)) in persistence>
    end.
    
    /* =========================================================== */
    /* Update the TimeStamps in fcSession                          */
    /* =========================================================== */
    vcQuery = "for each fcSession where fcSession.SessionInstance_ID = ":U + vcSessionID.
    vhFcComponent = vhPL.
    <M-24 run WriteDirect
       (input  'fcSession':U (icTableName), 
        input  vcQuery (icPrepare), 
        input  'GlobalSessionNeedsUpdate,SessionLastCheckTime,SessionLastCheckDate,GlobalSessionLastCheckTime,GlobalSessionLastCheckDate':U (icFieldList), 
        input  'l,i,t,i,t':U (icFieldListDataTypes), 
        input  'false' + chr(2) + string(Time) + chr(2) + string(Today)  + chr(2) + string(Time) + chr(2) + string(Today) (icAbsolute), 
        input  '' (icIncremental), 
        input  {&TARGETPROCEDURE} (ihClass), 
        input  vcUserLogin (icUserLogin), 
        output viFcReturnSuper (oiReturnStatus)) in persistence>
    
    session:timezone = viTimeOffset.
end.