uo_ljsmc.sru 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. $PBExportHeader$uo_ljsmc.sru
  2. forward
  3. global type uo_ljsmc from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_ljsmc from nonvisualobject
  7. end type
  8. global uo_ljsmc uo_ljsmc
  9. forward prototypes
  10. public function integer uf_getservicestatus (ref datawindow arg_dw, ref string arg_msg)
  11. public function integer uf_getinstancestatus (string arg_servername, ref datawindow arg_dw, ref string arg_msg)
  12. public function integer uf_update (string arg_servername, ref string arg_msg)
  13. end prototypes
  14. public function integer uf_getservicestatus (ref datawindow arg_dw, ref string arg_msg);Int rslt = 1
  15. uo_ljsmcproxy uo_proxy
  16. uo_proxy = Create uo_ljsmcproxy
  17. IF Not IsValid(arg_dw) THEN
  18. rslt = 0
  19. arg_msg = 'arg_dw无效'
  20. GOTO ext
  21. END IF
  22. oleobject ljsmc
  23. IF uo_proxy.getproxy(Ref ljsmc, Ref arg_msg) <> 1 THEN
  24. rslt = 0
  25. GOTO ext
  26. END IF
  27. oleobject rsp
  28. rsp = ljsmc.GetServiceStatus()
  29. IF Not IsNull(rsp.ErrMsg) THEN
  30. rslt = 0
  31. arg_msg = rsp.ErrMsg
  32. GOTO ext
  33. END IF
  34. arg_dw.Reset()
  35. Long cnt, i, row
  36. oleobject status
  37. cnt = rsp.ServicesStatusList.Count
  38. FOR i = 0 To cnt - 1
  39. status = rsp.ServicesStatusList.GetItem(i)
  40. row = arg_dw.InsertRow(0)
  41. arg_dw.Object.ServerName[row] = status.ServerName
  42. arg_dw.Object.DisplayName[row] = status.DisplayName
  43. arg_dw.Object.Description[row] = status.Description
  44. arg_dw.Object.Version[row] = status.Version
  45. arg_dw.Object.NewVersion[row] = status.NewVersion
  46. arg_dw.Object.downing[row] = status.downing
  47. arg_dw.Object.Auto[row] = status.Auto
  48. arg_dw.Object.SingleInstance[row] = status.SingleInstance
  49. NEXT
  50. ext:
  51. Destroy uo_proxy
  52. RETURN rslt
  53. end function
  54. public function integer uf_getinstancestatus (string arg_servername, ref datawindow arg_dw, ref string arg_msg);Int rslt = 1
  55. uo_ljsmcproxy uo_proxy
  56. uo_proxy = Create uo_ljsmcproxy
  57. IF Not IsValid(arg_dw) THEN
  58. rslt = 0
  59. arg_msg = 'arg_dw无效'
  60. GOTO ext
  61. END IF
  62. oleobject ljsmc
  63. IF uo_proxy.getproxy(Ref ljsmc, Ref arg_msg) <> 1 THEN
  64. rslt = 0
  65. GOTO ext
  66. END IF
  67. oleobject rsp
  68. rsp = ljsmc.GetInstanceStatus(arg_servername)
  69. IF Not IsNull(rsp.ErrMsg) THEN
  70. rslt = 0
  71. arg_msg = rsp.ErrMsg
  72. GOTO ext
  73. END IF
  74. arg_dw.Reset()
  75. Long cnt, i, row
  76. oleobject status
  77. cnt = rsp.InstanceStatusList.Count
  78. FOR i = 0 To cnt - 1
  79. status = rsp.InstanceStatusList.GetItem(i)
  80. row = arg_dw.InsertRow(0)
  81. arg_dw.Object.instance[row] = status.instanc
  82. arg_dw.Object.status[row] = status.status
  83. NEXT
  84. ext:
  85. Destroy uo_proxy
  86. RETURN rslt
  87. end function
  88. public function integer uf_update (string arg_servername, ref string arg_msg);Int rslt = 1
  89. uo_ljsmcproxy uo_proxy
  90. uo_proxy = Create uo_ljsmcproxy
  91. oleobject ljsmc
  92. IF uo_proxy.getproxy(Ref ljsmc, Ref arg_msg) <> 1 THEN
  93. rslt = 0
  94. GOTO ext
  95. END IF
  96. any rsp
  97. rsp = ljsmc.Update(arg_servername)
  98. IF Not IsNull(rsp) THEN
  99. rslt = 0
  100. arg_msg = rsp
  101. GOTO ext
  102. END IF
  103. ext:
  104. Destroy uo_proxy
  105. RETURN rslt
  106. end function
  107. on uo_ljsmc.create
  108. call super::create
  109. TriggerEvent( this, "constructor" )
  110. end on
  111. on uo_ljsmc.destroy
  112. TriggerEvent( this, "destructor" )
  113. call super::destroy
  114. end on