w_login.srw 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. $PBExportHeader$w_login.srw
  2. forward
  3. global type w_login from window
  4. end type
  5. type p_2 from picture within w_login
  6. end type
  7. type p_1 from picture within w_login
  8. end type
  9. type cb_2 from commandbutton within w_login
  10. end type
  11. type cb_1 from commandbutton within w_login
  12. end type
  13. type st_2 from statictext within w_login
  14. end type
  15. type st_1 from statictext within w_login
  16. end type
  17. type sle_2 from singlelineedit within w_login
  18. end type
  19. type sle_1 from singlelineedit within w_login
  20. end type
  21. end forward
  22. global type w_login from window
  23. integer width = 1838
  24. integer height = 1148
  25. boolean titlebar = true
  26. string title = "用户登录"
  27. windowtype windowtype = response!
  28. long backcolor = 16777215
  29. string icon = "AppIcon!"
  30. boolean center = true
  31. p_2 p_2
  32. p_1 p_1
  33. cb_2 cb_2
  34. cb_1 cb_1
  35. st_2 st_2
  36. st_1 st_1
  37. sle_2 sle_2
  38. sle_1 sle_1
  39. end type
  40. global w_login w_login
  41. type variables
  42. long ins_rslt///////////
  43. end variables
  44. on w_login.create
  45. this.p_2=create p_2
  46. this.p_1=create p_1
  47. this.cb_2=create cb_2
  48. this.cb_1=create cb_1
  49. this.st_2=create st_2
  50. this.st_1=create st_1
  51. this.sle_2=create sle_2
  52. this.sle_1=create sle_1
  53. this.Control[]={this.p_2,&
  54. this.p_1,&
  55. this.cb_2,&
  56. this.cb_1,&
  57. this.st_2,&
  58. this.st_1,&
  59. this.sle_2,&
  60. this.sle_1}
  61. end on
  62. on w_login.destroy
  63. destroy(this.p_2)
  64. destroy(this.p_1)
  65. destroy(this.cb_2)
  66. destroy(this.cb_1)
  67. destroy(this.st_2)
  68. destroy(this.st_1)
  69. destroy(this.sle_2)
  70. destroy(this.sle_1)
  71. end on
  72. event open;ins_rslt = 0
  73. end event
  74. event close;closewithreturn(this, ins_rslt)
  75. end event
  76. type p_2 from picture within w_login
  77. integer x = 1454
  78. integer y = 552
  79. integer width = 73
  80. integer height = 64
  81. string pointer = "HyperLink!"
  82. boolean originalsize = true
  83. string picturename = "HELP.BMP"
  84. boolean focusrectangle = false
  85. end type
  86. event clicked;open(w_about)
  87. end event
  88. type p_1 from picture within w_login
  89. integer width = 1829
  90. integer height = 504
  91. boolean originalsize = true
  92. string picturename = "login_logo.bmp"
  93. boolean focusrectangle = false
  94. end type
  95. type cb_2 from commandbutton within w_login
  96. integer x = 1138
  97. integer y = 860
  98. integer width = 302
  99. integer height = 120
  100. integer taborder = 40
  101. integer textsize = -9
  102. integer weight = 400
  103. fontcharset fontcharset = gb2312charset!
  104. fontpitch fontpitch = variable!
  105. string facename = "宋体"
  106. string text = "退出"
  107. end type
  108. event clicked;close(parent)
  109. end event
  110. type cb_1 from commandbutton within w_login
  111. integer x = 517
  112. integer y = 860
  113. integer width = 302
  114. integer height = 120
  115. integer taborder = 30
  116. integer textsize = -9
  117. integer weight = 400
  118. fontcharset fontcharset = gb2312charset!
  119. fontpitch fontpitch = variable!
  120. string facename = "宋体"
  121. string text = "登录"
  122. end type
  123. event clicked;Int rslt = 1
  124. String arg_Msg = ''
  125. IF sle_1.Text = '' THEN
  126. rslt = 0
  127. arg_Msg = '请输入用户名'
  128. sle_1.SetFocus()
  129. GOTO ext
  130. END IF
  131. IF app_token = '' THEN
  132. app_token = AppCom.GetToken()
  133. IF app_token = '' THEN
  134. rslt = 0
  135. arg_Msg = '与服务器建立会话失败'
  136. GOTO ext
  137. END IF
  138. END IF
  139. oleobject lo_dict, lo_rslt
  140. lo_dict = AppCom.CreatePbDictionary()
  141. lo_dict.SetString('token', app_token)
  142. lo_dict.SetString('usercode', sle_1.Text)
  143. lo_dict.SetString('psw', sle_2.Text)
  144. lo_rslt = AppCom.Login(lo_dict, Ref arg_Msg)
  145. IF arg_Msg <> '' THEN
  146. rslt = 0
  147. arg_Msg = '登录失败,' + arg_Msg
  148. GOTO ext
  149. END IF
  150. app_cusid = lo_rslt.GetInt('cusid')
  151. app_cuscode = lo_rslt.GetString('cuscode')
  152. app_cusname = lo_rslt.GetString('cusname')
  153. app_username = lo_rslt.GetString('username')
  154. app_custype = lo_rslt.GetString('custype')
  155. app_tele = lo_rslt.GetString('tele')
  156. app_address = lo_rslt.GetString('address')
  157. app_freight = lo_rslt.GetString('freight')
  158. app_freight_tele = lo_rslt.GetString('freight_tele')
  159. ext:
  160. IF rslt = 1 THEN
  161. ins_rslt = 1
  162. app_login = true
  163. Close(Parent)
  164. ELSE
  165. MessageBox('ERROR', arg_Msg)
  166. END IF
  167. end event
  168. type st_2 from statictext within w_login
  169. integer x = 288
  170. integer y = 728
  171. integer width = 206
  172. integer height = 48
  173. integer textsize = -9
  174. integer weight = 400
  175. fontcharset fontcharset = gb2312charset!
  176. fontpitch fontpitch = variable!
  177. string facename = "宋体"
  178. long textcolor = 33554432
  179. long backcolor = 16777215
  180. string text = "密码"
  181. alignment alignment = right!
  182. boolean focusrectangle = false
  183. end type
  184. type st_1 from statictext within w_login
  185. integer x = 288
  186. integer y = 560
  187. integer width = 206
  188. integer height = 48
  189. integer textsize = -9
  190. integer weight = 400
  191. fontcharset fontcharset = gb2312charset!
  192. fontpitch fontpitch = variable!
  193. string facename = "宋体"
  194. long textcolor = 33554432
  195. long backcolor = 16777215
  196. string text = "用户名"
  197. alignment alignment = right!
  198. boolean focusrectangle = false
  199. end type
  200. type sle_2 from singlelineedit within w_login
  201. event ue_dwnkey pbm_keydown
  202. integer x = 512
  203. integer y = 712
  204. integer width = 919
  205. integer height = 84
  206. integer taborder = 20
  207. integer textsize = -9
  208. integer weight = 400
  209. fontcharset fontcharset = gb2312charset!
  210. fontpitch fontpitch = variable!
  211. string facename = "宋体"
  212. long textcolor = 33554432
  213. boolean password = true
  214. borderstyle borderstyle = stylelowered!
  215. end type
  216. event ue_dwnkey;if keydown(keyenter!) then
  217. cb_1.TriggerEvent(clicked!)
  218. end if
  219. end event
  220. type sle_1 from singlelineedit within w_login
  221. event ue_dwnkey pbm_keydown
  222. integer x = 512
  223. integer y = 544
  224. integer width = 919
  225. integer height = 84
  226. integer taborder = 10
  227. integer textsize = -9
  228. integer weight = 400
  229. fontcharset fontcharset = gb2312charset!
  230. fontpitch fontpitch = variable!
  231. string facename = "宋体"
  232. long textcolor = 33554432
  233. borderstyle borderstyle = stylelowered!
  234. end type
  235. event ue_dwnkey;if keydown(keyenter!) then
  236. sle_2.SetFocus()
  237. end if
  238. end event