uo_sys_funcpwr.sru 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. $PBExportHeader$uo_sys_funcpwr.sru
  2. forward
  3. global type uo_sys_funcpwr from nonvisualobject
  4. end type
  5. end forward
  6. global type uo_sys_funcpwr from nonvisualobject autoinstantiate
  7. end type
  8. type variables
  9. string ins_msg
  10. long ins_funcid
  11. end variables
  12. forward prototypes
  13. public function integer del (long funcid)
  14. public subroutine init_ds_funcinfo ()
  15. public function integer save (long funcid, long parentid, long mainid, long functype, string treename, string menuname, integer if_use, integer sortflag, integer versiontype, integer worktype, integer moduleid)
  16. end prototypes
  17. public function integer del (long funcid);
  18. Long rslt = 1
  19. DELETE sys_func_pwr
  20. Where funcid = :funcid;
  21. IF sqlca.SQLCode <> 0 OR sqlca.SQLNRows = 0 THEN
  22. ins_msg = '保存失败>'+sqlca.SQLErrText
  23. rslt = 0
  24. GOTO ext
  25. END IF
  26. ins_funcid = funcid
  27. ext:
  28. IF rslt = 0 THEN
  29. ROLLBACK;
  30. ELSE
  31. COMMIT;
  32. END IF
  33. RETURN rslt
  34. end function
  35. public subroutine init_ds_funcinfo ();
  36. //datastore
  37. sys_ds_funcinfo = Create datastore
  38. sys_ds_funcinfo.DataObject = 'ds_sys_funcpwr_setting'
  39. sys_ds_maininfo = Create datastore
  40. sys_ds_maininfo.DataObject = 'ds_sys_funcpwr'
  41. sys_ds_userinfo = Create datastore
  42. sys_ds_userinfo.DataObject = 'ds_sys_funcpwr'
  43. sys_ds_shortcutinfo = Create datastore
  44. sys_ds_shortcutinfo.DataObject = 'ds_sys_funcpwr'
  45. //开发状态下, 刷新最新的数据
  46. IF Handle(This) = 0 THEN
  47. Int li_development
  48. SELECT top 1 development
  49. INTO :li_development
  50. From sys_DB_version;
  51. IF sqlca.SQLCode <> 0 THEN
  52. li_development = 0
  53. END IF
  54. IF li_development = 1 THEN
  55. sys_ds_funcinfo.SetTransObject(sqlca)
  56. sys_ds_maininfo.SetTransObject(sqlca)
  57. sys_ds_userinfo.SetTransObject(sqlca)
  58. sys_ds_shortcutinfo.SetTransObject(sqlca)
  59. sys_ds_funcinfo.Retrieve(-1)
  60. sys_ds_maininfo.Retrieve()
  61. sys_ds_userinfo.Retrieve()
  62. sys_ds_shortcutinfo.Retrieve()
  63. END IF
  64. END IF
  65. end subroutine
  66. public function integer save (long funcid, long parentid, long mainid, long functype, string treename, string menuname, integer if_use, integer sortflag, integer versiontype, integer worktype, integer moduleid);
  67. long rslt=1
  68. long ls_newid=0
  69. // funcid parentid mainid functype treename menuname if_use sortflag
  70. if funcid=0 then //add
  71. ls_newid = f_sys_scidentity(0,"sys_func_pwr","funcid",ins_msg,true,sqlca)
  72. if ls_newid <= 0 then
  73. rslt = 0
  74. goto ext
  75. end if
  76. funcid=ls_newid
  77. INSERT INTO sys_func_pwr
  78. ( funcid,
  79. parentid,
  80. mainid,
  81. functype,
  82. treename,
  83. menuname,
  84. if_use,
  85. sortflag,
  86. versiontype,
  87. worktype,
  88. moduleid)
  89. VALUES ( :funcid,
  90. :parentid,
  91. :mainid,
  92. :functype,
  93. :treename,
  94. :menuname,
  95. :if_use,
  96. :sortflag,
  97. :versiontype,
  98. :worktype,
  99. :moduleid) ;
  100. if sqlca.sqlcode<>0 then
  101. if pos(lower(sqlca.SQLErrText),'pk_sys_func_pwr') > 0 then
  102. ins_msg = '插入权限树操作失败,关键字重复'
  103. else
  104. ins_msg='保存失败>'+sqlca.sqlerrtext
  105. end if
  106. rslt=0
  107. goto ext
  108. end if
  109. else //edit
  110. update sys_func_pwr
  111. set parentid=:parentid,
  112. mainid=:mainid,
  113. functype=:functype,
  114. treename=:treename,
  115. menuname=:menuname,
  116. if_use=:if_use,
  117. sortflag=:sortflag,
  118. versiontype = :versiontype,
  119. worktype = :worktype,
  120. moduleid = :moduleid
  121. where funcid=:funcid;
  122. if sqlca.sqlcode<>0 or sqlca.sqlnrows=0 then
  123. if pos(lower(sqlca.SQLErrText),'pk_sys_func_pwr') > 0 then
  124. ins_msg = '插入权限树操作失败,关键字重复'
  125. else
  126. ins_msg='保存失败>'+sqlca.sqlerrtext
  127. end if
  128. rslt=0
  129. goto ext
  130. end if
  131. end if
  132. ins_funcid=funcid
  133. ext:
  134. if rslt=0 then
  135. rollback;
  136. else
  137. commit;
  138. end if
  139. return rslt
  140. end function
  141. on uo_sys_funcpwr.create
  142. call super::create
  143. TriggerEvent( this, "constructor" )
  144. end on
  145. on uo_sys_funcpwr.destroy
  146. TriggerEvent( this, "destructor" )
  147. call super::destroy
  148. end on