project BLF > class TApplication > method DeactivateSOD


Parameters


ocMessageoutputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
method TApplication.ExecuteAction


program code (program1/tapplication.p)

/* ================================================================================ */
/* Log the deactivation in vcLogFile                                                */
/* ================================================================================ */
<M-17 run GetLogFileLocation  (output vcLogFile (ocLogFile)) in TApplication>

output to value (vcLogFile) append.
put '':U  skip.
put unformatted string (now) '> ':U
    'TApplication.DeactivateSOD: started.' skip.
output close.

Assign vcSessionLogin = 'mfg':U
       vcSessionPwd = '':U.

<Q-22 assign vlFcQueryRecordsAvailable = UserPrim (NoCache)
   (input 0, (UsrId)
    input 0, (UsrLogin)) in BUser>
If vlFcQueryRecordsAvailable <> False
Then Do:
    <Q-70 run SystBySystAdminUser (all) (Read) (NoCache)  (output dataset tqSystBySystAdminUser) in BSystem>
    Find First tqSystBySystAdminUser No-error.
    If Available tqSystBySystAdminUser
    Then Do: 
        Assign vcSessionLogin = tqSystBySystAdminUser.tcUsrLogin.
        assign vhFcComponent = ?.
        <M-98 run MainBlock  () in TCrypt>
        assign vhCrypthandle = vhFcComponent.
        
        <M-44 run DecryptString
           (input  tqSystBySystAdminUser.tcSystAdminUserPwd (icInputString), 
            output vcSessionPwd (ocOutputString), 
            output viFcReturnSuper (oiReturnStatus)) in TCrypt>   
                 
        run gipr_DeleteProcedure in vhCrypthandle.
        delete procedure vhCrypthandle.
    End.
End.

/* ================================================================================ */
/* Logging                                                                          */
/* ================================================================================ */
output to value (vcLogFile) append.
put unformatted string (now) '> ':U
    'TApplication.DeactivateSOD: Starting session and establishing a login for ':U vcSessionLogin  skip.
output close.

/* Start and Open Session, login as mfg */
<I-2 {tFcStartAndOpenInstance
     &CLASS                = "Session"
     &SESSIONID            = "0"}>

if viDebugLevel > 0
then do:
    <M-59 run SetDebugLevel  (input  viDebugLevel (iiDebugLevel)) in Session>
end.

<M-10 run Login
   (input  vcSessionLogin (icLogin), 
    input  vcSessionPwd (icPassword), 
    input  '' (icExtra), 
    output vlValid (olValid), 
    output viFcReturnSuper (oiReturnStatus)) in Session>

/* ================================================================================ */
/* Logging                                                                          */
/* ================================================================================ */
output to value (vcLogFile) append.
put unformatted string (now) '> ':U
    'TApplication.DeactivateSOD: Login executed (viFcReturnSuper=' viFcReturnSuper ', vlValid=' vlValid ').' skip.
output close.

if viFcReturnSuper < 0 or
   not vlValid
then do:
    assign oiReturnStatus = viFcReturnSuper
           ocMessage      =  trim( #T-84'Session.Login failed:':255(8914)T-84#) + 
                                     ' Login=' + vcSessionLogin + 
                                     ', ReturnStatus=' + string (viFcReturnSuper) +
                                     ', Valid=' + string (vlValid).

    <I-41 {tFcCloseAndStopInstance
         &CLASS           = "Session"}>
    return.
end.

/* ================================================================================ */
/* Logging                                                                          */
/* ================================================================================ */
output to value (vcLogFile) append.
put unformatted string (now) '> ':U
    'TApplication.DeactivateSOD: Starting BSystem and running ActivateSOD (no).' skip.
output close.

<I-28 {tFcStartAndOpenInstance
     &CLASS                = "BSystem"
     &SESSIONID            = "viSessionTAppID"}>

<M-7 run ActivateSOD
   (input  no (ilActive), 
    output viFcReturnSuper (oiReturnStatus)) in BSystem>
if viFcReturnSuper <> 0 
then oiReturnStatus = viFcReturnSuper.

<I-76 {tFcCloseAndStopInstance
     &CLASS           = "BSystem"}>
             
<I-61 {tFcCloseAndStopInstance
     &CLASS           = "Session"}>
   
/* ================================================================================ */
/* Logging                                                                          */
/* ================================================================================ */
output to value (vcLogFile) append.
put unformatted string (now) '> ':U
    'TApplication.DectivateSOD: ended (Returnstatus= ':U oiReturnStatus ').' skip.
output close.