w_email_cloud.srw 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. $PBExportHeader$w_email_cloud.srw
  2. forward
  3. global type w_email_cloud from window
  4. end type
  5. type cb_3 from commandbutton within w_email_cloud
  6. end type
  7. type cb_2 from commandbutton within w_email_cloud
  8. end type
  9. type cb_1 from commandbutton within w_email_cloud
  10. end type
  11. type dw_1 from datawindow within w_email_cloud
  12. end type
  13. type s_email_cloudmx from structure within w_email_cloud
  14. end type
  15. end forward
  16. type s_email_cloudmx from structure
  17. string name
  18. string url
  19. end type
  20. global type w_email_cloud from window
  21. integer width = 2647
  22. integer height = 852
  23. boolean titlebar = true
  24. string title = "云盘附件"
  25. boolean controlmenu = true
  26. windowtype windowtype = response!
  27. long backcolor = 67108864
  28. string icon = "AppIcon!"
  29. boolean center = true
  30. cb_3 cb_3
  31. cb_2 cb_2
  32. cb_1 cb_1
  33. dw_1 dw_1
  34. end type
  35. global w_email_cloud w_email_cloud
  36. type variables
  37. boolean dw_edit_mode
  38. Long it_MXBT = 0
  39. private:
  40. s_email_cloudmx ss_email_cloudmx[]
  41. s_email_cloudmx sss_email_cloudmx
  42. end variables
  43. forward prototypes
  44. public subroutine wf_lock_child ()
  45. public subroutine wf_face ()
  46. public function integer acceptmx (string arg_name, string arg_url, ref string arg_msg)
  47. public function integer save (ref string arg_msg)
  48. end prototypes
  49. public subroutine wf_lock_child ();integer LS_INT
  50. IF dw_edit_mode THEN
  51. FOR LS_INT=1 TO 4
  52. dw_1.SetTabOrder (LS_INT,LS_INT*10 )
  53. dw_1.SetTabOrder (LS_INT,LS_INT*10 )
  54. NEXT
  55. ELSE
  56. FOR LS_INT=1 TO 50
  57. dw_1.SetTabOrder (LS_INT, 0)
  58. dw_1.SetTabOrder (LS_INT, 0)
  59. NEXT
  60. END IF
  61. end subroutine
  62. public subroutine wf_face ();IF dw_edit_mode THEN
  63. cb_2.Text = "保存"
  64. cb_1.Enabled = True
  65. cb_3.Enabled = True
  66. ELSE
  67. cb_2.Text = "修改"
  68. cb_1.Enabled = False
  69. cb_3.Enabled = False
  70. END IF
  71. end subroutine
  72. public function integer acceptmx (string arg_name, string arg_url, ref string arg_msg);Int rslt = 1
  73. Long cnt = 0,LS_i,ls_j
  74. IF IsNull(arg_name) THEN arg_name = ''
  75. IF IsNull(arg_url) THEN arg_url = ''
  76. IF Trim(arg_name) = '' THEN
  77. rslt = 0
  78. arG_MSG = '名称不能为空'
  79. GOTO ext
  80. END IF
  81. IF Trim(arg_url) = '' THEN
  82. rslt = 0
  83. arG_MSG = '地址不能为空'
  84. GOTO ext
  85. END IF
  86. //写入内容
  87. it_mxbt++
  88. ss_email_cloudmx[it_mxbt].name = arg_name
  89. ss_email_cloudmx[it_mxbt].url = arg_url
  90. ext:
  91. IF rslt = 0 THEN
  92. it_mxbt = 0
  93. END IF
  94. Return(rslt)
  95. end function
  96. public function integer save (ref string arg_msg);Integer rslt = 1,cnt = 0,i,j,k
  97. DateTime server_dt
  98. Long ll_billid
  99. String ls_sccode
  100. DELETE From u_email_cloud;
  101. IF sqlca.SQLCode <> 0 THEN
  102. rslt = 0
  103. arG_MSG = "删除旧有明细操作失败"+"~n"+sqlca.SQLErrText
  104. ROLLBACK Using sqlca;
  105. GOTO ext
  106. END IF
  107. FOR i = 1 To it_mxbt
  108. ll_billid = f_sys_scidentity(0,"u_email_cloud","id",arG_MSG,True,id_sqlca) //数据commit事务)
  109. IF ll_billid <= 0 THEN
  110. rslt = 0
  111. GOTO ext
  112. END IF
  113. INSERT INTO u_email_cloud
  114. ( id,
  115. name,
  116. url)
  117. VALUES (:ll_billid,
  118. :ss_email_cloudmx[i].name,
  119. :ss_email_cloudmx[i].url
  120. ) Using sqlca;
  121. IF sqlca.SQLCode <> 0 THEN
  122. ll_billid = 0 //还原billID
  123. rslt = 0
  124. arG_MSG = "因网络或其它原因导致插入明细操作失败"+"~n"+sqlca.SQLErrText
  125. ROLLBACK Using sqlca;
  126. GOTO ext
  127. END IF
  128. NEXT
  129. ext:
  130. //
  131. IF rslt = 0 THEN
  132. it_mxbt = 0
  133. ROLLBACK Using sqlca;
  134. ELSEIF rslt = 1 THEN
  135. COMMIT Using sqlca;
  136. END IF
  137. Return(rslt)
  138. end function
  139. on w_email_cloud.create
  140. this.cb_3=create cb_3
  141. this.cb_2=create cb_2
  142. this.cb_1=create cb_1
  143. this.dw_1=create dw_1
  144. this.Control[]={this.cb_3,&
  145. this.cb_2,&
  146. this.cb_1,&
  147. this.dw_1}
  148. end on
  149. on w_email_cloud.destroy
  150. destroy(this.cb_3)
  151. destroy(this.cb_2)
  152. destroy(this.cb_1)
  153. destroy(this.dw_1)
  154. end on
  155. event open;dw_1.SetTransObject(sqlca)
  156. wf_face()
  157. dw_1.retrieve()
  158. end event
  159. event close;closewithreturn(this, sss_email_cloudmx)
  160. end event
  161. type cb_3 from commandbutton within w_email_cloud
  162. integer x = 1701
  163. integer y = 640
  164. integer width = 457
  165. integer height = 116
  166. integer taborder = 40
  167. integer textsize = -9
  168. integer weight = 400
  169. fontcharset fontcharset = gb2312charset!
  170. fontpitch fontpitch = variable!
  171. string facename = "宋体"
  172. string text = "删行"
  173. end type
  174. event clicked;long ll_row
  175. ll_row=dw_1.getrow()
  176. if ll_row<=0 then return
  177. dw_1.deleterow(ll_row)
  178. end event
  179. type cb_2 from commandbutton within w_email_cloud
  180. integer x = 667
  181. integer y = 640
  182. integer width = 457
  183. integer height = 116
  184. integer taborder = 30
  185. integer textsize = -9
  186. integer weight = 400
  187. fontcharset fontcharset = gb2312charset!
  188. fontpitch fontpitch = variable!
  189. string facename = "宋体"
  190. string text = "保存"
  191. end type
  192. event clicked;Integer i
  193. String arg_msg
  194. IF dw_edit_mode THEN
  195. dw_1.AcceptText()
  196. FOR i = 1 To dw_1.RowCount()
  197. // IF dw_1.Object.Name[i] <> "" THEN
  198. IF acceptmx(dw_1.Object.Name[i],&
  199. dw_1.Object.url[i],&
  200. arg_msg) = 0 THEN
  201. MessageBox('Error!',arg_msg)
  202. RETURN
  203. END IF
  204. // END IF
  205. NEXT
  206. IF Save(arg_msg) = 0 THEN
  207. MessageBox('Error!',arg_msg)
  208. RETURN
  209. END IF
  210. MessageBox(publ_operator,'保存操作成功!')
  211. END IF
  212. dw_edit_mode = Not dw_edit_mode
  213. wf_lock_child()
  214. wf_face()
  215. end event
  216. type cb_1 from commandbutton within w_email_cloud
  217. integer x = 1179
  218. integer y = 640
  219. integer width = 457
  220. integer height = 116
  221. integer taborder = 20
  222. integer textsize = -9
  223. integer weight = 400
  224. fontcharset fontcharset = gb2312charset!
  225. fontpitch fontpitch = variable!
  226. string facename = "宋体"
  227. string text = "增行"
  228. end type
  229. event clicked;dw_1.insertrow(0)
  230. end event
  231. type dw_1 from datawindow within w_email_cloud
  232. integer x = 5
  233. integer y = 8
  234. integer width = 2624
  235. integer height = 592
  236. integer taborder = 10
  237. string title = "none"
  238. string dataobject = "dw_fj_cloud"
  239. boolean livescroll = true
  240. borderstyle borderstyle = stylelowered!
  241. end type
  242. event clicked;THIS.SelectRow(0,FALSE)
  243. THIS.SelectRow(row,TRUE)
  244. end event
  245. event doubleclicked;sss_email_cloudmx.name=dw_1.object.name[row]
  246. sss_email_cloudmx.url=dw_1.object.url[row]
  247. close(parent)
  248. end event