w_system_import_setting.srw 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. $PBExportHeader$w_system_import_setting.srw
  2. forward
  3. global type w_system_import_setting from window
  4. end type
  5. type cb_exit from commandbutton within w_system_import_setting
  6. end type
  7. type cb_backup from commandbutton within w_system_import_setting
  8. end type
  9. type cb_ch from commandbutton within w_system_import_setting
  10. end type
  11. type sle_filename from singlelineedit within w_system_import_setting
  12. end type
  13. type gb_1 from groupbox within w_system_import_setting
  14. end type
  15. type cb_export from commandbutton within w_system_import_setting
  16. end type
  17. end forward
  18. global type w_system_import_setting from window
  19. integer x = 814
  20. integer y = 864
  21. integer width = 2240
  22. integer height = 672
  23. boolean titlebar = true
  24. string title = "导入系统功能"
  25. boolean controlmenu = true
  26. boolean minbox = true
  27. windowtype windowtype = popup!
  28. long backcolor = 79741120
  29. cb_exit cb_exit
  30. cb_backup cb_backup
  31. cb_ch cb_ch
  32. sle_filename sle_filename
  33. gb_1 gb_1
  34. cb_export cb_export
  35. end type
  36. global w_system_import_setting w_system_import_setting
  37. type variables
  38. BOOLEAN OL_BACKUP=TRUE
  39. end variables
  40. on w_system_import_setting.create
  41. this.cb_exit=create cb_exit
  42. this.cb_backup=create cb_backup
  43. this.cb_ch=create cb_ch
  44. this.sle_filename=create sle_filename
  45. this.gb_1=create gb_1
  46. this.cb_export=create cb_export
  47. this.Control[]={this.cb_exit,&
  48. this.cb_backup,&
  49. this.cb_ch,&
  50. this.sle_filename,&
  51. this.gb_1,&
  52. this.cb_export}
  53. end on
  54. on w_system_import_setting.destroy
  55. destroy(this.cb_exit)
  56. destroy(this.cb_backup)
  57. destroy(this.cb_ch)
  58. destroy(this.sle_filename)
  59. destroy(this.gb_1)
  60. destroy(this.cb_export)
  61. end on
  62. event open;IF Message.DoubleParm = 1 THEN
  63. OL_BACKUP=FALSE
  64. END IF
  65. end event
  66. type cb_exit from commandbutton within w_system_import_setting
  67. integer x = 1326
  68. integer y = 368
  69. integer width = 320
  70. integer height = 96
  71. integer taborder = 80
  72. integer textsize = -9
  73. integer weight = 400
  74. fontcharset fontcharset = gb2312charset!
  75. fontpitch fontpitch = variable!
  76. string facename = "宋体"
  77. string text = "退出"
  78. end type
  79. event clicked;close(parent)
  80. end event
  81. type cb_backup from commandbutton within w_system_import_setting
  82. integer x = 832
  83. integer y = 368
  84. integer width = 320
  85. integer height = 96
  86. integer taborder = 50
  87. integer textsize = -9
  88. integer weight = 400
  89. fontcharset fontcharset = gb2312charset!
  90. fontpitch fontpitch = variable!
  91. string facename = "宋体"
  92. boolean enabled = false
  93. string text = "导入"
  94. end type
  95. event clicked;IF NOT sys_power_issuper THEN
  96. MessageBox('提示','你没有使用权限!',information!,ok!)
  97. RETURN
  98. END IF
  99. datastore ds_setting
  100. ds_setting = CREATE datastore
  101. ds_setting.DataObject = 'dw_system_import_setting'
  102. ds_setting.SetTransObject(sqlca)
  103. ds_setting.ImportFile(sle_filename.Text)
  104. ds_setting.AcceptText()
  105. IF ds_setting.RowCount() <= 0 THEN
  106. MessageBox('提示','你导入的系统功能文件没有数据',information!,ok!)
  107. RETURN
  108. END IF
  109. DELETE FROM sys_func_pwr;
  110. IF sqlca.SQLCode <> 0 THEN
  111. MessageBox('错误','删除原系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!)
  112. RETURN
  113. END IF
  114. Long ll_i
  115. Long ll_funcid
  116. Long ll_parentid
  117. Long ll_mainid
  118. Int li_functype
  119. String ls_treename
  120. String ls_menuname
  121. Int li_if_use
  122. Int li_sortflag
  123. int li_versiontype
  124. int li_worktype
  125. FOR ll_i = 1 TO ds_setting.RowCount()
  126. ll_funcid = ds_setting.Object.funcid[ll_i]
  127. ll_parentid = ds_setting.Object.parentid[ll_i]
  128. ll_mainid = ds_setting.Object.mainid[ll_i]
  129. li_functype = ds_setting.Object.functype[ll_i]
  130. ls_treename = ds_setting.Object.treename[ll_i]
  131. ls_menuname = ds_setting.Object.MenuName[ll_i]
  132. li_if_use = ds_setting.Object.if_use[ll_i]
  133. li_sortflag = ds_setting.Object.sortflag[ll_i]
  134. li_versiontype = ds_setting.Object.versiontype[ll_i]
  135. li_worktype = ds_setting.Object.worktype[ll_i]
  136. INSERT INTO sys_func_pwr(funcid,parentid,mainid,functype,treename,menuname,if_use,sortflag,versiontype,worktype)
  137. Values(:ll_funcid,:ll_parentid,:ll_mainid,:li_functype,:ls_treename,:ls_menuname,:li_if_use,:li_sortflag,:li_versiontype,:li_worktype);
  138. IF sqlca.SQLCode <> 0 THEN
  139. MessageBox('错误','导入系统功能数据失败,'+sqlca.SQLErrText,stopsign!,ok!)
  140. RETURN
  141. END IF
  142. NEXT
  143. commit;
  144. MessageBox('提示','导入系统功能数据成功',information!,ok!)
  145. end event
  146. type cb_ch from commandbutton within w_system_import_setting
  147. integer x = 1975
  148. integer y = 188
  149. integer width = 114
  150. integer height = 92
  151. integer taborder = 20
  152. integer textsize = -9
  153. integer weight = 400
  154. fontcharset fontcharset = gb2312charset!
  155. fontpitch fontpitch = variable!
  156. string facename = "宋体"
  157. string text = "..."
  158. end type
  159. event clicked;//new
  160. integer i
  161. string pathname,filename
  162. i=getfilesavename("选择备份文件",pathname,filename,"Dbf","数据文件Dbf,*.Dbf")
  163. IF i=1 AND TRIM(pathname)<>'' AND TRIM(FILENAME)<>"" THEN
  164. cb_backup.enabled=OL_BACKUP
  165. cb_export.enabled=OL_BACKUP
  166. sle_filename.text=pathname
  167. END IF
  168. end event
  169. type sle_filename from singlelineedit within w_system_import_setting
  170. event key pbm_keydown
  171. integer x = 151
  172. integer y = 188
  173. integer width = 1801
  174. integer height = 92
  175. integer taborder = 10
  176. integer textsize = -9
  177. integer weight = 400
  178. fontcharset fontcharset = gb2312charset!
  179. fontpitch fontpitch = variable!
  180. string facename = "宋体"
  181. long textcolor = 33554432
  182. borderstyle borderstyle = stylelowered!
  183. end type
  184. event key;if trim(this.text)="" then
  185. cb_backup.enabled=false
  186. else
  187. cb_backup.enabled=OL_BACKUP
  188. end if
  189. end event
  190. event modified;if trim(this.text)="" then
  191. cb_backup.enabled=false
  192. else
  193. cb_backup.enabled=OL_BACKUP
  194. end if
  195. end event
  196. type gb_1 from groupbox within w_system_import_setting
  197. integer x = 91
  198. integer y = 108
  199. integer width = 2030
  200. integer height = 216
  201. integer textsize = -9
  202. integer weight = 400
  203. fontcharset fontcharset = gb2312charset!
  204. fontpitch fontpitch = variable!
  205. string facename = "宋体"
  206. long textcolor = 33554432
  207. long backcolor = 79741120
  208. string text = "文件路径"
  209. end type
  210. type cb_export from commandbutton within w_system_import_setting
  211. integer x = 338
  212. integer y = 368
  213. integer width = 320
  214. integer height = 96
  215. integer taborder = 30
  216. integer textsize = -9
  217. integer weight = 400
  218. fontcharset fontcharset = gb2312charset!
  219. fontpitch fontpitch = variable!
  220. string facename = "宋体"
  221. boolean enabled = false
  222. string text = "导出"
  223. end type
  224. event clicked;IF NOT sys_power_issuper THEN
  225. MessageBox('提示','你没有使用权限!',information!,ok!)
  226. RETURN
  227. END IF
  228. string arg_filename,arg_msg
  229. blob arg_blob
  230. arg_filename = trim(sle_filename.text)
  231. if arg_filename = '' then
  232. messagebox('提示','请输入文件名称',information!,ok!)
  233. return
  234. end if
  235. if messagebox("询问","是否确定要将系统权限导出成文件",question!,yesno!,1) = 2 then
  236. return
  237. end if
  238. datastore ds_setting
  239. ds_setting = create datastore
  240. ds_setting.dataobject = 'dw_system_import_setting'
  241. ds_setting.settransobject(sqlca)
  242. ds_setting.retrieve( )
  243. if fileexists(arg_filename) then
  244. if messagebox("询问","指定文件已经存在,是否覆盖该文件?",question!,yesno!,2) = 2 then
  245. return
  246. end if
  247. end if
  248. if ds_setting.saveas(arg_filename,dbase2!,false) = 1 then
  249. arg_msg = '数据导出成功!'
  250. else
  251. arg_msg = '数据导出失败,如果该文件已打开请先关闭此文件再试!'
  252. end if
  253. messagebox('提示',arg_msg,information!,ok!)
  254. end event