w_outerconnection_def.srw 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  1. $PBExportHeader$w_outerconnection_def.srw
  2. forward
  3. global type w_outerconnection_def from w_publ_edit_index
  4. end type
  5. type cb_test_connet from uo_imflatbutton within w_outerconnection_def
  6. end type
  7. end forward
  8. global type w_outerconnection_def from w_publ_edit_index
  9. integer width = 3067
  10. integer height = 1680
  11. string title = "外部数据库连接设置"
  12. boolean minbox = true
  13. windowtype windowtype = popup!
  14. cb_test_connet cb_test_connet
  15. end type
  16. global w_outerconnection_def w_outerconnection_def
  17. on w_outerconnection_def.create
  18. int iCurrent
  19. call super::create
  20. this.cb_test_connet=create cb_test_connet
  21. iCurrent=UpperBound(this.Control)
  22. this.Control[iCurrent+1]=this.cb_test_connet
  23. end on
  24. on w_outerconnection_def.destroy
  25. call super::destroy
  26. destroy(this.cb_test_connet)
  27. end on
  28. event ue_usual_query_filt;call super::ue_usual_query_filt;IF dw_edit_mode OR KeyDown(keyf4!) OR KeyDown(keyf5!) THEN RETURN
  29. String obj_expr = ''
  30. IF Trim(sle_usual_query.Text) <> '' THEN
  31. IF Pos(Trim(sle_usual_query.Text),'%') = 0 THEN
  32. obj_expr = obj_expr+'( connectionname like "%'+Trim(sle_usual_query.Text)+'%" )'
  33. ELSE
  34. obj_expr = obj_expr+'( connectionname like "'+Trim(sle_usual_query.Text)+'" )'
  35. END IF
  36. END IF
  37. dw_uc.SetFilter(obj_expr)
  38. dw_uc.SetRedraw(FALSE)
  39. dw_index.SetRedraw(FALSE)
  40. dw_uc.Filter()
  41. IF dw_index.RowCount() >= 1 THEN
  42. dw_index.SelectRow(0,FALSE)
  43. dw_index.SelectRow(1,TRUE)
  44. END IF
  45. dw_uc.SetRedraw(TRUE)
  46. dw_index.SetRedraw(TRUE)
  47. end event
  48. event refresh_interface;call super::refresh_interface;cb_test_connet.Enabled = NOT dw_edit_mode
  49. end event
  50. type cb_func from w_publ_edit_index`cb_func within w_outerconnection_def
  51. integer x = 987
  52. end type
  53. type cb_exit from w_publ_edit_index`cb_exit within w_outerconnection_def
  54. integer x = 1138
  55. end type
  56. type sle_usual_query from w_publ_edit_index`sle_usual_query within w_outerconnection_def
  57. integer x = 320
  58. integer width = 736
  59. end type
  60. type cb_nextpage from w_publ_edit_index`cb_nextpage within w_outerconnection_def
  61. boolean visible = false
  62. integer x = 2235
  63. end type
  64. type cb_priorpage from w_publ_edit_index`cb_priorpage within w_outerconnection_def
  65. boolean visible = false
  66. integer x = 2071
  67. end type
  68. type cb_firstpage from w_publ_edit_index`cb_firstpage within w_outerconnection_def
  69. boolean visible = false
  70. integer x = 1906
  71. end type
  72. type cb_retrieveall from w_publ_edit_index`cb_retrieveall within w_outerconnection_def
  73. boolean visible = false
  74. integer x = 1742
  75. end type
  76. type em_pagerowno from w_publ_edit_index`em_pagerowno within w_outerconnection_def
  77. boolean visible = false
  78. integer x = 1440
  79. end type
  80. type st_pagerowno from w_publ_edit_index`st_pagerowno within w_outerconnection_def
  81. integer x = 1637
  82. end type
  83. type st_1 from w_publ_edit_index`st_1 within w_outerconnection_def
  84. integer width = 288
  85. string text = "连接名称含"
  86. end type
  87. type cb_add from w_publ_edit_index`cb_add within w_outerconnection_def
  88. integer x = 151
  89. end type
  90. event cb_add::clicked;IF dw_edit_mode THEN
  91. Long row
  92. Long ll_connectionid_tmp,cnt
  93. dw_uc.AcceptText( )
  94. row = dw_uc.GetRow( )
  95. IF row <= 0 THEN
  96. MessageBox('提示','请选择要保存的连接',information!,OK!)
  97. RETURN
  98. END IF
  99. IF dw_uc.Object.connectionname[row] = '' THEN
  100. dw_uc.SetColumn('connectionname')
  101. MessageBox('提示','请输入连接名称',information!,OK!)
  102. RETURN
  103. END IF
  104. IF dw_uc.Object.connectiontype[row] < 0 THEN
  105. dw_uc.SetColumn('connectiontype')
  106. MessageBox('提示','请选择连接类型',information!,OK!)
  107. RETURN
  108. END IF
  109. IF dw_uc.Object.ServerName[row] = '' THEN
  110. dw_uc.SetColumn('servername')
  111. MessageBox('提示','请输入数据库名称',information!,OK!)
  112. RETURN
  113. END IF
  114. IF dw_uc.Object.databasename[row] = '' THEN
  115. dw_uc.SetColumn('databasename')
  116. MessageBox('提示','请输入服务器名称',information!,OK!)
  117. RETURN
  118. END IF
  119. IF dw_uc.Object.LogID[row] = '' THEN
  120. dw_uc.SetColumn('logid')
  121. MessageBox('提示','请输入登陆ID',information!,OK!)
  122. RETURN
  123. END IF
  124. IF dw_uc.Object.connectiontype[row] = 0 THEN
  125. ll_connectionid_tmp = dw_uc.Object.connectionid[row]
  126. SELECT count(*) INTO :cnt
  127. FROM U_OuterConnection
  128. WHERE connectiontype = 0
  129. AND connectionid <> :ll_connectionid_tmp;
  130. IF sqlca.SQLCode <> 0 THEN
  131. MessageBox('错误','查询是否已存在附件数据库连接失败',stopsign!,OK!)
  132. RETURN
  133. END IF
  134. IF cnt > 0 THEN
  135. MessageBox('错误','已存在附件数据库连接,不能再建立',stopsign!,OK!)
  136. RETURN
  137. END IF
  138. END IF
  139. Long ll_connectionid
  140. String arg_msg
  141. IF dw_uc.Object.connectionid[dw_uc.GetRow()] = 0 THEN
  142. ll_connectionid = f_sys_scidentity(0,"U_OuterConnection","connectionid ",arg_msg,TRUE,sqlca)
  143. IF ll_connectionid <= 0 THEN
  144. MessageBox("错误",arg_msg,stopsign!,OK!)
  145. RETURN
  146. ELSE
  147. dw_uc.Object.connectionid[dw_uc.GetRow()] = ll_connectionid
  148. END IF
  149. END IF
  150. dw_uc.AcceptText( )
  151. END IF
  152. CALL SUPER::Clicked
  153. end event
  154. type cb_edit from w_publ_edit_index`cb_edit within w_outerconnection_def
  155. integer x = 343
  156. end type
  157. type cb_delet from w_publ_edit_index`cb_delet within w_outerconnection_def
  158. integer x = 535
  159. end type
  160. event cb_delet::clicked;call super::clicked;IF MessageBox ("询问","是否确定要删除当前记录?(选择确定后记录将不可恢复)",Question!,YesNo! ) = 2 THEN
  161. RETURN
  162. END IF
  163. dw_uc.SetRedraw (FALSE)
  164. dw_uc.DeleteRow (0)
  165. dw_uc.TriggerEvent (RowFocusChanged!)
  166. IF dw_uc.Update() = -1 THEN
  167. ROLLBACK;
  168. MessageBox ("错误","删除记录操作失败!",stopsign!,OK!)
  169. ELSE
  170. COMMIT;
  171. END IF
  172. dw_uc.SetRedraw (TRUE)
  173. WF_INDEX_UC()
  174. end event
  175. type cb_choice from w_publ_edit_index`cb_choice within w_outerconnection_def
  176. boolean visible = false
  177. integer x = 1138
  178. integer y = 484
  179. boolean enabled = false
  180. end type
  181. type cb_cancel from w_publ_edit_index`cb_cancel within w_outerconnection_def
  182. end type
  183. type cbx_mlselect from w_publ_edit_index`cbx_mlselect within w_outerconnection_def
  184. boolean visible = false
  185. integer x = 754
  186. integer y = 388
  187. boolean enabled = false
  188. end type
  189. type cbx_allselect from w_publ_edit_index`cbx_allselect within w_outerconnection_def
  190. boolean visible = false
  191. integer x = 1070
  192. integer y = 388
  193. boolean enabled = false
  194. end type
  195. type cb_mode_itfchg_b from w_publ_edit_index`cb_mode_itfchg_b within w_outerconnection_def
  196. end type
  197. type cb_mode_itfchg from w_publ_edit_index`cb_mode_itfchg within w_outerconnection_def
  198. integer x = 1454
  199. end type
  200. type gb_1 from w_publ_edit_index`gb_1 within w_outerconnection_def
  201. end type
  202. type dw_uc from w_publ_edit_index`dw_uc within w_outerconnection_def
  203. integer x = 1554
  204. integer width = 1458
  205. integer height = 1264
  206. string dataobject = "dw_outerconnection_edit"
  207. end type
  208. type cb_retrieve from w_publ_edit_index`cb_retrieve within w_outerconnection_def
  209. integer x = 0
  210. end type
  211. type cb_print from w_publ_edit_index`cb_print within w_outerconnection_def
  212. boolean visible = false
  213. integer x = 942
  214. integer y = 480
  215. boolean enabled = false
  216. end type
  217. type ln_bar from w_publ_edit_index`ln_bar within w_outerconnection_def
  218. end type
  219. type ln_bar2 from w_publ_edit_index`ln_bar2 within w_outerconnection_def
  220. end type
  221. type r_bar from w_publ_edit_index`r_bar within w_outerconnection_def
  222. end type
  223. type ln_1 from w_publ_edit_index`ln_1 within w_outerconnection_def
  224. end type
  225. type ln_2 from w_publ_edit_index`ln_2 within w_outerconnection_def
  226. end type
  227. type dw_index from w_publ_edit_index`dw_index within w_outerconnection_def
  228. integer width = 1554
  229. integer height = 1264
  230. string dataobject = "dw_outerconnection_index"
  231. end type
  232. type cb_test_connet from uo_imflatbutton within w_outerconnection_def
  233. integer x = 686
  234. integer height = 164
  235. integer taborder = 40
  236. boolean bringtotop = true
  237. string text = "测试连接"
  238. string normalpicname = "find.bmp"
  239. integer picsize = 16
  240. toolbaralignment pic_align = alignattop!
  241. boolean border = false
  242. end type
  243. event clicked;call super::clicked;
  244. Long ll_row
  245. dw_uc.AcceptText( )
  246. ll_row = dw_uc.GetRow()
  247. IF ll_row <= 0 THEN
  248. MessageBox('提示','请选择连接',information!,OK!)
  249. RETURN
  250. END IF
  251. Transaction test_Transaction
  252. test_Transaction = CREATE Transaction
  253. test_Transaction.dbms = dw_uc.Object.dbms[ll_row]
  254. test_Transaction.Database = dw_uc.Object.DatabaseName[ll_row]
  255. test_Transaction.LogID = dw_uc.Object.LogID[ll_row]
  256. test_Transaction.LogPass = dw_uc.Object.LogPass[ll_row]
  257. test_Transaction.ServerName = dw_uc.Object.ServerName[ll_row]
  258. CONNECT USING test_Transaction;
  259. IF test_Transaction.SQLCode <> 0 THEN
  260. MessageBox('错误','连接失败,'+test_Transaction.SQLErrText,stopsign!,OK!)
  261. ELSE
  262. MessageBox('提示','连接成功',information!,OK!)
  263. END IF
  264. DISCONNECT USING test_Transaction;
  265. end event