298 lines
6.8 KiB
Plaintext
298 lines
6.8 KiB
Plaintext
Set Talk Off
|
|
Set Deleted On
|
|
Set Century On
|
|
Set Date Dmy SHORT
|
|
Set Safety Off
|
|
Set Console Off
|
|
Set Seconds Off
|
|
Set Exclusive Off
|
|
Set Status Off
|
|
Set Status Bar Off
|
|
Set Hours To 24
|
|
Set Exact On
|
|
Set Ansi On
|
|
_Screen.WindowState= 2
|
|
Set NullDisplay To ""
|
|
*!* =================================================================
|
|
Public gnConnHandle, gnIdProgram, gnIdUtilizator, ;
|
|
gnIdClient, gbSpecial, gdData, gcAppName, gcAppPath, gcDataPath
|
|
Local lcPath
|
|
|
|
|
|
gnConnHandle = -1
|
|
gnIdUtilizator = 0
|
|
gnIdProgram = 0
|
|
gnIdClient = 0
|
|
gbSpecial = .F.
|
|
gdData = Date()
|
|
|
|
|
|
gcAppPath = Addbs(Justpath(Sys(16,0)))
|
|
gcAppName = Juststem(Sys(16,0))
|
|
Set Default To (gcAppPath)
|
|
|
|
gcDataPath = Addbs(gcAppPath) + [test.vcx]
|
|
Set Classlib To (gcDataPath)
|
|
|
|
|
|
|
|
|
|
*!* PUSH MENU _MSYSMENU
|
|
lcOnShutdown="ShutDown()"
|
|
On Shutdown &lcOnShutdown
|
|
On Error ErrorHandler(Error(),Program(),Lineno())
|
|
|
|
Push Menu _Msysmenu
|
|
|
|
|
|
*!* SETARI
|
|
gcSettingsFile = gcAppPath + 'settings.xml'
|
|
If !File(gcSettingsFile)
|
|
Messagebox('Nu exista fisierul ' + gcSettingsFile + '!',0+16,'Setari')
|
|
Shutdown()
|
|
Return
|
|
Endif
|
|
|
|
Xmltocursor(gcSettingsFile,"settings",512)
|
|
*!* SETARI ^
|
|
|
|
*!* PROGRAME_CHANGELOGS
|
|
gcProgrameChangeLogsFile = gcAppPath + 'programe_changelogs.xml'
|
|
If !File(gcProgrameChangeLogsFile)
|
|
Create Cursor programe_changelogs (id_program i, Program v(100), changelog v(200))
|
|
Else
|
|
Xmltocursor(gcProgrameChangeLogsFile,"programe_changelogs",512)
|
|
Endif
|
|
|
|
|
|
*!* PROGRAME_CHANGELOGS ^
|
|
|
|
Private goApp
|
|
goApp=Createobject("custom")
|
|
goApp.AddProperty("idutilizator",settings.idutilizator)
|
|
|
|
goExecutant = Createobject("Executor")
|
|
|
|
Do (gcAppPath + "meniu.mpr")
|
|
|
|
Do Form (gcAppPath + "frm_connect.scx")
|
|
|
|
If gnConnHandle<0
|
|
Shutdown()
|
|
Return
|
|
Endif
|
|
|
|
|
|
Set Procedure To proceduri.prg Additive && tasks, soft clienti
|
|
SET PROCEDURE TO proceduri_sql.prg ADDITIVE
|
|
SET PROCEDURE TO utile.prg ADDITIVE
|
|
SET PROCEDURE TO rapoarte.prg ADDITIVE
|
|
|
|
gcAppPath=Addbs(Justpath(Sys(16,0)))
|
|
gcAppName=Juststem(Sys(16,0))
|
|
Set Default To (gcAppPath)
|
|
lcPath = gcAppPath + "ferestre;" + ;
|
|
gcAppPath + "clase;" + ;
|
|
gcAppPath + "programe;" + ;
|
|
gcAppPath + "meniuri;" + ;
|
|
gcAppPath + "grafice;" + ;
|
|
gcAppPath + "date"
|
|
|
|
Set Path To (lcPath) Additive
|
|
|
|
Set Classlib To appwiz Additive && generare script
|
|
Set Classlib To comun Additive
|
|
Set Classlib To utility Additive
|
|
Set Classlib To Start Additive
|
|
Set Classlib To gen_script Additive
|
|
Set Classlib To execute_script Additive
|
|
Set Classlib To frm_script_aplicat Additive
|
|
|
|
Set Procedure To oproceduri_comune.prg Additive
|
|
Set Procedure To oinit_optiuni.prg Additive
|
|
Set Procedure To ini.prg Additive
|
|
Set Procedure To proceduri_genscript.prg Additive
|
|
|
|
lnSucces=editLucrare()&&in proceduri.prg
|
|
Read Events
|
|
|
|
*!* =================================================================
|
|
|
|
|
|
*!* =================================================================
|
|
*!* Release goApp
|
|
*!* _Screen.MaxButton=.T.
|
|
*!* _Screen.BorderStyle= 3
|
|
*!* _Screen.WindowState= 2
|
|
*!* Pop Menu _Msysmenu
|
|
|
|
*!* On Error
|
|
*!* On Shutdown
|
|
*!* =================================================================
|
|
|
|
|
|
*!* =================================================================
|
|
Function ErrorHandler(nError,cMethod,nLine)
|
|
Local lcErrorMsg,lcCodeLineMsg
|
|
|
|
Wait Clear
|
|
lcErrorMsg=Message()+Chr(13)+Chr(13)
|
|
lcErrorMsg=lcErrorMsg+"Method: "+cMethod
|
|
lcCodeLineMsg=Message(1)
|
|
If Between(nLine,1,10000) And Not lcCodeLineMsg="..."
|
|
lcErrorMsg=lcErrorMsg+Chr(13)+"Line: "+Alltrim(Str(nLine))
|
|
If Not Empty(lcCodeLineMsg)
|
|
lcErrorMsg=lcErrorMsg+Chr(13)+Chr(13)+lcCodeLineMsg
|
|
Endif
|
|
Endif
|
|
If Messagebox(lcErrorMsg,17,_Screen.Caption)#1
|
|
On Error
|
|
Return .F.
|
|
Endif
|
|
Endfunc
|
|
|
|
|
|
**=============================================
|
|
Function Shutdown
|
|
*!* If Type("goApp")=="O" And Not Isnull(goApp)
|
|
*!* Return goApp.OnShutDown()
|
|
*!* Endif
|
|
Do salveazaSetari
|
|
*DO inchide
|
|
Do deconectare
|
|
Cleanup()
|
|
Pop Menu _Msysmenu
|
|
*!* If _vfp.StartMode !=0
|
|
*!* Quit
|
|
*!* Endif
|
|
Endfunc
|
|
**=============================================
|
|
|
|
Function Cleanup
|
|
|
|
If Cntbar("_msysmenu")=7
|
|
Return
|
|
Endif
|
|
On Error
|
|
On Shutdown
|
|
Set Classlib To
|
|
Set Path To
|
|
Clear All
|
|
*Close All
|
|
Pop Menu _Msysmenu
|
|
Clear Events
|
|
Return
|
|
Endfunc
|
|
|
|
**=============================================
|
|
|
|
Procedure deconectare
|
|
Local lcCaption, lnSucces
|
|
|
|
lnSucces = -1
|
|
|
|
If gnConnHandle > 0
|
|
lnSucces = SQLDisconnect(gnConnHandle)
|
|
Endif
|
|
|
|
Return lnSucces
|
|
Endproc && deconectare
|
|
|
|
**=============================================
|
|
|
|
Procedure conectare
|
|
Parameters tcHost, tcUser, tcPassword
|
|
|
|
gnConnHandle = SQLConnect(tcHost, tcUser, tcPassword)
|
|
If gnConnHandle < 0
|
|
Aerror(laEroare)
|
|
Messagebox(laEroare(2))
|
|
Endif
|
|
|
|
Return gnConnHandle
|
|
Endproc && conectare
|
|
|
|
***=====================================================
|
|
Define Class Executor As Relation
|
|
cEroare = []
|
|
|
|
Procedure executaSql
|
|
Lparameters cmdsql,crsName, tlDontShowError
|
|
Local lnSucces
|
|
|
|
lnSucces = -1
|
|
|
|
If Pcount()<2
|
|
crsName=""
|
|
Endif
|
|
*LPARAMETERS cmdsql, crsname
|
|
If gnConnHandle > 0
|
|
lnSucces=SQLExec(gnConnHandle,cmdsql,crsName)
|
|
|
|
If lnSucces < 0
|
|
Aerror(laEroare)
|
|
This.cEroare = laEroare(2)
|
|
If !m.tlDontShowError
|
|
Messagebox(This.cEroare)
|
|
Endif
|
|
Endif
|
|
Endif
|
|
|
|
|
|
Return lnSucces
|
|
Endproc
|
|
Enddefine && Executor
|
|
|
|
**======================================
|
|
|
|
Procedure salveazaSetari
|
|
|
|
If Used('settings')
|
|
Replace settings.idutilizator With goApp.idutilizator In settings
|
|
Cursortoxml("SETTINGS",gcSettingsFile,1,512,0,"1")
|
|
Endif
|
|
If Used('programe_changelogs')
|
|
Cursortoxml("programe_changelogs", gcProgrameChangeLogsFile,1,512,0,"1")
|
|
Endif
|
|
Endproc
|
|
|
|
**======================================
|
|
** actualizeaza programe_changelogs cu calea catre fisierul changelog pentru un id_program
|
|
Procedure UpdateProgrameChangeLogs
|
|
Lparameters tnIdProgram, tcProgram, tcChangeLog
|
|
|
|
Local lcSelect
|
|
lcSelect = Select()
|
|
|
|
If Used('programe_changelogs') And !Empty(tcChangeLog)
|
|
Select programe_changelogs
|
|
Locate For id_program = tnIdProgram
|
|
If Found()
|
|
Replace changelog With Alltrim(tcChangeLog)
|
|
Else
|
|
Insert Into programe_changelogs(id_program, Program, changelog) Values (tnIdProgram, Alltrim(tcProgram), Alltrim(tcChangeLog))
|
|
Endif
|
|
Endif
|
|
Select (lcSelect)
|
|
Endproc
|
|
|
|
**======================================
|
|
** intoarce calea catre fisierul changelog in functie de id_program
|
|
Function GetChangeLogByIdProgram
|
|
Lparameters tnIdProgram
|
|
Local lcSelect, lcChangelog
|
|
lcSelect = Select()
|
|
lcChangelog = ""
|
|
|
|
If Used('programe_changelogs')
|
|
Select programe_changelogs
|
|
Locate For id_program = tnIdProgram
|
|
If Found()
|
|
lcChangelog = Alltrim(changelog)
|
|
Endif
|
|
Endif
|
|
|
|
Select (lcSelect)
|
|
Return lcChangelog
|
|
Endfunc
|